1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | (function (factory) {
|
---|
9 | if (typeof module === "object" && typeof module.exports === "object") {
|
---|
10 | var v = factory(require, exports);
|
---|
11 | if (v !== undefined) module.exports = v;
|
---|
12 | }
|
---|
13 | else if (typeof define === "function" && define.amd) {
|
---|
14 | define("@angular/compiler/src/render3/view/t2_binder", ["require", "exports", "tslib", "@angular/compiler/src/expression_parser/ast", "@angular/compiler/src/render3/r3_ast", "@angular/compiler/src/render3/view/template", "@angular/compiler/src/render3/view/util"], factory);
|
---|
15 | }
|
---|
16 | })(function (require, exports) {
|
---|
17 | "use strict";
|
---|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
19 | exports.R3BoundTarget = exports.R3TargetBinder = void 0;
|
---|
20 | var tslib_1 = require("tslib");
|
---|
21 | var ast_1 = require("@angular/compiler/src/expression_parser/ast");
|
---|
22 | var r3_ast_1 = require("@angular/compiler/src/render3/r3_ast");
|
---|
23 | var template_1 = require("@angular/compiler/src/render3/view/template");
|
---|
24 | var util_1 = require("@angular/compiler/src/render3/view/util");
|
---|
25 | /**
|
---|
26 | * Processes `Target`s with a given set of directives and performs a binding operation, which
|
---|
27 | * returns an object similar to TypeScript's `ts.TypeChecker` that contains knowledge about the
|
---|
28 | * target.
|
---|
29 | */
|
---|
30 | var R3TargetBinder = /** @class */ (function () {
|
---|
31 | function R3TargetBinder(directiveMatcher) {
|
---|
32 | this.directiveMatcher = directiveMatcher;
|
---|
33 | }
|
---|
34 | /**
|
---|
35 | * Perform a binding operation on the given `Target` and return a `BoundTarget` which contains
|
---|
36 | * metadata about the types referenced in the template.
|
---|
37 | */
|
---|
38 | R3TargetBinder.prototype.bind = function (target) {
|
---|
39 | if (!target.template) {
|
---|
40 | // TODO(alxhub): handle targets which contain things like HostBindings, etc.
|
---|
41 | throw new Error('Binding without a template not yet supported');
|
---|
42 | }
|
---|
43 | // First, parse the template into a `Scope` structure. This operation captures the syntactic
|
---|
44 | // scopes in the template and makes them available for later use.
|
---|
45 | var scope = Scope.apply(target.template);
|
---|
46 | // Use the `Scope` to extract the entities present at every level of the template.
|
---|
47 | var templateEntities = extractTemplateEntities(scope);
|
---|
48 | // Next, perform directive matching on the template using the `DirectiveBinder`. This returns:
|
---|
49 | // - directives: Map of nodes (elements & ng-templates) to the directives on them.
|
---|
50 | // - bindings: Map of inputs, outputs, and attributes to the directive/element that claims
|
---|
51 | // them. TODO(alxhub): handle multiple directives claiming an input/output/etc.
|
---|
52 | // - references: Map of #references to their targets.
|
---|
53 | var _a = DirectiveBinder.apply(target.template, this.directiveMatcher), directives = _a.directives, bindings = _a.bindings, references = _a.references;
|
---|
54 | // Finally, run the TemplateBinder to bind references, variables, and other entities within the
|
---|
55 | // template. This extracts all the metadata that doesn't depend on directive matching.
|
---|
56 | var _b = TemplateBinder.applyWithScope(target.template, scope), expressions = _b.expressions, symbols = _b.symbols, nestingLevel = _b.nestingLevel, usedPipes = _b.usedPipes;
|
---|
57 | return new R3BoundTarget(target, directives, bindings, references, expressions, symbols, nestingLevel, templateEntities, usedPipes);
|
---|
58 | };
|
---|
59 | return R3TargetBinder;
|
---|
60 | }());
|
---|
61 | exports.R3TargetBinder = R3TargetBinder;
|
---|
62 | /**
|
---|
63 | * Represents a binding scope within a template.
|
---|
64 | *
|
---|
65 | * Any variables, references, or other named entities declared within the template will
|
---|
66 | * be captured and available by name in `namedEntities`. Additionally, child templates will
|
---|
67 | * be analyzed and have their child `Scope`s available in `childScopes`.
|
---|
68 | */
|
---|
69 | var Scope = /** @class */ (function () {
|
---|
70 | function Scope(parentScope, template) {
|
---|
71 | this.parentScope = parentScope;
|
---|
72 | this.template = template;
|
---|
73 | /**
|
---|
74 | * Named members of the `Scope`, such as `Reference`s or `Variable`s.
|
---|
75 | */
|
---|
76 | this.namedEntities = new Map();
|
---|
77 | /**
|
---|
78 | * Child `Scope`s for immediately nested `Template`s.
|
---|
79 | */
|
---|
80 | this.childScopes = new Map();
|
---|
81 | }
|
---|
82 | Scope.newRootScope = function () {
|
---|
83 | return new Scope(null, null);
|
---|
84 | };
|
---|
85 | /**
|
---|
86 | * Process a template (either as a `Template` sub-template with variables, or a plain array of
|
---|
87 | * template `Node`s) and construct its `Scope`.
|
---|
88 | */
|
---|
89 | Scope.apply = function (template) {
|
---|
90 | var scope = Scope.newRootScope();
|
---|
91 | scope.ingest(template);
|
---|
92 | return scope;
|
---|
93 | };
|
---|
94 | /**
|
---|
95 | * Internal method to process the template and populate the `Scope`.
|
---|
96 | */
|
---|
97 | Scope.prototype.ingest = function (template) {
|
---|
98 | var _this = this;
|
---|
99 | if (template instanceof r3_ast_1.Template) {
|
---|
100 | // Variables on an <ng-template> are defined in the inner scope.
|
---|
101 | template.variables.forEach(function (node) { return _this.visitVariable(node); });
|
---|
102 | // Process the nodes of the template.
|
---|
103 | template.children.forEach(function (node) { return node.visit(_this); });
|
---|
104 | }
|
---|
105 | else {
|
---|
106 | // No overarching `Template` instance, so process the nodes directly.
|
---|
107 | template.forEach(function (node) { return node.visit(_this); });
|
---|
108 | }
|
---|
109 | };
|
---|
110 | Scope.prototype.visitElement = function (element) {
|
---|
111 | var _this = this;
|
---|
112 | // `Element`s in the template may have `Reference`s which are captured in the scope.
|
---|
113 | element.references.forEach(function (node) { return _this.visitReference(node); });
|
---|
114 | // Recurse into the `Element`'s children.
|
---|
115 | element.children.forEach(function (node) { return node.visit(_this); });
|
---|
116 | };
|
---|
117 | Scope.prototype.visitTemplate = function (template) {
|
---|
118 | var _this = this;
|
---|
119 | // References on a <ng-template> are defined in the outer scope, so capture them before
|
---|
120 | // processing the template's child scope.
|
---|
121 | template.references.forEach(function (node) { return _this.visitReference(node); });
|
---|
122 | // Next, create an inner scope and process the template within it.
|
---|
123 | var scope = new Scope(this, template);
|
---|
124 | scope.ingest(template);
|
---|
125 | this.childScopes.set(template, scope);
|
---|
126 | };
|
---|
127 | Scope.prototype.visitVariable = function (variable) {
|
---|
128 | // Declare the variable if it's not already.
|
---|
129 | this.maybeDeclare(variable);
|
---|
130 | };
|
---|
131 | Scope.prototype.visitReference = function (reference) {
|
---|
132 | // Declare the variable if it's not already.
|
---|
133 | this.maybeDeclare(reference);
|
---|
134 | };
|
---|
135 | // Unused visitors.
|
---|
136 | Scope.prototype.visitContent = function (content) { };
|
---|
137 | Scope.prototype.visitBoundAttribute = function (attr) { };
|
---|
138 | Scope.prototype.visitBoundEvent = function (event) { };
|
---|
139 | Scope.prototype.visitBoundText = function (text) { };
|
---|
140 | Scope.prototype.visitText = function (text) { };
|
---|
141 | Scope.prototype.visitTextAttribute = function (attr) { };
|
---|
142 | Scope.prototype.visitIcu = function (icu) { };
|
---|
143 | Scope.prototype.maybeDeclare = function (thing) {
|
---|
144 | // Declare something with a name, as long as that name isn't taken.
|
---|
145 | if (!this.namedEntities.has(thing.name)) {
|
---|
146 | this.namedEntities.set(thing.name, thing);
|
---|
147 | }
|
---|
148 | };
|
---|
149 | /**
|
---|
150 | * Look up a variable within this `Scope`.
|
---|
151 | *
|
---|
152 | * This can recurse into a parent `Scope` if it's available.
|
---|
153 | */
|
---|
154 | Scope.prototype.lookup = function (name) {
|
---|
155 | if (this.namedEntities.has(name)) {
|
---|
156 | // Found in the local scope.
|
---|
157 | return this.namedEntities.get(name);
|
---|
158 | }
|
---|
159 | else if (this.parentScope !== null) {
|
---|
160 | // Not in the local scope, but there's a parent scope so check there.
|
---|
161 | return this.parentScope.lookup(name);
|
---|
162 | }
|
---|
163 | else {
|
---|
164 | // At the top level and it wasn't found.
|
---|
165 | return null;
|
---|
166 | }
|
---|
167 | };
|
---|
168 | /**
|
---|
169 | * Get the child scope for a `Template`.
|
---|
170 | *
|
---|
171 | * This should always be defined.
|
---|
172 | */
|
---|
173 | Scope.prototype.getChildScope = function (template) {
|
---|
174 | var res = this.childScopes.get(template);
|
---|
175 | if (res === undefined) {
|
---|
176 | throw new Error("Assertion error: child scope for " + template + " not found");
|
---|
177 | }
|
---|
178 | return res;
|
---|
179 | };
|
---|
180 | return Scope;
|
---|
181 | }());
|
---|
182 | /**
|
---|
183 | * Processes a template and matches directives on nodes (elements and templates).
|
---|
184 | *
|
---|
185 | * Usually used via the static `apply()` method.
|
---|
186 | */
|
---|
187 | var DirectiveBinder = /** @class */ (function () {
|
---|
188 | function DirectiveBinder(matcher, directives, bindings, references) {
|
---|
189 | this.matcher = matcher;
|
---|
190 | this.directives = directives;
|
---|
191 | this.bindings = bindings;
|
---|
192 | this.references = references;
|
---|
193 | }
|
---|
194 | /**
|
---|
195 | * Process a template (list of `Node`s) and perform directive matching against each node.
|
---|
196 | *
|
---|
197 | * @param template the list of template `Node`s to match (recursively).
|
---|
198 | * @param selectorMatcher a `SelectorMatcher` containing the directives that are in scope for
|
---|
199 | * this template.
|
---|
200 | * @returns three maps which contain information about directives in the template: the
|
---|
201 | * `directives` map which lists directives matched on each node, the `bindings` map which
|
---|
202 | * indicates which directives claimed which bindings (inputs, outputs, etc), and the `references`
|
---|
203 | * map which resolves #references (`Reference`s) within the template to the named directive or
|
---|
204 | * template node.
|
---|
205 | */
|
---|
206 | DirectiveBinder.apply = function (template, selectorMatcher) {
|
---|
207 | var directives = new Map();
|
---|
208 | var bindings = new Map();
|
---|
209 | var references = new Map();
|
---|
210 | var matcher = new DirectiveBinder(selectorMatcher, directives, bindings, references);
|
---|
211 | matcher.ingest(template);
|
---|
212 | return { directives: directives, bindings: bindings, references: references };
|
---|
213 | };
|
---|
214 | DirectiveBinder.prototype.ingest = function (template) {
|
---|
215 | var _this = this;
|
---|
216 | template.forEach(function (node) { return node.visit(_this); });
|
---|
217 | };
|
---|
218 | DirectiveBinder.prototype.visitElement = function (element) {
|
---|
219 | this.visitElementOrTemplate(element.name, element);
|
---|
220 | };
|
---|
221 | DirectiveBinder.prototype.visitTemplate = function (template) {
|
---|
222 | this.visitElementOrTemplate('ng-template', template);
|
---|
223 | };
|
---|
224 | DirectiveBinder.prototype.visitElementOrTemplate = function (elementName, node) {
|
---|
225 | var _this = this;
|
---|
226 | // First, determine the HTML shape of the node for the purpose of directive matching.
|
---|
227 | // Do this by building up a `CssSelector` for the node.
|
---|
228 | var cssSelector = template_1.createCssSelector(elementName, util_1.getAttrsForDirectiveMatching(node));
|
---|
229 | // Next, use the `SelectorMatcher` to get the list of directives on the node.
|
---|
230 | var directives = [];
|
---|
231 | this.matcher.match(cssSelector, function (_, directive) { return directives.push(directive); });
|
---|
232 | if (directives.length > 0) {
|
---|
233 | this.directives.set(node, directives);
|
---|
234 | }
|
---|
235 | // Resolve any references that are created on this node.
|
---|
236 | node.references.forEach(function (ref) {
|
---|
237 | var dirTarget = null;
|
---|
238 | // If the reference expression is empty, then it matches the "primary" directive on the node
|
---|
239 | // (if there is one). Otherwise it matches the host node itself (either an element or
|
---|
240 | // <ng-template> node).
|
---|
241 | if (ref.value.trim() === '') {
|
---|
242 | // This could be a reference to a component if there is one.
|
---|
243 | dirTarget = directives.find(function (dir) { return dir.isComponent; }) || null;
|
---|
244 | }
|
---|
245 | else {
|
---|
246 | // This should be a reference to a directive exported via exportAs.
|
---|
247 | dirTarget =
|
---|
248 | directives.find(function (dir) { return dir.exportAs !== null && dir.exportAs.some(function (value) { return value === ref.value; }); }) ||
|
---|
249 | null;
|
---|
250 | // Check if a matching directive was found.
|
---|
251 | if (dirTarget === null) {
|
---|
252 | // No matching directive was found - this reference points to an unknown target. Leave it
|
---|
253 | // unmapped.
|
---|
254 | return;
|
---|
255 | }
|
---|
256 | }
|
---|
257 | if (dirTarget !== null) {
|
---|
258 | // This reference points to a directive.
|
---|
259 | _this.references.set(ref, { directive: dirTarget, node: node });
|
---|
260 | }
|
---|
261 | else {
|
---|
262 | // This reference points to the node itself.
|
---|
263 | _this.references.set(ref, node);
|
---|
264 | }
|
---|
265 | });
|
---|
266 | var setAttributeBinding = function (attribute, ioType) {
|
---|
267 | var dir = directives.find(function (dir) { return dir[ioType].hasBindingPropertyName(attribute.name); });
|
---|
268 | var binding = dir !== undefined ? dir : node;
|
---|
269 | _this.bindings.set(attribute, binding);
|
---|
270 | };
|
---|
271 | // Node inputs (bound attributes) and text attributes can be bound to an
|
---|
272 | // input on a directive.
|
---|
273 | node.inputs.forEach(function (input) { return setAttributeBinding(input, 'inputs'); });
|
---|
274 | node.attributes.forEach(function (attr) { return setAttributeBinding(attr, 'inputs'); });
|
---|
275 | if (node instanceof r3_ast_1.Template) {
|
---|
276 | node.templateAttrs.forEach(function (attr) { return setAttributeBinding(attr, 'inputs'); });
|
---|
277 | }
|
---|
278 | // Node outputs (bound events) can be bound to an output on a directive.
|
---|
279 | node.outputs.forEach(function (output) { return setAttributeBinding(output, 'outputs'); });
|
---|
280 | // Recurse into the node's children.
|
---|
281 | node.children.forEach(function (child) { return child.visit(_this); });
|
---|
282 | };
|
---|
283 | // Unused visitors.
|
---|
284 | DirectiveBinder.prototype.visitContent = function (content) { };
|
---|
285 | DirectiveBinder.prototype.visitVariable = function (variable) { };
|
---|
286 | DirectiveBinder.prototype.visitReference = function (reference) { };
|
---|
287 | DirectiveBinder.prototype.visitTextAttribute = function (attribute) { };
|
---|
288 | DirectiveBinder.prototype.visitBoundAttribute = function (attribute) { };
|
---|
289 | DirectiveBinder.prototype.visitBoundEvent = function (attribute) { };
|
---|
290 | DirectiveBinder.prototype.visitBoundAttributeOrEvent = function (node) { };
|
---|
291 | DirectiveBinder.prototype.visitText = function (text) { };
|
---|
292 | DirectiveBinder.prototype.visitBoundText = function (text) { };
|
---|
293 | DirectiveBinder.prototype.visitIcu = function (icu) { };
|
---|
294 | return DirectiveBinder;
|
---|
295 | }());
|
---|
296 | /**
|
---|
297 | * Processes a template and extract metadata about expressions and symbols within.
|
---|
298 | *
|
---|
299 | * This is a companion to the `DirectiveBinder` that doesn't require knowledge of directives matched
|
---|
300 | * within the template in order to operate.
|
---|
301 | *
|
---|
302 | * Expressions are visited by the superclass `RecursiveAstVisitor`, with custom logic provided
|
---|
303 | * by overridden methods from that visitor.
|
---|
304 | */
|
---|
305 | var TemplateBinder = /** @class */ (function (_super) {
|
---|
306 | tslib_1.__extends(TemplateBinder, _super);
|
---|
307 | function TemplateBinder(bindings, symbols, usedPipes, nestingLevel, scope, template, level) {
|
---|
308 | var _this = _super.call(this) || this;
|
---|
309 | _this.bindings = bindings;
|
---|
310 | _this.symbols = symbols;
|
---|
311 | _this.usedPipes = usedPipes;
|
---|
312 | _this.nestingLevel = nestingLevel;
|
---|
313 | _this.scope = scope;
|
---|
314 | _this.template = template;
|
---|
315 | _this.level = level;
|
---|
316 | _this.pipesUsed = [];
|
---|
317 | // Save a bit of processing time by constructing this closure in advance.
|
---|
318 | _this.visitNode = function (node) { return node.visit(_this); };
|
---|
319 | return _this;
|
---|
320 | }
|
---|
321 | // This method is defined to reconcile the type of TemplateBinder since both
|
---|
322 | // RecursiveAstVisitor and Visitor define the visit() method in their
|
---|
323 | // interfaces.
|
---|
324 | TemplateBinder.prototype.visit = function (node, context) {
|
---|
325 | if (node instanceof ast_1.AST) {
|
---|
326 | node.visit(this, context);
|
---|
327 | }
|
---|
328 | else {
|
---|
329 | node.visit(this);
|
---|
330 | }
|
---|
331 | };
|
---|
332 | /**
|
---|
333 | * Process a template and extract metadata about expressions and symbols within.
|
---|
334 | *
|
---|
335 | * @param template the nodes of the template to process
|
---|
336 | * @param scope the `Scope` of the template being processed.
|
---|
337 | * @returns three maps which contain metadata about the template: `expressions` which interprets
|
---|
338 | * special `AST` nodes in expressions as pointing to references or variables declared within the
|
---|
339 | * template, `symbols` which maps those variables and references to the nested `Template` which
|
---|
340 | * declares them, if any, and `nestingLevel` which associates each `Template` with a integer
|
---|
341 | * nesting level (how many levels deep within the template structure the `Template` is), starting
|
---|
342 | * at 1.
|
---|
343 | */
|
---|
344 | TemplateBinder.applyWithScope = function (template, scope) {
|
---|
345 | var expressions = new Map();
|
---|
346 | var symbols = new Map();
|
---|
347 | var nestingLevel = new Map();
|
---|
348 | var usedPipes = new Set();
|
---|
349 | // The top-level template has nesting level 0.
|
---|
350 | var binder = new TemplateBinder(expressions, symbols, usedPipes, nestingLevel, scope, template instanceof r3_ast_1.Template ? template : null, 0);
|
---|
351 | binder.ingest(template);
|
---|
352 | return { expressions: expressions, symbols: symbols, nestingLevel: nestingLevel, usedPipes: usedPipes };
|
---|
353 | };
|
---|
354 | TemplateBinder.prototype.ingest = function (template) {
|
---|
355 | if (template instanceof r3_ast_1.Template) {
|
---|
356 | // For <ng-template>s, process only variables and child nodes. Inputs, outputs, templateAttrs,
|
---|
357 | // and references were all processed in the scope of the containing template.
|
---|
358 | template.variables.forEach(this.visitNode);
|
---|
359 | template.children.forEach(this.visitNode);
|
---|
360 | // Set the nesting level.
|
---|
361 | this.nestingLevel.set(template, this.level);
|
---|
362 | }
|
---|
363 | else {
|
---|
364 | // Visit each node from the top-level template.
|
---|
365 | template.forEach(this.visitNode);
|
---|
366 | }
|
---|
367 | };
|
---|
368 | TemplateBinder.prototype.visitElement = function (element) {
|
---|
369 | // Visit the inputs, outputs, and children of the element.
|
---|
370 | element.inputs.forEach(this.visitNode);
|
---|
371 | element.outputs.forEach(this.visitNode);
|
---|
372 | element.children.forEach(this.visitNode);
|
---|
373 | };
|
---|
374 | TemplateBinder.prototype.visitTemplate = function (template) {
|
---|
375 | // First, visit inputs, outputs and template attributes of the template node.
|
---|
376 | template.inputs.forEach(this.visitNode);
|
---|
377 | template.outputs.forEach(this.visitNode);
|
---|
378 | template.templateAttrs.forEach(this.visitNode);
|
---|
379 | // References are also evaluated in the outer context.
|
---|
380 | template.references.forEach(this.visitNode);
|
---|
381 | // Next, recurse into the template using its scope, and bumping the nesting level up by one.
|
---|
382 | var childScope = this.scope.getChildScope(template);
|
---|
383 | var binder = new TemplateBinder(this.bindings, this.symbols, this.usedPipes, this.nestingLevel, childScope, template, this.level + 1);
|
---|
384 | binder.ingest(template);
|
---|
385 | };
|
---|
386 | TemplateBinder.prototype.visitVariable = function (variable) {
|
---|
387 | // Register the `Variable` as a symbol in the current `Template`.
|
---|
388 | if (this.template !== null) {
|
---|
389 | this.symbols.set(variable, this.template);
|
---|
390 | }
|
---|
391 | };
|
---|
392 | TemplateBinder.prototype.visitReference = function (reference) {
|
---|
393 | // Register the `Reference` as a symbol in the current `Template`.
|
---|
394 | if (this.template !== null) {
|
---|
395 | this.symbols.set(reference, this.template);
|
---|
396 | }
|
---|
397 | };
|
---|
398 | // Unused template visitors
|
---|
399 | TemplateBinder.prototype.visitText = function (text) { };
|
---|
400 | TemplateBinder.prototype.visitContent = function (content) { };
|
---|
401 | TemplateBinder.prototype.visitTextAttribute = function (attribute) { };
|
---|
402 | TemplateBinder.prototype.visitIcu = function (icu) {
|
---|
403 | var _this = this;
|
---|
404 | Object.keys(icu.vars).forEach(function (key) { return icu.vars[key].visit(_this); });
|
---|
405 | Object.keys(icu.placeholders).forEach(function (key) { return icu.placeholders[key].visit(_this); });
|
---|
406 | };
|
---|
407 | // The remaining visitors are concerned with processing AST expressions within template bindings
|
---|
408 | TemplateBinder.prototype.visitBoundAttribute = function (attribute) {
|
---|
409 | attribute.value.visit(this);
|
---|
410 | };
|
---|
411 | TemplateBinder.prototype.visitBoundEvent = function (event) {
|
---|
412 | event.handler.visit(this);
|
---|
413 | };
|
---|
414 | TemplateBinder.prototype.visitBoundText = function (text) {
|
---|
415 | text.value.visit(this);
|
---|
416 | };
|
---|
417 | TemplateBinder.prototype.visitPipe = function (ast, context) {
|
---|
418 | this.usedPipes.add(ast.name);
|
---|
419 | return _super.prototype.visitPipe.call(this, ast, context);
|
---|
420 | };
|
---|
421 | // These five types of AST expressions can refer to expression roots, which could be variables
|
---|
422 | // or references in the current scope.
|
---|
423 | TemplateBinder.prototype.visitPropertyRead = function (ast, context) {
|
---|
424 | this.maybeMap(context, ast, ast.name);
|
---|
425 | return _super.prototype.visitPropertyRead.call(this, ast, context);
|
---|
426 | };
|
---|
427 | TemplateBinder.prototype.visitSafePropertyRead = function (ast, context) {
|
---|
428 | this.maybeMap(context, ast, ast.name);
|
---|
429 | return _super.prototype.visitSafePropertyRead.call(this, ast, context);
|
---|
430 | };
|
---|
431 | TemplateBinder.prototype.visitPropertyWrite = function (ast, context) {
|
---|
432 | this.maybeMap(context, ast, ast.name);
|
---|
433 | return _super.prototype.visitPropertyWrite.call(this, ast, context);
|
---|
434 | };
|
---|
435 | TemplateBinder.prototype.visitMethodCall = function (ast, context) {
|
---|
436 | this.maybeMap(context, ast, ast.name);
|
---|
437 | return _super.prototype.visitMethodCall.call(this, ast, context);
|
---|
438 | };
|
---|
439 | TemplateBinder.prototype.visitSafeMethodCall = function (ast, context) {
|
---|
440 | this.maybeMap(context, ast, ast.name);
|
---|
441 | return _super.prototype.visitSafeMethodCall.call(this, ast, context);
|
---|
442 | };
|
---|
443 | TemplateBinder.prototype.maybeMap = function (scope, ast, name) {
|
---|
444 | // If the receiver of the expression isn't the `ImplicitReceiver`, this isn't the root of an
|
---|
445 | // `AST` expression that maps to a `Variable` or `Reference`.
|
---|
446 | if (!(ast.receiver instanceof ast_1.ImplicitReceiver)) {
|
---|
447 | return;
|
---|
448 | }
|
---|
449 | // Check whether the name exists in the current scope. If so, map it. Otherwise, the name is
|
---|
450 | // probably a property on the top-level component context.
|
---|
451 | var target = this.scope.lookup(name);
|
---|
452 | if (target !== null) {
|
---|
453 | this.bindings.set(ast, target);
|
---|
454 | }
|
---|
455 | };
|
---|
456 | return TemplateBinder;
|
---|
457 | }(ast_1.RecursiveAstVisitor));
|
---|
458 | /**
|
---|
459 | * Metadata container for a `Target` that allows queries for specific bits of metadata.
|
---|
460 | *
|
---|
461 | * See `BoundTarget` for documentation on the individual methods.
|
---|
462 | */
|
---|
463 | var R3BoundTarget = /** @class */ (function () {
|
---|
464 | function R3BoundTarget(target, directives, bindings, references, exprTargets, symbols, nestingLevel, templateEntities, usedPipes) {
|
---|
465 | this.target = target;
|
---|
466 | this.directives = directives;
|
---|
467 | this.bindings = bindings;
|
---|
468 | this.references = references;
|
---|
469 | this.exprTargets = exprTargets;
|
---|
470 | this.symbols = symbols;
|
---|
471 | this.nestingLevel = nestingLevel;
|
---|
472 | this.templateEntities = templateEntities;
|
---|
473 | this.usedPipes = usedPipes;
|
---|
474 | }
|
---|
475 | R3BoundTarget.prototype.getEntitiesInTemplateScope = function (template) {
|
---|
476 | var _a;
|
---|
477 | return (_a = this.templateEntities.get(template)) !== null && _a !== void 0 ? _a : new Set();
|
---|
478 | };
|
---|
479 | R3BoundTarget.prototype.getDirectivesOfNode = function (node) {
|
---|
480 | return this.directives.get(node) || null;
|
---|
481 | };
|
---|
482 | R3BoundTarget.prototype.getReferenceTarget = function (ref) {
|
---|
483 | return this.references.get(ref) || null;
|
---|
484 | };
|
---|
485 | R3BoundTarget.prototype.getConsumerOfBinding = function (binding) {
|
---|
486 | return this.bindings.get(binding) || null;
|
---|
487 | };
|
---|
488 | R3BoundTarget.prototype.getExpressionTarget = function (expr) {
|
---|
489 | return this.exprTargets.get(expr) || null;
|
---|
490 | };
|
---|
491 | R3BoundTarget.prototype.getTemplateOfSymbol = function (symbol) {
|
---|
492 | return this.symbols.get(symbol) || null;
|
---|
493 | };
|
---|
494 | R3BoundTarget.prototype.getNestingLevel = function (template) {
|
---|
495 | return this.nestingLevel.get(template) || 0;
|
---|
496 | };
|
---|
497 | R3BoundTarget.prototype.getUsedDirectives = function () {
|
---|
498 | var set = new Set();
|
---|
499 | this.directives.forEach(function (dirs) { return dirs.forEach(function (dir) { return set.add(dir); }); });
|
---|
500 | return Array.from(set.values());
|
---|
501 | };
|
---|
502 | R3BoundTarget.prototype.getUsedPipes = function () {
|
---|
503 | return Array.from(this.usedPipes);
|
---|
504 | };
|
---|
505 | return R3BoundTarget;
|
---|
506 | }());
|
---|
507 | exports.R3BoundTarget = R3BoundTarget;
|
---|
508 | function extractTemplateEntities(rootScope) {
|
---|
509 | var e_1, _a, e_2, _b;
|
---|
510 | var entityMap = new Map();
|
---|
511 | function extractScopeEntities(scope) {
|
---|
512 | if (entityMap.has(scope.template)) {
|
---|
513 | return entityMap.get(scope.template);
|
---|
514 | }
|
---|
515 | var currentEntities = scope.namedEntities;
|
---|
516 | var templateEntities;
|
---|
517 | if (scope.parentScope !== null) {
|
---|
518 | templateEntities = new Map(tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(extractScopeEntities(scope.parentScope))), tslib_1.__read(currentEntities)));
|
---|
519 | }
|
---|
520 | else {
|
---|
521 | templateEntities = new Map(currentEntities);
|
---|
522 | }
|
---|
523 | entityMap.set(scope.template, templateEntities);
|
---|
524 | return templateEntities;
|
---|
525 | }
|
---|
526 | var scopesToProcess = [rootScope];
|
---|
527 | while (scopesToProcess.length > 0) {
|
---|
528 | var scope = scopesToProcess.pop();
|
---|
529 | try {
|
---|
530 | for (var _c = (e_1 = void 0, tslib_1.__values(scope.childScopes.values())), _d = _c.next(); !_d.done; _d = _c.next()) {
|
---|
531 | var childScope = _d.value;
|
---|
532 | scopesToProcess.push(childScope);
|
---|
533 | }
|
---|
534 | }
|
---|
535 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
---|
536 | finally {
|
---|
537 | try {
|
---|
538 | if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
---|
539 | }
|
---|
540 | finally { if (e_1) throw e_1.error; }
|
---|
541 | }
|
---|
542 | extractScopeEntities(scope);
|
---|
543 | }
|
---|
544 | var templateEntities = new Map();
|
---|
545 | try {
|
---|
546 | for (var entityMap_1 = tslib_1.__values(entityMap), entityMap_1_1 = entityMap_1.next(); !entityMap_1_1.done; entityMap_1_1 = entityMap_1.next()) {
|
---|
547 | var _e = tslib_1.__read(entityMap_1_1.value, 2), template = _e[0], entities = _e[1];
|
---|
548 | templateEntities.set(template, new Set(entities.values()));
|
---|
549 | }
|
---|
550 | }
|
---|
551 | catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
---|
552 | finally {
|
---|
553 | try {
|
---|
554 | if (entityMap_1_1 && !entityMap_1_1.done && (_b = entityMap_1.return)) _b.call(entityMap_1);
|
---|
555 | }
|
---|
556 | finally { if (e_2) throw e_2.error; }
|
---|
557 | }
|
---|
558 | return templateEntities;
|
---|
559 | }
|
---|
560 | });
|
---|
561 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidDJfYmluZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZXIvc3JjL3JlbmRlcjMvdmlldy90Ml9iaW5kZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOzs7Ozs7Ozs7Ozs7OztJQUVILG1FQUErSztJQUUvSywrREFBMEo7SUFHMUosd0VBQTZDO0lBQzdDLGdFQUFvRDtJQUdwRDs7OztPQUlHO0lBQ0g7UUFDRSx3QkFBb0IsZ0JBQTZDO1lBQTdDLHFCQUFnQixHQUFoQixnQkFBZ0IsQ0FBNkI7UUFBRyxDQUFDO1FBRXJFOzs7V0FHRztRQUNILDZCQUFJLEdBQUosVUFBSyxNQUFjO1lBQ2pCLElBQUksQ0FBQyxNQUFNLENBQUMsUUFBUSxFQUFFO2dCQUNwQiw0RUFBNEU7Z0JBQzVFLE1BQU0sSUFBSSxLQUFLLENBQUMsOENBQThDLENBQUMsQ0FBQzthQUNqRTtZQUVELDRGQUE0RjtZQUM1RixpRUFBaUU7WUFDakUsSUFBTSxLQUFLLEdBQUcsS0FBSyxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsUUFBUSxDQUFDLENBQUM7WUFHM0Msa0ZBQWtGO1lBQ2xGLElBQU0sZ0JBQWdCLEdBQUcsdUJBQXVCLENBQUMsS0FBSyxDQUFDLENBQUM7WUFFeEQsOEZBQThGO1lBQzlGLG9GQUFvRjtZQUNwRiw0RkFBNEY7WUFDNUYsbUZBQW1GO1lBQ25GLHVEQUF1RDtZQUNqRCxJQUFBLEtBQ0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