* Metadata container for a `Target` that allows queries for specific bits of metadata. * * See `BoundTarget` for documentation on the individual methods.
| 1173 | * See `BoundTarget` for documentation on the individual methods. |
| 1174 | */ |
| 1175 | class R3BoundTarget<DirectiveT extends DirectiveMeta> implements BoundTarget<DirectiveT> { |
| 1176 | /** Deferred blocks, ordered as they appear in the template. */ |
| 1177 | private deferredBlocks: DeferredBlock[]; |
| 1178 | |
| 1179 | /** Map of deferred blocks to their scope. */ |
| 1180 | private deferredScopes: Map<DeferredBlock, Scope>; |
| 1181 | |
| 1182 | constructor( |
| 1183 | readonly target: Target<DirectiveT>, |
| 1184 | private directives: MatchedDirectives<DirectiveT>, |
| 1185 | private eagerDirectives: DirectiveT[], |
| 1186 | private missingDirectives: Set<string>, |
| 1187 | private bindings: BindingsMap<DirectiveT>, |
| 1188 | private references: ReferenceMap<DirectiveT>, |
| 1189 | private exprTargets: Map<AST, TemplateEntity>, |
| 1190 | private symbols: Map<TemplateEntity, Template>, |
| 1191 | private nestingLevel: Map<ScopedNode, number>, |
| 1192 | private scopedNodeEntities: ScopedNodeEntities, |
| 1193 | private usedPipes: Set<string>, |
| 1194 | private eagerPipes: Set<string>, |
| 1195 | rawDeferred: DeferBlockScopes, |
| 1196 | private conflictingHostDirectiveBindings: Map< |
| 1197 | DirectiveOwner, |
| 1198 | ConflictingHostDirectiveBinding<DirectiveT>[] |
| 1199 | >, |
| 1200 | ) { |
| 1201 | this.deferredBlocks = rawDeferred.map((current) => current[0]); |
| 1202 | this.deferredScopes = new Map(rawDeferred); |
| 1203 | } |
| 1204 | |
| 1205 | getEntitiesInScope(node: ScopedNode | null): ReadonlySet<TemplateEntity> { |
| 1206 | return this.scopedNodeEntities.get(node) ?? new Set(); |
| 1207 | } |
| 1208 | |
| 1209 | getDirectivesOfNode(node: DirectiveOwner): DirectiveT[] | null { |
| 1210 | return this.directives.get(node) || null; |
| 1211 | } |
| 1212 | |
| 1213 | getReferenceTarget(ref: Reference): ReferenceTarget<DirectiveT> | null { |
| 1214 | return this.references.get(ref) || null; |
| 1215 | } |
| 1216 | |
| 1217 | getConsumerOfBinding( |
| 1218 | binding: BoundAttribute | BoundEvent | TextAttribute, |
| 1219 | ): DirectiveT | Element | Template | null { |
| 1220 | return this.bindings.get(binding) || null; |
| 1221 | } |
| 1222 | |
| 1223 | getExpressionTarget(expr: AST): TemplateEntity | null { |
| 1224 | return this.exprTargets.get(expr) || null; |
| 1225 | } |
| 1226 | |
| 1227 | getDefinitionNodeOfSymbol(symbol: TemplateEntity): ScopedNode | null { |
| 1228 | return this.symbols.get(symbol) || null; |
| 1229 | } |
| 1230 | |
| 1231 | getNestingLevel(node: ScopedNode): number { |
| 1232 | return this.nestingLevel.get(node) || 0; |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…