| 82 | * If a `TcbOp` requires the output of another, it can call `resolve()`. |
| 83 | */ |
| 84 | export class Scope { |
| 85 | /** |
| 86 | * A queue of operations which need to be performed to generate the TCB code for this scope. |
| 87 | * |
| 88 | * This array can contain either a `TcbOp` which has yet to be executed, or a `TcbExpr|null` |
| 89 | * representing the memoized result of executing the operation. As operations are executed, their |
| 90 | * results are written into the `opQueue`, overwriting the original operation. |
| 91 | * |
| 92 | * If an operation is in the process of being executed, it is temporarily overwritten here with |
| 93 | * `INFER_TYPE_FOR_CIRCULAR_OP_EXPR`. This way, if a cycle is encountered where an operation |
| 94 | * depends transitively on its own result, the inner operation will infer the least narrow type |
| 95 | * that fits instead. This has the same semantics as TypeScript itself when types are referenced |
| 96 | * circularly. |
| 97 | */ |
| 98 | private opQueue: (TcbOp | TcbExpr | null)[] = []; |
| 99 | |
| 100 | /** |
| 101 | * A map of `Element`s to the index of their `TcbElementOp` in the `opQueue` |
| 102 | */ |
| 103 | private elementOpMap = new Map<Element, number>(); |
| 104 | |
| 105 | /** |
| 106 | * A map of `HostElement`s to the index of their `TcbHostElementOp` in the `opQueue` |
| 107 | */ |
| 108 | private hostElementOpMap = new Map<HostElement, number>(); |
| 109 | |
| 110 | /** |
| 111 | * A map of `Component`s to the index of their `TcbComponentNodeOp` in the `opQueue` |
| 112 | */ |
| 113 | private componentNodeOpMap = new Map<Component, number>(); |
| 114 | |
| 115 | /** |
| 116 | * A map of maps which tracks the index of `TcbDirectiveCtorOp`s in the `opQueue` for each |
| 117 | * directive on a `Element` or `Template` node. |
| 118 | */ |
| 119 | private directiveOpMap = new Map<DirectiveOwner, Map<TcbDirectiveMetadata, number>>(); |
| 120 | |
| 121 | /** |
| 122 | * A map of `Reference`s to the index of their `TcbReferenceOp` in the `opQueue` |
| 123 | */ |
| 124 | private referenceOpMap = new Map<Reference, number>(); |
| 125 | |
| 126 | /** |
| 127 | * Map of immediately nested <ng-template>s (within this `Scope`) represented by `Template` |
| 128 | * nodes to the index of their `TcbTemplateContextOp`s in the `opQueue`. |
| 129 | */ |
| 130 | private templateCtxOpMap = new Map<Template, number>(); |
| 131 | |
| 132 | /** |
| 133 | * Map of variables declared on the template that created this `Scope` (represented by |
| 134 | * `Variable` nodes) to the index of their `TcbVariableOp`s in the `opQueue`, or to |
| 135 | * pre-resolved variable identifiers. |
| 136 | */ |
| 137 | private varMap = new Map<Variable, number | TcbExpr>(); |
| 138 | |
| 139 | /** |
| 140 | * A map of the names of `LetDeclaration`s to the index of their op in the `opQueue`. |
| 141 | * |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…