remove some unused code etc

pull/1173/head
Rich Harris 7 years ago
parent 7baba8bf8c
commit 27f6d560b5

@ -242,7 +242,6 @@ export default class Generator {
if (name === 'event' && isEventHandler) { if (name === 'event' && isEventHandler) {
// noop // noop
} else if (contexts.has(name)) { } else if (contexts.has(name)) {
// if (self.constructor.name === 'DomGenerator') { // TODO filthy, temporary hack
const contextName = contexts.get(name); const contextName = contexts.get(name);
if (contextName !== name) { if (contextName !== name) {
// this is true for 'reserved' names like `state` and `component`, // this is true for 'reserved' names like `state` and `component`,
@ -262,10 +261,6 @@ export default class Generator {
} }
} }
// TODO filthy, temporary hack
// if (!isEventHandler) code.prependRight(node.start, `state.`);
// }
usedContexts.add(name); usedContexts.add(name);
} else if (helpers.has(name)) { } else if (helpers.has(name)) {
let object = node; let object = node;
@ -274,8 +269,6 @@ export default class Generator {
const alias = self.templateVars.get(`helpers-${name}`); const alias = self.templateVars.get(`helpers-${name}`);
if (alias !== name) code.overwrite(object.start, object.end, alias); if (alias !== name) code.overwrite(object.start, object.end, alias);
} else if (indexes.has(name)) { } else if (indexes.has(name)) {
if (self.constructor.name === 'DomGenerator' && !isEventHandler) code.prependRight(node.start, `state.`);
const context = indexes.get(name); const context = indexes.get(name);
usedContexts.add(context); // TODO is this right? usedContexts.add(context); // TODO is this right?
usedIndexes.add(name); usedIndexes.add(name);
@ -381,8 +374,8 @@ export default class Generator {
return alias; return alias;
} }
getUniqueNameMaker(params: string[]) { getUniqueNameMaker() {
const localUsedNames = new Set(params); const localUsedNames = new Set();
function add(name: string) { function add(name: string) {
localUsedNames.add(name); localUsedNames.add(name);

@ -114,7 +114,7 @@ export default class Block {
this.aliases = new Map(); this.aliases = new Map();
this.variables = new Map(); this.variables = new Map();
this.getUniqueName = this.generator.getUniqueNameMaker([]); // TODO this is wrong... we probably don't need this any more this.getUniqueName = this.generator.getUniqueNameMaker();
this.hasUpdateMethod = false; // determined later this.hasUpdateMethod = false; // determined later
} }

@ -49,8 +49,8 @@ export class DomGenerator extends Generator {
this.metaBindings = []; this.metaBindings = [];
} }
getUniqueNameMaker(params: string[]) { getUniqueNameMaker() {
const localUsedNames = new Set(params); // TODO is this ever called with params? const localUsedNames = new Set();
function add(name: string) { function add(name: string) {
localUsedNames.add(name); localUsedNames.add(name);

@ -291,7 +291,7 @@ function create_each_block(component, state) {
c: function create() { c: function create() {
div = createElement("div"); div = createElement("div");
strong = createElement("strong"); strong = createElement("strong");
text = createText(state.i); text = createText(i);
text_1 = createText("\n\n\t\t"); text_1 = createText("\n\n\t\t");
span = createElement("span"); span = createElement("span");
text_2 = createText(text_2_value); text_2 = createText(text_2_value);

@ -91,7 +91,7 @@ function create_each_block(component, state) {
c: function create() { c: function create() {
div = createElement("div"); div = createElement("div");
strong = createElement("strong"); strong = createElement("strong");
text = createText(state.i); text = createText(i);
text_1 = createText("\n\n\t\t"); text_1 = createText("\n\n\t\t");
span = createElement("span"); span = createElement("span");
text_2 = createText(text_2_value); text_2 = createText(text_2_value);

Loading…
Cancel
Save