pull/14456/head
Rich Harris 2 years ago
parent d2ce0a79ae
commit 2867cc1801

@ -315,7 +315,10 @@ function open(parser) {
name
},
parameters: function_expression.params,
body: create_fragment()
body: create_fragment(),
metadata: {
sites: new Set()
}
});
parser.stack.push(block);
parser.fragments.push(block.body);
@ -609,7 +612,8 @@ function special(parser) {
expression: expression,
metadata: {
dynamic: false,
args_with_call_expression: new Set()
args_with_call_expression: new Set(),
snippets: []
}
});
}

@ -20,6 +20,9 @@ export function RenderTag(node, context) {
node.metadata.dynamic =
callee.type !== 'Identifier' || context.state.scope.get(callee.name)?.kind !== 'normal';
// TODO populate node.metadata.snippets with all the locally-defined snippets that this
// could refer to, and create bidirectional links
context.state.analysis.uses_render_tags = true;
const raw_args = unwrap_optional(node.expression).arguments;

@ -15,6 +15,11 @@ import { mark_subtree_dynamic } from './fragment.js';
* @param {Context} context
*/
export function visit_component(node, context) {
node.metadata.snippets = [];
// TODO populate node.metadata.snippets with all the locally-defined snippets that this
// could refer to, and create bidirectional links
mark_subtree_dynamic(context.path);
for (const attribute of node.attributes) {

@ -168,6 +168,9 @@ export namespace AST {
dynamic: boolean;
args_with_call_expression: Set<number>;
path: SvelteNode[];
/** The set of locally-defined snippets that this render tag could correspond to,
* used for CSS pruning purposes */
snippets: SnippetBlock[];
};
}
@ -280,6 +283,9 @@ export namespace AST {
metadata: {
scopes: Record<string, Scope>;
dynamic: boolean;
/** The set of locally-defined snippets that this component tag could render,
* used for CSS pruning purposes */
snippets: SnippetBlock[];
};
}
@ -320,6 +326,9 @@ export namespace AST {
/** @internal */
metadata: {
scopes: Record<string, Scope>;
/** The set of locally-defined snippets that this component tag could render,
* used for CSS pruning purposes */
snippets: SnippetBlock[];
};
}
@ -371,6 +380,9 @@ export namespace AST {
/** @internal */
metadata: {
scopes: Record<string, Scope>;
/** The set of locally-defined snippets that this component tag could render,
* used for CSS pruning purposes */
snippets: SnippetBlock[];
};
}
@ -440,6 +452,12 @@ export namespace AST {
expression: Identifier;
parameters: Pattern[];
body: Fragment;
/** @internal */
metadata: {
/** The set of components/render tags that could render this snippet,
* used for CSS pruning */
sites: Set<Component | SvelteComponent | RenderTag>;
};
}
export interface Attribute extends BaseNode {

Loading…
Cancel
Save