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:
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;
|
||||
|
||||
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 );
|
||||
|
@ -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 ) {
|
||||
|
@ -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(),
|
||||
|
Loading…
Reference in New Issue
Block a user