* Synthesize `ScopeData` metadata from an array of `TestDeclaration`s.
(program: ts.Program, sf: ts.SourceFile, decls: TestDeclaration[])
| 983 | * Synthesize `ScopeData` metadata from an array of `TestDeclaration`s. |
| 984 | */ |
| 985 | function makeScope(program: ts.Program, sf: ts.SourceFile, decls: TestDeclaration[]): ScopeData { |
| 986 | const scope: ScopeData = {dependencies: [], isPoisoned: false}; |
| 987 | |
| 988 | for (const decl of decls) { |
| 989 | let declSf = sf; |
| 990 | if (decl.file !== undefined) { |
| 991 | declSf = getSourceFileOrError(program, decl.file); |
| 992 | } |
| 993 | const declClass = getClass(declSf, decl.name); |
| 994 | |
| 995 | if (decl.type === 'directive') { |
| 996 | scope.dependencies.push({ |
| 997 | kind: MetaKind.Directive, |
| 998 | matchSource: MatchSource.Selector, |
| 999 | ref: new Reference(declClass), |
| 1000 | baseClass: null, |
| 1001 | name: decl.name, |
| 1002 | selector: decl.selector, |
| 1003 | queries: [], |
| 1004 | inputs: ClassPropertyMapping.fromMappedObject<InputMapping>(decl.inputs || {}), |
| 1005 | outputs: ClassPropertyMapping.fromMappedObject(decl.outputs || {}), |
| 1006 | isComponent: decl.isComponent ?? false, |
| 1007 | exportAs: decl.exportAs ?? null, |
| 1008 | ngTemplateGuards: decl.ngTemplateGuards ?? [], |
| 1009 | hasNgTemplateContextGuard: decl.hasNgTemplateContextGuard ?? false, |
| 1010 | coercedInputFields: new Set<string>(decl.coercedInputFields ?? []), |
| 1011 | restrictedInputFields: new Set<string>(decl.restrictedInputFields ?? []), |
| 1012 | stringLiteralInputFields: new Set<string>(decl.stringLiteralInputFields ?? []), |
| 1013 | undeclaredInputFields: new Set<string>(decl.undeclaredInputFields ?? []), |
| 1014 | publicMethods: new Set<string>(decl.publicMethods ?? []), |
| 1015 | isGeneric: decl.isGeneric ?? false, |
| 1016 | isPoisoned: false, |
| 1017 | isStructural: false, |
| 1018 | animationTriggerNames: null, |
| 1019 | isStandalone: false, |
| 1020 | isSignal: false, |
| 1021 | imports: null, |
| 1022 | foreignImports: null, |
| 1023 | rawImports: null, |
| 1024 | deferredImports: null, |
| 1025 | schemas: null, |
| 1026 | decorator: null, |
| 1027 | assumedToExportProviders: false, |
| 1028 | ngContentSelectors: decl.ngContentSelectors || null, |
| 1029 | preserveWhitespaces: decl.preserveWhitespaces ?? false, |
| 1030 | isExplicitlyDeferred: false, |
| 1031 | inputFieldNamesFromMetadataArray: null, |
| 1032 | selectorlessEnabled: false, |
| 1033 | localReferencedSymbols: null, |
| 1034 | hostDirectives: |
| 1035 | decl.hostDirectives === undefined |
| 1036 | ? null |
| 1037 | : decl.hostDirectives.map((hostDecl) => { |
| 1038 | return { |
| 1039 | directive: new Reference( |
| 1040 | getClass( |
| 1041 | hostDecl.directive.file |
| 1042 | ? getSourceFileOrError(program, hostDecl.directive.file) |
no test coverage detected