MCPcopy Create free account
hub / github.com/angular/angular / R3BoundTarget

Class R3BoundTarget

packages/compiler/src/render3/view/t2_binder.ts:1218–1437  ·  view source on GitHub ↗

* Metadata container for a `Target` that allows queries for specific bits of metadata. * * See `BoundTarget` for documentation on the individual methods.

Source from the content-addressed store, hash-verified

1216 * See `BoundTarget` for documentation on the individual methods.
1217 */
1218class R3BoundTarget<DirectiveT extends DirectiveMeta> implements BoundTarget<DirectiveT> {
1219 /** Deferred blocks, ordered as they appear in the template. */
1220 private deferredBlocks: DeferredBlock[];
1221
1222 /** Map of deferred blocks to their scope. */
1223 private deferredScopes: Map<DeferredBlock, Scope>;
1224
1225 constructor(
1226 readonly target: Target<DirectiveT>,
1227 private directives: MatchedDirectives<DirectiveT>,
1228 private foreignComponents: Map<Element, ForeignComponentMeta>,
1229 private eagerDirectives: DirectiveT[],
1230 private missingDirectives: Set<string>,
1231 private bindings: BindingsMap<DirectiveT>,
1232 private references: ReferenceMap<DirectiveT>,
1233 private exprTargets: Map<AST, TemplateEntity>,
1234 private symbols: Map<TemplateEntity, Template>,
1235 private nestingLevel: Map<ScopedNode, number>,
1236 private scopedNodeEntities: ScopedNodeEntities,
1237 private usedPipes: Set<string>,
1238 private eagerPipes: Set<string>,
1239 rawDeferred: DeferBlockScopes,
1240 private conflictingHostDirectiveBindings: Map<
1241 DirectiveOwner,
1242 ConflictingHostDirectiveBinding<DirectiveT>[]
1243 >,
1244 ) {
1245 this.deferredBlocks = rawDeferred.map((current) => current[0]);
1246 this.deferredScopes = new Map(rawDeferred);
1247 }
1248
1249 getEntitiesInScope(node: ScopedNode | null): ReadonlySet<TemplateEntity> {
1250 return this.scopedNodeEntities.get(node) ?? new Set();
1251 }
1252
1253 getDirectivesOfNode(node: DirectiveOwner): DirectiveT[] | null {
1254 return this.directives.get(node) || null;
1255 }
1256
1257 getForeignComponent(element: Element): ForeignComponentMeta | null {
1258 return this.foreignComponents.get(element) || null;
1259 }
1260
1261 getReferenceTarget(ref: Reference): ReferenceTarget<DirectiveT> | null {
1262 return this.references.get(ref) || null;
1263 }
1264
1265 getConsumerOfBinding(
1266 binding: BoundAttribute | BoundEvent | TextAttribute,
1267 ): DirectiveT | Element | Template | null {
1268 return this.bindings.get(binding) || null;
1269 }
1270
1271 getExpressionTarget(expr: AST): TemplateEntity | null {
1272 return this.exprTargets.get(expr) || null;
1273 }
1274
1275 getDefinitionNodeOfSymbol(symbol: TemplateEntity): ScopedNode | null {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected