(sf: ts.SourceFile)
| 63 | * Returns the `NgExtensionData` for a given `ts.SourceFile`, adding it if none exists. |
| 64 | */ |
| 65 | export function sfExtensionData(sf: ts.SourceFile): NgExtensionData { |
| 66 | const extSf = sf as MaybeNgExtendedSourceFile; |
| 67 | if (extSf[NgExtension] !== undefined) { |
| 68 | // The file already has extension data, so return it directly. |
| 69 | return extSf[NgExtension]!; |
| 70 | } |
| 71 | |
| 72 | // The file has no existing extension data, so add it and return it. |
| 73 | const extension: NgExtensionData = { |
| 74 | isTopLevelShim: false, |
| 75 | fileShim: null, |
| 76 | originalReferencedFiles: null, |
| 77 | taggedReferenceFiles: null, |
| 78 | }; |
| 79 | extSf[NgExtension] = extension; |
| 80 | return extension; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Data associated with a per-shim instance `ts.SourceFile`. |
no outgoing calls
no test coverage detected