* Metadata container for a `Target` that allows queries for specific bits of metadata. * * See `BoundTarget` for documentation on the individual methods.
| 1235 | * See `BoundTarget` for documentation on the individual methods. |
| 1236 | */ |
| 1237 | class R3BoundTarget<DirectiveT extends DirectiveMeta> implements BoundTarget<DirectiveT> { |
| 1238 | /** Deferred blocks, ordered as they appear in the template. */ |
| 1239 | private deferredBlocks: DeferredBlock[]; |
| 1240 | |
| 1241 | /** Map of deferred blocks to their scope. */ |
| 1242 | private deferredScopes: Map<DeferredBlock, Scope>; |
| 1243 | |
| 1244 | constructor( |
| 1245 | readonly target: Target<DirectiveT>, |
| 1246 | private directives: MatchedDirectives<DirectiveT>, |
| 1247 | private foreignComponents: Map<Element, ForeignComponentMeta>, |
| 1248 | private eagerDirectives: DirectiveT[], |
| 1249 | private bindings: BindingsMap<DirectiveT>, |
| 1250 | private references: ReferenceMap<DirectiveT>, |
| 1251 | private exprTargets: Map<AST, TemplateEntity>, |
| 1252 | private symbols: Map<TemplateEntity, ScopedNode>, |
| 1253 | private nestingLevel: Map<ScopedNode, number>, |
| 1254 | private scopedNodeEntities: ScopedNodeEntities, |
| 1255 | private usedPipes: Set<string>, |
| 1256 | private eagerPipes: Set<string>, |
| 1257 | rawDeferred: DeferBlockScopes, |
| 1258 | private pipes: Map<BindingPipe, DeferredBlock[]>, |
| 1259 | private conflictingHostDirectiveBindings: Map< |
| 1260 | DirectiveOwner, |
| 1261 | ConflictingHostDirectiveBinding<DirectiveT>[] |
| 1262 | >, |
| 1263 | ) { |
| 1264 | this.deferredBlocks = rawDeferred.map((current) => current[0]); |
| 1265 | this.deferredScopes = new Map(rawDeferred); |
| 1266 | } |
| 1267 | |
| 1268 | getEntitiesInScope(node: ScopedNode | null): ReadonlySet<TemplateEntity> { |
| 1269 | return this.scopedNodeEntities.get(node) ?? new Set(); |
| 1270 | } |
| 1271 | |
| 1272 | getDirectivesOfNode(node: DirectiveOwner): DirectiveT[] | null { |
| 1273 | return this.directives.get(node) || null; |
| 1274 | } |
| 1275 | |
| 1276 | getForeignComponent(element: Element): ForeignComponentMeta | null { |
| 1277 | return this.foreignComponents.get(element) || null; |
| 1278 | } |
| 1279 | |
| 1280 | getReferenceTarget(ref: Reference): ReferenceTarget<DirectiveT> | null { |
| 1281 | return this.references.get(ref) || null; |
| 1282 | } |
| 1283 | |
| 1284 | getConsumerOfBinding( |
| 1285 | binding: BoundAttribute | BoundEvent | TextAttribute, |
| 1286 | ): DirectiveT | Element | Template | null { |
| 1287 | return this.bindings.get(binding) || null; |
| 1288 | } |
| 1289 | |
| 1290 | getExpressionTarget(expr: AST): TemplateEntity | null { |
| 1291 | return this.exprTargets.get(expr) || null; |
| 1292 | } |
| 1293 | |
| 1294 | getDefinitionNodeOfSymbol(symbol: TemplateEntity): ScopedNode | null { |
nothing calls this directly
no outgoing calls
no test coverage detected