fix(ivy): getSourceFile() of transformed nodes returns undefined (#28412)
In some cases, calling getSourceFile() on a node from within a TS transform can return undefined (against the signature of the method). In these cases, getting the original node first will work. PR Close #28412
This commit is contained in:
parent
6e16338302
commit
66335c36e6
|
@ -167,7 +167,10 @@ export class NgModuleDecoratorHandler implements DecoratorHandler<NgModuleAnalys
|
||||||
if (analysis.metadataStmt !== null) {
|
if (analysis.metadataStmt !== null) {
|
||||||
ngModuleStatements.push(analysis.metadataStmt);
|
ngModuleStatements.push(analysis.metadataStmt);
|
||||||
}
|
}
|
||||||
const context = node.getSourceFile();
|
let context = node.getSourceFile();
|
||||||
|
if (context === undefined) {
|
||||||
|
context = ts.getOriginalNode(node).getSourceFile();
|
||||||
|
}
|
||||||
for (const decl of analysis.declarations) {
|
for (const decl of analysis.declarations) {
|
||||||
if (this.scopeRegistry.requiresRemoteScope(decl.node)) {
|
if (this.scopeRegistry.requiresRemoteScope(decl.node)) {
|
||||||
const scope = this.scopeRegistry.lookupCompilationScopeAsRefs(decl.node);
|
const scope = this.scopeRegistry.lookupCompilationScopeAsRefs(decl.node);
|
||||||
|
|
Loading…
Reference in New Issue