remove some unused code

pull/490/head
Rich-Harris 8 years ago
parent 49bea1b489
commit b7a40879a7

@ -151,13 +151,11 @@ export default class Generator {
}; };
} }
findDependencies ( block, expression, isEventHandler ) { findDependencies ( contextDependencies, expression ) {
if ( expression._dependencies ) return expression._dependencies; if ( expression._dependencies ) return expression._dependencies;
const dependencies = [];
const { contextDependencies, contexts } = block;
let scope = annotateWithScopes( expression ); let scope = annotateWithScopes( expression );
const dependencies = [];
walk( expression, { walk( expression, {
enter ( node, parent ) { enter ( node, parent ) {
@ -170,9 +168,7 @@ export default class Generator {
const { name } = flattenReference( node ); const { name } = flattenReference( node );
if ( scope.has( name ) ) return; if ( scope.has( name ) ) return;
if ( name === 'event' && isEventHandler ) { if ( contextDependencies.has( name ) ) {
// noop
} else if ( contexts.has( name ) ) {
dependencies.push( ...contextDependencies.get( name ) ); dependencies.push( ...contextDependencies.get( name ) );
} else { } else {
dependencies.push( name ); dependencies.push( name );

@ -74,8 +74,8 @@ export default class Block {
this.addElement( name, renderStatement, parentNode, true ); this.addElement( name, renderStatement, parentNode, true );
} }
findDependencies ( expression, isEventHandler ) { findDependencies ( expression ) {
return this.generator.findDependencies( this, expression, isEventHandler ); return this.generator.findDependencies( this.contextDependencies, expression );
} }
mount ( name, parentNode ) { mount ( name, parentNode ) {

@ -127,14 +127,6 @@ const preprocessors = {
const dependencies = block.findDependencies( attribute.value ); const dependencies = block.findDependencies( attribute.value );
block.addDependencies( dependencies ); block.addDependencies( dependencies );
} }
// else if ( attribute.type === 'EventHandler' ) {
// // TODO is this necessary?
// attribute.expression.arguments.forEach( arg => {
// const dependencies = block.findDependencies( arg );
// block.addDependencies( dependencies );
// });
// }
}); });
const isComponent = generator.components.has( node.name ) || node.name === ':Self'; const isComponent = generator.components.has( node.name ) || node.name === ':Self';
@ -175,6 +167,7 @@ export default function preprocess ( generator, children ) {
contexts: new Map(), contexts: new Map(),
indexes: new Map(), indexes: new Map(),
contextDependencies: new Map(),
params: [ 'root' ], params: [ 'root' ],
indexNames: new Map(), indexNames: new Map(),

Loading…
Cancel
Save