0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00

remove some unused code

This commit is contained in:
Rich-Harris 2017-04-17 14:55:42 -04:00
parent 49bea1b489
commit b7a40879a7
3 changed files with 6 additions and 17 deletions

View File

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

View File

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

View File

@ -127,14 +127,6 @@ const preprocessors = {
const dependencies = block.findDependencies( attribute.value );
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';
@ -175,6 +167,7 @@ export default function preprocess ( generator, children ) {
contexts: new Map(),
indexes: new Map(),
contextDependencies: new Map(),
params: [ 'root' ],
indexNames: new Map(),