This commit consolidates the options that can modify the parsing of text (e.g. HTML, Angular templates, CSS, i18n) into an AST for further processing into a single `options` hash. This makes the code cleaner and more readable, but also enables us to support further options to parsing without triggering wide ranging changes to code that should not be affected by these new options. Specifically, it will let us pass information about the placement of a template that is being parsed in its containing file, which is essential for accurate SourceMap processing. PR Close #28055 PR Close #28736
This commit is contained in:

committed by
Andrew Kushnir

parent
dfb331cd18
commit
1a0b2ff4fb
@ -157,12 +157,7 @@ export class DiagnosticContext {
|
||||
};
|
||||
const urlResolver = createOfflineCompileUrlResolver();
|
||||
const htmlParser = new class extends HtmlParser {
|
||||
parse(
|
||||
source: string, url: string, parseExpansionForms: boolean = false,
|
||||
interpolationConfig: InterpolationConfig = DEFAULT_INTERPOLATION_CONFIG):
|
||||
ParseTreeResult {
|
||||
return new ParseTreeResult([], []);
|
||||
}
|
||||
parse(): ParseTreeResult { return new ParseTreeResult([], []); }
|
||||
};
|
||||
|
||||
// This tracks the CompileConfig in codegen.ts. Currently these options
|
||||
@ -209,7 +204,7 @@ function compileTemplate(context: DiagnosticContext, type: StaticSymbol, templat
|
||||
const parser = new TemplateParser(
|
||||
config, context.reflector, expressionParser, new DomElementSchemaRegistry(), htmlParser,
|
||||
null !, []);
|
||||
const htmlResult = htmlParser.parse(template, '', true);
|
||||
const htmlResult = htmlParser.parse(template, '', {tokenizeExpansionForms: true});
|
||||
const analyzedModules = context.analyzedModules;
|
||||
// let errors: Diagnostic[]|undefined = undefined;
|
||||
let ngModule = analyzedModules.ngModuleByPipeOrDirective.get(type);
|
||||
|
Reference in New Issue
Block a user