* Synthesize `ScopeData` metadata from an array of `TestDeclaration`s.
(program: ts.Program, sf: ts.SourceFile, decls: TestDeclaration[])
| 960 | * Synthesize `ScopeData` metadata from an array of `TestDeclaration`s. |
| 961 | */ |
| 962 | function makeScope(program: ts.Program, sf: ts.SourceFile, decls: TestDeclaration[]): ScopeData { |
| 963 | const scope: ScopeData = {dependencies: [], isPoisoned: false}; |
| 964 | |
| 965 | for (const decl of decls) { |
| 966 | let declSf = sf; |
| 967 | if (decl.file !== undefined) { |
| 968 | declSf = getSourceFileOrError(program, decl.file); |
| 969 | } |
| 970 | const declClass = getClass(declSf, decl.name); |
| 971 | |
| 972 | if (decl.type === 'directive') { |
| 973 | scope.dependencies.push({ |
| 974 | kind: MetaKind.Directive, |
| 975 | matchSource: MatchSource.Selector, |
| 976 | ref: new Reference(declClass), |
| 977 | baseClass: null, |
| 978 | name: decl.name, |
| 979 | selector: decl.selector, |
| 980 | queries: [], |
| 981 | inputs: ClassPropertyMapping.fromMappedObject<InputMapping>(decl.inputs || {}), |
| 982 | outputs: ClassPropertyMapping.fromMappedObject(decl.outputs || {}), |
| 983 | isComponent: decl.isComponent ?? false, |
| 984 | exportAs: decl.exportAs ?? null, |
| 985 | ngTemplateGuards: decl.ngTemplateGuards ?? [], |
| 986 | hasNgTemplateContextGuard: decl.hasNgTemplateContextGuard ?? false, |
| 987 | coercedInputFields: new Set<string>(decl.coercedInputFields ?? []), |
| 988 | restrictedInputFields: new Set<string>(decl.restrictedInputFields ?? []), |
| 989 | stringLiteralInputFields: new Set<string>(decl.stringLiteralInputFields ?? []), |
| 990 | undeclaredInputFields: new Set<string>(decl.undeclaredInputFields ?? []), |
| 991 | publicMethods: new Set<string>(decl.publicMethods ?? []), |
| 992 | isGeneric: decl.isGeneric ?? false, |
| 993 | isPoisoned: false, |
| 994 | isStructural: false, |
| 995 | animationTriggerNames: null, |
| 996 | isStandalone: false, |
| 997 | isSignal: false, |
| 998 | imports: null, |
| 999 | foreignImports: null, |
| 1000 | rawImports: null, |
| 1001 | deferredImports: null, |
| 1002 | schemas: null, |
| 1003 | decorator: null, |
| 1004 | assumedToExportProviders: false, |
| 1005 | ngContentSelectors: decl.ngContentSelectors || null, |
| 1006 | preserveWhitespaces: decl.preserveWhitespaces ?? false, |
| 1007 | isExplicitlyDeferred: false, |
| 1008 | inputFieldNamesFromMetadataArray: null, |
| 1009 | selectorlessEnabled: false, |
| 1010 | localReferencedSymbols: null, |
| 1011 | hostDirectives: |
| 1012 | decl.hostDirectives === undefined |
| 1013 | ? null |
| 1014 | : decl.hostDirectives.map((hostDecl) => { |
| 1015 | return { |
| 1016 | directive: new Reference( |
| 1017 | getClass( |
| 1018 | hostDecl.directive.file |
| 1019 | ? getSourceFileOrError(program, hostDecl.directive.file) |
no test coverage detected