refactor(compiler-cli): implement DeclarationNode
node type (#38959)
Previously the `ConcreteDeclaration` and `InlineDeclaration` had different properties for the underlying node type. And the `InlineDeclaration` did not store a value that represented its declaration. It turns out that a natural declaration node for an inline type is the expression. For example in UMD/CommonJS this would be the `exports.<name>` property access node. So this expression is now used for the `node` of `InlineDeclaration` types and the `expression` property is dropped. To support this the codebase has been refactored to use a new `DeclarationNode` type which is a union of `ts.Declaration|ts.Expression` instead of `ts.Declaration` throughout. PR Close #38959
This commit is contained in:

committed by
atscott

parent
2c0282f4c2
commit
0accd1e68d
@ -11,6 +11,7 @@ ts_library(
|
||||
"//packages/compiler-cli/src/ngtsc/file_system",
|
||||
"//packages/compiler-cli/src/ngtsc/file_system/testing",
|
||||
"//packages/compiler-cli/src/ngtsc/indexer",
|
||||
"//packages/compiler-cli/src/ngtsc/reflection",
|
||||
"//packages/compiler-cli/src/ngtsc/routing",
|
||||
"//packages/compiler-cli/src/ngtsc/testing",
|
||||
"//packages/compiler-cli/src/ngtsc/util",
|
||||
|
@ -16,6 +16,7 @@ import {absoluteFrom, AbsoluteFsPath, FileSystem, getFileSystem, NgtscCompilerHo
|
||||
import {Folder, MockFileSystem} from '../../src/ngtsc/file_system/testing';
|
||||
import {IndexedComponent} from '../../src/ngtsc/indexer';
|
||||
import {NgtscProgram} from '../../src/ngtsc/program';
|
||||
import {DeclarationNode} from '../../src/ngtsc/reflection';
|
||||
import {LazyRoute} from '../../src/ngtsc/routing';
|
||||
import {setWrapHostForTest} from '../../src/transformers/compiler_host';
|
||||
import {getCachedSourceFile} from '../helpers';
|
||||
@ -259,7 +260,7 @@ export class NgtscTestEnvironment {
|
||||
return program.listLazyRoutes(entryPoint);
|
||||
}
|
||||
|
||||
driveIndexer(): Map<ts.Declaration, IndexedComponent> {
|
||||
driveIndexer(): Map<DeclarationNode, IndexedComponent> {
|
||||
const {rootNames, options} = readNgcCommandLineAndConfiguration(['-p', this.basePath]);
|
||||
const host = createCompilerHost({options});
|
||||
const program = createProgram({rootNames, host, options});
|
||||
|
Reference in New Issue
Block a user