* Synthesize `ScopeData` metadata from an array of `TestDeclaration`s.
(program: ts.Program, sf: ts.SourceFile, decls: TestDeclaration[])
| 689 | * Synthesize `ScopeData` metadata from an array of `TestDeclaration`s. |
| 690 | */ |
| 691 | function makeScope(program: ts.Program, sf: ts.SourceFile, decls: TestDeclaration[]): ScopeData { |
| 692 | const scope: ScopeData = {dependencies: [], isPoisoned: false}; |
| 693 | |
| 694 | for (const decl of decls) { |
| 695 | let declSf = sf; |
| 696 | if (decl.file !== undefined) { |
| 697 | declSf = getSourceFileOrError(program, decl.file); |
| 698 | } |
| 699 | const declClass = getClass(declSf, decl.name); |
| 700 | |
| 701 | if (decl.type === 'directive') { |
| 702 | scope.dependencies.push({ |
| 703 | kind: MetaKind.Directive, |
| 704 | matchSource: MatchSource.Selector, |
| 705 | ref: new Reference(declClass), |
| 706 | baseClass: null, |
| 707 | name: decl.name, |
| 708 | selector: decl.selector, |
| 709 | queries: [], |
| 710 | inputs: ClassPropertyMapping.fromMappedObject<InputMapping>(decl.inputs || {}), |
| 711 | outputs: ClassPropertyMapping.fromMappedObject(decl.outputs || {}), |
| 712 | isComponent: decl.isComponent ?? false, |
| 713 | exportAs: decl.exportAs ?? null, |
| 714 | ngTemplateGuards: decl.ngTemplateGuards ?? [], |
| 715 | hasNgTemplateContextGuard: decl.hasNgTemplateContextGuard ?? false, |
| 716 | coercedInputFields: new Set<string>(decl.coercedInputFields ?? []), |
| 717 | restrictedInputFields: new Set<string>(decl.restrictedInputFields ?? []), |
| 718 | stringLiteralInputFields: new Set<string>(decl.stringLiteralInputFields ?? []), |
| 719 | undeclaredInputFields: new Set<string>(decl.undeclaredInputFields ?? []), |
| 720 | publicMethods: new Set<string>(decl.publicMethods ?? []), |
| 721 | isGeneric: decl.isGeneric ?? false, |
| 722 | isPoisoned: false, |
| 723 | isStructural: false, |
| 724 | animationTriggerNames: null, |
| 725 | isStandalone: false, |
| 726 | imports: null, |
| 727 | foreignImports: null, |
| 728 | rawImports: null, |
| 729 | deferredImports: null, |
| 730 | deferredImportsByBlock: null, |
| 731 | schemas: null, |
| 732 | decorator: null, |
| 733 | assumedToExportProviders: false, |
| 734 | ngContentSelectors: decl.ngContentSelectors || null, |
| 735 | preserveWhitespaces: decl.preserveWhitespaces ?? false, |
| 736 | isExplicitlyDeferred: false, |
| 737 | deferredBlocks: null, |
| 738 | inputFieldNamesFromMetadataArray: null, |
| 739 | hostDirectives: |
| 740 | decl.hostDirectives === undefined |
| 741 | ? null |
| 742 | : decl.hostDirectives.map((hostDecl) => { |
| 743 | return { |
| 744 | directive: new Reference( |
| 745 | getClass( |
| 746 | hostDecl.directive.file |
| 747 | ? getSourceFileOrError(program, hostDecl.directive.file) |
| 748 | : sf, |
no test coverage detected