refactor: re-enable dynamic queries migration (#32992)
Re-enables the dynamic queries migration, now that we have all of the necessary framework changes in place. Also moves the logic that identifies static queries out of the compiler and into the static queries migration, because that's the only place left that's using it. PR Close #32992
This commit is contained in:

committed by
Alex Rickabaugh

parent
94b9b7e154
commit
7f6429d802
@ -86,7 +86,7 @@ export * from './schema/dom_element_schema_registry';
|
||||
export * from './selector';
|
||||
export * from './style_compiler';
|
||||
export * from './template_parser/template_parser';
|
||||
export {ViewCompiler, findStaticQueryIds, staticViewQueryIds} from './view_compiler/view_compiler';
|
||||
export {ViewCompiler} from './view_compiler/view_compiler';
|
||||
export {getParseErrors, isSyntaxError, syntaxError, Version} from './util';
|
||||
export {SourceMap} from './output/source_map';
|
||||
export * from './injectable_compiler_2';
|
||||
|
@ -1013,57 +1013,6 @@ function callUnwrapValue(nodeIndex: number, bindingIdx: number, expr: o.Expressi
|
||||
]);
|
||||
}
|
||||
|
||||
interface StaticAndDynamicQueryIds {
|
||||
staticQueryIds: Set<number>;
|
||||
dynamicQueryIds: Set<number>;
|
||||
}
|
||||
|
||||
|
||||
export function findStaticQueryIds(
|
||||
nodes: TemplateAst[], result = new Map<TemplateAst, StaticAndDynamicQueryIds>()):
|
||||
Map<TemplateAst, StaticAndDynamicQueryIds> {
|
||||
nodes.forEach((node) => {
|
||||
const staticQueryIds = new Set<number>();
|
||||
const dynamicQueryIds = new Set<number>();
|
||||
let queryMatches: QueryMatch[] = undefined !;
|
||||
if (node instanceof ElementAst) {
|
||||
findStaticQueryIds(node.children, result);
|
||||
node.children.forEach((child) => {
|
||||
const childData = result.get(child) !;
|
||||
childData.staticQueryIds.forEach(queryId => staticQueryIds.add(queryId));
|
||||
childData.dynamicQueryIds.forEach(queryId => dynamicQueryIds.add(queryId));
|
||||
});
|
||||
queryMatches = node.queryMatches;
|
||||
} else if (node instanceof EmbeddedTemplateAst) {
|
||||
findStaticQueryIds(node.children, result);
|
||||
node.children.forEach((child) => {
|
||||
const childData = result.get(child) !;
|
||||
childData.staticQueryIds.forEach(queryId => dynamicQueryIds.add(queryId));
|
||||
childData.dynamicQueryIds.forEach(queryId => dynamicQueryIds.add(queryId));
|
||||
});
|
||||
queryMatches = node.queryMatches;
|
||||
}
|
||||
if (queryMatches) {
|
||||
queryMatches.forEach((match) => staticQueryIds.add(match.queryId));
|
||||
}
|
||||
dynamicQueryIds.forEach(queryId => staticQueryIds.delete(queryId));
|
||||
result.set(node, {staticQueryIds, dynamicQueryIds});
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
export function staticViewQueryIds(nodeStaticQueryIds: Map<TemplateAst, StaticAndDynamicQueryIds>):
|
||||
StaticAndDynamicQueryIds {
|
||||
const staticQueryIds = new Set<number>();
|
||||
const dynamicQueryIds = new Set<number>();
|
||||
Array.from(nodeStaticQueryIds.values()).forEach((entry) => {
|
||||
entry.staticQueryIds.forEach(queryId => staticQueryIds.add(queryId));
|
||||
entry.dynamicQueryIds.forEach(queryId => dynamicQueryIds.add(queryId));
|
||||
});
|
||||
dynamicQueryIds.forEach(queryId => staticQueryIds.delete(queryId));
|
||||
return {staticQueryIds, dynamicQueryIds};
|
||||
}
|
||||
|
||||
function elementEventNameAndTarget(
|
||||
eventAst: BoundEventAst, dirAst: DirectiveAst | null): {name: string, target: string | null} {
|
||||
if (eventAst.isAnimation) {
|
||||
|
Reference in New Issue
Block a user