refactor(compiler-cli): avoid unnecessarily calling `getSourceFile()` twice in `PartialEvaluator` (#34441)
This is not expected to have any noticeable perf impact, but it wasteful nonetheless (and annoying when stepping through the code while debugging `ngtsc`/`ngcc`). PR Close #34441
This commit is contained in:
parent
b637b9322e
commit
7938ff34b1
|
@ -26,10 +26,11 @@ export class PartialEvaluator {
|
||||||
|
|
||||||
evaluate(expr: ts.Expression, foreignFunctionResolver?: ForeignFunctionResolver): ResolvedValue {
|
evaluate(expr: ts.Expression, foreignFunctionResolver?: ForeignFunctionResolver): ResolvedValue {
|
||||||
const interpreter = new StaticInterpreter(this.host, this.checker, this.dependencyTracker);
|
const interpreter = new StaticInterpreter(this.host, this.checker, this.dependencyTracker);
|
||||||
|
const sourceFile = expr.getSourceFile();
|
||||||
return interpreter.visit(expr, {
|
return interpreter.visit(expr, {
|
||||||
originatingFile: expr.getSourceFile(),
|
originatingFile: sourceFile,
|
||||||
absoluteModuleName: null,
|
absoluteModuleName: null,
|
||||||
resolutionContext: expr.getSourceFile().fileName,
|
resolutionContext: sourceFile.fileName,
|
||||||
scope: new Map<ts.ParameterDeclaration, ResolvedValue>(), foreignFunctionResolver,
|
scope: new Map<ts.ParameterDeclaration, ResolvedValue>(), foreignFunctionResolver,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue