contextualise is only called once per expression

pull/490/head
Rich-Harris 8 years ago
parent c9a2bf98a5
commit f8f32a13ba

@ -63,8 +63,6 @@ export default class Generator {
} }
contextualise ( block, expression, context, isEventHandler ) { contextualise ( block, expression, context, isEventHandler ) {
if ( expression._contextualised ) return expression._contextualised;
this.addSourcemapLocations( expression ); this.addSourcemapLocations( expression );
const usedContexts = []; const usedContexts = [];
@ -155,13 +153,11 @@ export default class Generator {
} }
}); });
expression._contextualised = { return {
dependencies, dependencies,
contexts: usedContexts, contexts: usedContexts,
snippet: `[✂${expression.start}-${expression.end}✂]` snippet: `[✂${expression.start}-${expression.end}✂]`
}; };
return expression._contextualised;
} }
findDependencies ( block, expression, isEventHandler ) { findDependencies ( block, expression, isEventHandler ) {

@ -187,7 +187,7 @@ function unkeyed ( generator, block, state, node, snippet, { create_each_block,
} }
` ); ` );
const { dependencies } = block.contextualise( node.expression ); const dependencies = block.findDependencies( node.expression );
const allDependencies = new Set( block.dependencies ); const allDependencies = new Set( block.dependencies );
dependencies.forEach( dependency => { dependencies.forEach( dependency => {
allDependencies.add( dependency ); allDependencies.add( dependency );

Loading…
Cancel
Save