source: trip-planner-front/node_modules/@angular/compiler/src/template_parser/binding_parser.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 91.4 KB
Line 
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/template_parser/binding_parser", ["require", "exports", "tslib", "@angular/compiler/src/core", "@angular/compiler/src/expression_parser/ast", "@angular/compiler/src/ml_parser/tags", "@angular/compiler/src/parse_util", "@angular/compiler/src/selector", "@angular/compiler/src/util"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.calcPossibleSecurityContexts = exports.PipeCollector = exports.BindingParser = void 0;
20 var tslib_1 = require("tslib");
21 var core_1 = require("@angular/compiler/src/core");
22 var ast_1 = require("@angular/compiler/src/expression_parser/ast");
23 var tags_1 = require("@angular/compiler/src/ml_parser/tags");
24 var parse_util_1 = require("@angular/compiler/src/parse_util");
25 var selector_1 = require("@angular/compiler/src/selector");
26 var util_1 = require("@angular/compiler/src/util");
27 var PROPERTY_PARTS_SEPARATOR = '.';
28 var ATTRIBUTE_PREFIX = 'attr';
29 var CLASS_PREFIX = 'class';
30 var STYLE_PREFIX = 'style';
31 var TEMPLATE_ATTR_PREFIX = '*';
32 var ANIMATE_PROP_PREFIX = 'animate-';
33 /**
34 * Parses bindings in templates and in the directive host area.
35 */
36 var BindingParser = /** @class */ (function () {
37 function BindingParser(_exprParser, _interpolationConfig, _schemaRegistry, pipes, errors) {
38 this._exprParser = _exprParser;
39 this._interpolationConfig = _interpolationConfig;
40 this._schemaRegistry = _schemaRegistry;
41 this.errors = errors;
42 this.pipesByName = null;
43 this._usedPipes = new Map();
44 // When the `pipes` parameter is `null`, do not check for used pipes
45 // This is used in IVY when we might not know the available pipes at compile time
46 if (pipes) {
47 var pipesByName_1 = new Map();
48 pipes.forEach(function (pipe) { return pipesByName_1.set(pipe.name, pipe); });
49 this.pipesByName = pipesByName_1;
50 }
51 }
52 Object.defineProperty(BindingParser.prototype, "interpolationConfig", {
53 get: function () {
54 return this._interpolationConfig;
55 },
56 enumerable: false,
57 configurable: true
58 });
59 BindingParser.prototype.getUsedPipes = function () {
60 return Array.from(this._usedPipes.values());
61 };
62 BindingParser.prototype.createBoundHostProperties = function (dirMeta, sourceSpan) {
63 var _this = this;
64 if (dirMeta.hostProperties) {
65 var boundProps_1 = [];
66 Object.keys(dirMeta.hostProperties).forEach(function (propName) {
67 var expression = dirMeta.hostProperties[propName];
68 if (typeof expression === 'string') {
69 _this.parsePropertyBinding(propName, expression, true, sourceSpan, sourceSpan.start.offset, undefined, [],
70 // Use the `sourceSpan` for `keySpan`. This isn't really accurate, but neither is the
71 // sourceSpan, as it represents the sourceSpan of the host itself rather than the
72 // source of the host binding (which doesn't exist in the template). Regardless,
73 // neither of these values are used in Ivy but are only here to satisfy the function
74 // signature. This should likely be refactored in the future so that `sourceSpan`
75 // isn't being used inaccurately.
76 boundProps_1, sourceSpan);
77 }
78 else {
79 _this._reportError("Value of the host property binding \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan);
80 }
81 });
82 return boundProps_1;
83 }
84 return null;
85 };
86 BindingParser.prototype.createDirectiveHostPropertyAsts = function (dirMeta, elementSelector, sourceSpan) {
87 var _this = this;
88 var boundProps = this.createBoundHostProperties(dirMeta, sourceSpan);
89 return boundProps &&
90 boundProps.map(function (prop) { return _this.createBoundElementProperty(elementSelector, prop); });
91 };
92 BindingParser.prototype.createDirectiveHostEventAsts = function (dirMeta, sourceSpan) {
93 var _this = this;
94 if (dirMeta.hostListeners) {
95 var targetEvents_1 = [];
96 Object.keys(dirMeta.hostListeners).forEach(function (propName) {
97 var expression = dirMeta.hostListeners[propName];
98 if (typeof expression === 'string') {
99 // Use the `sourceSpan` for `keySpan` and `handlerSpan`. This isn't really accurate, but
100 // neither is the `sourceSpan`, as it represents the `sourceSpan` of the host itself
101 // rather than the source of the host binding (which doesn't exist in the template).
102 // Regardless, neither of these values are used in Ivy but are only here to satisfy the
103 // function signature. This should likely be refactored in the future so that `sourceSpan`
104 // isn't being used inaccurately.
105 _this.parseEvent(propName, expression, sourceSpan, sourceSpan, [], targetEvents_1, sourceSpan);
106 }
107 else {
108 _this._reportError("Value of the host listener \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan);
109 }
110 });
111 return targetEvents_1;
112 }
113 return null;
114 };
115 BindingParser.prototype.parseInterpolation = function (value, sourceSpan) {
116 var sourceInfo = sourceSpan.start.toString();
117 var absoluteOffset = sourceSpan.fullStart.offset;
118 try {
119 var ast = this._exprParser.parseInterpolation(value, sourceInfo, absoluteOffset, this._interpolationConfig);
120 if (ast)
121 this._reportExpressionParserErrors(ast.errors, sourceSpan);
122 this._checkPipes(ast, sourceSpan);
123 return ast;
124 }
125 catch (e) {
126 this._reportError("" + e, sourceSpan);
127 return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, absoluteOffset);
128 }
129 };
130 /**
131 * Similar to `parseInterpolation`, but treats the provided string as a single expression
132 * element that would normally appear within the interpolation prefix and suffix (`{{` and `}}`).
133 * This is used for parsing the switch expression in ICUs.
134 */
135 BindingParser.prototype.parseInterpolationExpression = function (expression, sourceSpan) {
136 var sourceInfo = sourceSpan.start.toString();
137 var absoluteOffset = sourceSpan.start.offset;
138 try {
139 var ast = this._exprParser.parseInterpolationExpression(expression, sourceInfo, absoluteOffset);
140 if (ast)
141 this._reportExpressionParserErrors(ast.errors, sourceSpan);
142 this._checkPipes(ast, sourceSpan);
143 return ast;
144 }
145 catch (e) {
146 this._reportError("" + e, sourceSpan);
147 return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, absoluteOffset);
148 }
149 };
150 /**
151 * Parses the bindings in a microsyntax expression, and converts them to
152 * `ParsedProperty` or `ParsedVariable`.
153 *
154 * @param tplKey template binding name
155 * @param tplValue template binding value
156 * @param sourceSpan span of template binding relative to entire the template
157 * @param absoluteValueOffset start of the tplValue relative to the entire template
158 * @param targetMatchableAttrs potential attributes to match in the template
159 * @param targetProps target property bindings in the template
160 * @param targetVars target variables in the template
161 */
162 BindingParser.prototype.parseInlineTemplateBinding = function (tplKey, tplValue, sourceSpan, absoluteValueOffset, targetMatchableAttrs, targetProps, targetVars, isIvyAst) {
163 var e_1, _a;
164 var absoluteKeyOffset = sourceSpan.start.offset + TEMPLATE_ATTR_PREFIX.length;
165 var bindings = this._parseTemplateBindings(tplKey, tplValue, sourceSpan, absoluteKeyOffset, absoluteValueOffset);
166 try {
167 for (var bindings_1 = tslib_1.__values(bindings), bindings_1_1 = bindings_1.next(); !bindings_1_1.done; bindings_1_1 = bindings_1.next()) {
168 var binding = bindings_1_1.value;
169 // sourceSpan is for the entire HTML attribute. bindingSpan is for a particular
170 // binding within the microsyntax expression so it's more narrow than sourceSpan.
171 var bindingSpan = moveParseSourceSpan(sourceSpan, binding.sourceSpan);
172 var key = binding.key.source;
173 var keySpan = moveParseSourceSpan(sourceSpan, binding.key.span);
174 if (binding instanceof ast_1.VariableBinding) {
175 var value = binding.value ? binding.value.source : '$implicit';
176 var valueSpan = binding.value ? moveParseSourceSpan(sourceSpan, binding.value.span) : undefined;
177 targetVars.push(new ast_1.ParsedVariable(key, value, bindingSpan, keySpan, valueSpan));
178 }
179 else if (binding.value) {
180 var srcSpan = isIvyAst ? bindingSpan : sourceSpan;
181 var valueSpan = moveParseSourceSpan(sourceSpan, binding.value.ast.sourceSpan);
182 this._parsePropertyAst(key, binding.value, srcSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
183 }
184 else {
185 targetMatchableAttrs.push([key, '' /* value */]);
186 // Since this is a literal attribute with no RHS, source span should be
187 // just the key span.
188 this.parseLiteralAttr(key, null /* value */, keySpan, absoluteValueOffset, undefined /* valueSpan */, targetMatchableAttrs, targetProps, keySpan);
189 }
190 }
191 }
192 catch (e_1_1) { e_1 = { error: e_1_1 }; }
193 finally {
194 try {
195 if (bindings_1_1 && !bindings_1_1.done && (_a = bindings_1.return)) _a.call(bindings_1);
196 }
197 finally { if (e_1) throw e_1.error; }
198 }
199 };
200 /**
201 * Parses the bindings in a microsyntax expression, e.g.
202 * ```
203 * <tag *tplKey="let value1 = prop; let value2 = localVar">
204 * ```
205 *
206 * @param tplKey template binding name
207 * @param tplValue template binding value
208 * @param sourceSpan span of template binding relative to entire the template
209 * @param absoluteKeyOffset start of the `tplKey`
210 * @param absoluteValueOffset start of the `tplValue`
211 */
212 BindingParser.prototype._parseTemplateBindings = function (tplKey, tplValue, sourceSpan, absoluteKeyOffset, absoluteValueOffset) {
213 var _this = this;
214 var sourceInfo = sourceSpan.start.toString();
215 try {
216 var bindingsResult = this._exprParser.parseTemplateBindings(tplKey, tplValue, sourceInfo, absoluteKeyOffset, absoluteValueOffset);
217 this._reportExpressionParserErrors(bindingsResult.errors, sourceSpan);
218 bindingsResult.templateBindings.forEach(function (binding) {
219 if (binding.value instanceof ast_1.ASTWithSource) {
220 _this._checkPipes(binding.value, sourceSpan);
221 }
222 });
223 bindingsResult.warnings.forEach(function (warning) {
224 _this._reportError(warning, sourceSpan, parse_util_1.ParseErrorLevel.WARNING);
225 });
226 return bindingsResult.templateBindings;
227 }
228 catch (e) {
229 this._reportError("" + e, sourceSpan);
230 return [];
231 }
232 };
233 BindingParser.prototype.parseLiteralAttr = function (name, value, sourceSpan, absoluteOffset, valueSpan, targetMatchableAttrs,
234 // TODO(atscott): keySpan is only optional here so VE template parser implementation does not
235 // have to change This should be required when VE is removed.
236 targetProps, keySpan) {
237 if (isAnimationLabel(name)) {
238 name = name.substring(1);
239 if (keySpan !== undefined) {
240 keySpan = moveParseSourceSpan(keySpan, new ast_1.AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
241 }
242 if (value) {
243 this._reportError("Assigning animation triggers via @prop=\"exp\" attributes with an expression is invalid." +
244 " Use property bindings (e.g. [@prop]=\"exp\") or use an attribute without a value (e.g. @prop) instead.", sourceSpan, parse_util_1.ParseErrorLevel.ERROR);
245 }
246 this._parseAnimation(name, value, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
247 }
248 else {
249 targetProps.push(new ast_1.ParsedProperty(name, this._exprParser.wrapLiteralPrimitive(value, '', absoluteOffset), ast_1.ParsedPropertyType.LITERAL_ATTR, sourceSpan, keySpan, valueSpan));
250 }
251 };
252 BindingParser.prototype.parsePropertyBinding = function (name, expression, isHost, sourceSpan, absoluteOffset, valueSpan,
253 // TODO(atscott): keySpan is only optional here so VE template parser implementation does not
254 // have to change This should be required when VE is removed.
255 targetMatchableAttrs, targetProps, keySpan) {
256 if (name.length === 0) {
257 this._reportError("Property name is missing in binding", sourceSpan);
258 }
259 var isAnimationProp = false;
260 if (name.startsWith(ANIMATE_PROP_PREFIX)) {
261 isAnimationProp = true;
262 name = name.substring(ANIMATE_PROP_PREFIX.length);
263 if (keySpan !== undefined) {
264 keySpan = moveParseSourceSpan(keySpan, new ast_1.AbsoluteSourceSpan(keySpan.start.offset + ANIMATE_PROP_PREFIX.length, keySpan.end.offset));
265 }
266 }
267 else if (isAnimationLabel(name)) {
268 isAnimationProp = true;
269 name = name.substring(1);
270 if (keySpan !== undefined) {
271 keySpan = moveParseSourceSpan(keySpan, new ast_1.AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
272 }
273 }
274 if (isAnimationProp) {
275 this._parseAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
276 }
277 else {
278 this._parsePropertyAst(name, this._parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
279 }
280 };
281 BindingParser.prototype.parsePropertyInterpolation = function (name, value, sourceSpan, valueSpan, targetMatchableAttrs,
282 // TODO(atscott): keySpan is only optional here so VE template parser implementation does not
283 // have to change This should be required when VE is removed.
284 targetProps, keySpan) {
285 var expr = this.parseInterpolation(value, valueSpan || sourceSpan);
286 if (expr) {
287 this._parsePropertyAst(name, expr, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
288 return true;
289 }
290 return false;
291 };
292 BindingParser.prototype._parsePropertyAst = function (name, ast, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps) {
293 targetMatchableAttrs.push([name, ast.source]);
294 targetProps.push(new ast_1.ParsedProperty(name, ast, ast_1.ParsedPropertyType.DEFAULT, sourceSpan, keySpan, valueSpan));
295 };
296 BindingParser.prototype._parseAnimation = function (name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps) {
297 if (name.length === 0) {
298 this._reportError('Animation trigger is missing', sourceSpan);
299 }
300 // This will occur when a @trigger is not paired with an expression.
301 // For animations it is valid to not have an expression since */void
302 // states will be applied by angular when the element is attached/detached
303 var ast = this._parseBinding(expression || 'undefined', false, valueSpan || sourceSpan, absoluteOffset);
304 targetMatchableAttrs.push([name, ast.source]);
305 targetProps.push(new ast_1.ParsedProperty(name, ast, ast_1.ParsedPropertyType.ANIMATION, sourceSpan, keySpan, valueSpan));
306 };
307 BindingParser.prototype._parseBinding = function (value, isHostBinding, sourceSpan, absoluteOffset) {
308 var sourceInfo = (sourceSpan && sourceSpan.start || '(unknown)').toString();
309 try {
310 var ast = isHostBinding ?
311 this._exprParser.parseSimpleBinding(value, sourceInfo, absoluteOffset, this._interpolationConfig) :
312 this._exprParser.parseBinding(value, sourceInfo, absoluteOffset, this._interpolationConfig);
313 if (ast)
314 this._reportExpressionParserErrors(ast.errors, sourceSpan);
315 this._checkPipes(ast, sourceSpan);
316 return ast;
317 }
318 catch (e) {
319 this._reportError("" + e, sourceSpan);
320 return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, absoluteOffset);
321 }
322 };
323 BindingParser.prototype.createBoundElementProperty = function (elementSelector, boundProp, skipValidation, mapPropertyName) {
324 if (skipValidation === void 0) { skipValidation = false; }
325 if (mapPropertyName === void 0) { mapPropertyName = true; }
326 if (boundProp.isAnimation) {
327 return new ast_1.BoundElementProperty(boundProp.name, 4 /* Animation */, core_1.SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
328 }
329 var unit = null;
330 var bindingType = undefined;
331 var boundPropertyName = null;
332 var parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR);
333 var securityContexts = undefined;
334 // Check for special cases (prefix style, attr, class)
335 if (parts.length > 1) {
336 if (parts[0] == ATTRIBUTE_PREFIX) {
337 boundPropertyName = parts.slice(1).join(PROPERTY_PARTS_SEPARATOR);
338 if (!skipValidation) {
339 this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true);
340 }
341 securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, true);
342 var nsSeparatorIdx = boundPropertyName.indexOf(':');
343 if (nsSeparatorIdx > -1) {
344 var ns = boundPropertyName.substring(0, nsSeparatorIdx);
345 var name_1 = boundPropertyName.substring(nsSeparatorIdx + 1);
346 boundPropertyName = tags_1.mergeNsAndName(ns, name_1);
347 }
348 bindingType = 1 /* Attribute */;
349 }
350 else if (parts[0] == CLASS_PREFIX) {
351 boundPropertyName = parts[1];
352 bindingType = 2 /* Class */;
353 securityContexts = [core_1.SecurityContext.NONE];
354 }
355 else if (parts[0] == STYLE_PREFIX) {
356 unit = parts.length > 2 ? parts[2] : null;
357 boundPropertyName = parts[1];
358 bindingType = 3 /* Style */;
359 securityContexts = [core_1.SecurityContext.STYLE];
360 }
361 }
362 // If not a special case, use the full property name
363 if (boundPropertyName === null) {
364 var mappedPropName = this._schemaRegistry.getMappedPropName(boundProp.name);
365 boundPropertyName = mapPropertyName ? mappedPropName : boundProp.name;
366 securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, mappedPropName, false);
367 bindingType = 0 /* Property */;
368 if (!skipValidation) {
369 this._validatePropertyOrAttributeName(mappedPropName, boundProp.sourceSpan, false);
370 }
371 }
372 return new ast_1.BoundElementProperty(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
373 };
374 // TODO: keySpan should be required but was made optional to avoid changing VE parser.
375 BindingParser.prototype.parseEvent = function (name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
376 if (name.length === 0) {
377 this._reportError("Event name is missing in binding", sourceSpan);
378 }
379 if (isAnimationLabel(name)) {
380 name = name.substr(1);
381 if (keySpan !== undefined) {
382 keySpan = moveParseSourceSpan(keySpan, new ast_1.AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
383 }
384 this._parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan);
385 }
386 else {
387 this._parseRegularEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan);
388 }
389 };
390 BindingParser.prototype.calcPossibleSecurityContexts = function (selector, propName, isAttribute) {
391 var prop = this._schemaRegistry.getMappedPropName(propName);
392 return calcPossibleSecurityContexts(this._schemaRegistry, selector, prop, isAttribute);
393 };
394 BindingParser.prototype._parseAnimationEvent = function (name, expression, sourceSpan, handlerSpan, targetEvents, keySpan) {
395 var matches = util_1.splitAtPeriod(name, [name, '']);
396 var eventName = matches[0];
397 var phase = matches[1].toLowerCase();
398 var ast = this._parseAction(expression, handlerSpan);
399 targetEvents.push(new ast_1.ParsedEvent(eventName, phase, 1 /* Animation */, ast, sourceSpan, handlerSpan, keySpan));
400 if (eventName.length === 0) {
401 this._reportError("Animation event name is missing in binding", sourceSpan);
402 }
403 if (phase) {
404 if (phase !== 'start' && phase !== 'done') {
405 this._reportError("The provided animation output phase value \"" + phase + "\" for \"@" + eventName + "\" is not supported (use start or done)", sourceSpan);
406 }
407 }
408 else {
409 this._reportError("The animation trigger output event (@" + eventName + ") is missing its phase value name (start or done are currently supported)", sourceSpan);
410 }
411 };
412 BindingParser.prototype._parseRegularEvent = function (name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
413 // long format: 'target: eventName'
414 var _a = tslib_1.__read(util_1.splitAtColon(name, [null, name]), 2), target = _a[0], eventName = _a[1];
415 var ast = this._parseAction(expression, handlerSpan);
416 targetMatchableAttrs.push([name, ast.source]);
417 targetEvents.push(new ast_1.ParsedEvent(eventName, target, 0 /* Regular */, ast, sourceSpan, handlerSpan, keySpan));
418 // Don't detect directives for event names for now,
419 // so don't add the event name to the matchableAttrs
420 };
421 BindingParser.prototype._parseAction = function (value, sourceSpan) {
422 var sourceInfo = (sourceSpan && sourceSpan.start || '(unknown').toString();
423 var absoluteOffset = (sourceSpan && sourceSpan.start) ? sourceSpan.start.offset : 0;
424 try {
425 var ast = this._exprParser.parseAction(value, sourceInfo, absoluteOffset, this._interpolationConfig);
426 if (ast) {
427 this._reportExpressionParserErrors(ast.errors, sourceSpan);
428 }
429 if (!ast || ast.ast instanceof ast_1.EmptyExpr) {
430 this._reportError("Empty expressions are not allowed", sourceSpan);
431 return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, absoluteOffset);
432 }
433 this._checkPipes(ast, sourceSpan);
434 return ast;
435 }
436 catch (e) {
437 this._reportError("" + e, sourceSpan);
438 return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, absoluteOffset);
439 }
440 };
441 BindingParser.prototype._reportError = function (message, sourceSpan, level) {
442 if (level === void 0) { level = parse_util_1.ParseErrorLevel.ERROR; }
443 this.errors.push(new parse_util_1.ParseError(sourceSpan, message, level));
444 };
445 BindingParser.prototype._reportExpressionParserErrors = function (errors, sourceSpan) {
446 var e_2, _a;
447 try {
448 for (var errors_1 = tslib_1.__values(errors), errors_1_1 = errors_1.next(); !errors_1_1.done; errors_1_1 = errors_1.next()) {
449 var error = errors_1_1.value;
450 this._reportError(error.message, sourceSpan);
451 }
452 }
453 catch (e_2_1) { e_2 = { error: e_2_1 }; }
454 finally {
455 try {
456 if (errors_1_1 && !errors_1_1.done && (_a = errors_1.return)) _a.call(errors_1);
457 }
458 finally { if (e_2) throw e_2.error; }
459 }
460 };
461 // Make sure all the used pipes are known in `this.pipesByName`
462 BindingParser.prototype._checkPipes = function (ast, sourceSpan) {
463 var _this = this;
464 if (ast && this.pipesByName) {
465 var collector = new PipeCollector();
466 ast.visit(collector);
467 collector.pipes.forEach(function (ast, pipeName) {
468 var pipeMeta = _this.pipesByName.get(pipeName);
469 if (!pipeMeta) {
470 _this._reportError("The pipe '" + pipeName + "' could not be found", new parse_util_1.ParseSourceSpan(sourceSpan.start.moveBy(ast.span.start), sourceSpan.start.moveBy(ast.span.end)));
471 }
472 else {
473 _this._usedPipes.set(pipeName, pipeMeta);
474 }
475 });
476 }
477 };
478 /**
479 * @param propName the name of the property / attribute
480 * @param sourceSpan
481 * @param isAttr true when binding to an attribute
482 */
483 BindingParser.prototype._validatePropertyOrAttributeName = function (propName, sourceSpan, isAttr) {
484 var report = isAttr ? this._schemaRegistry.validateAttribute(propName) :
485 this._schemaRegistry.validateProperty(propName);
486 if (report.error) {
487 this._reportError(report.msg, sourceSpan, parse_util_1.ParseErrorLevel.ERROR);
488 }
489 };
490 return BindingParser;
491 }());
492 exports.BindingParser = BindingParser;
493 var PipeCollector = /** @class */ (function (_super) {
494 tslib_1.__extends(PipeCollector, _super);
495 function PipeCollector() {
496 var _this = _super !== null && _super.apply(this, arguments) || this;
497 _this.pipes = new Map();
498 return _this;
499 }
500 PipeCollector.prototype.visitPipe = function (ast, context) {
501 this.pipes.set(ast.name, ast);
502 ast.exp.visit(this);
503 this.visitAll(ast.args, context);
504 return null;
505 };
506 return PipeCollector;
507 }(ast_1.RecursiveAstVisitor));
508 exports.PipeCollector = PipeCollector;
509 function isAnimationLabel(name) {
510 return name[0] == '@';
511 }
512 function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) {
513 var ctxs = [];
514 selector_1.CssSelector.parse(selector).forEach(function (selector) {
515 var elementNames = selector.element ? [selector.element] : registry.allKnownElementNames();
516 var notElementNames = new Set(selector.notSelectors.filter(function (selector) { return selector.isElementSelector(); })
517 .map(function (selector) { return selector.element; }));
518 var possibleElementNames = elementNames.filter(function (elementName) { return !notElementNames.has(elementName); });
519 ctxs.push.apply(ctxs, tslib_1.__spreadArray([], tslib_1.__read(possibleElementNames.map(function (elementName) { return registry.securityContext(elementName, propName, isAttribute); }))));
520 });
521 return ctxs.length === 0 ? [core_1.SecurityContext.NONE] : Array.from(new Set(ctxs)).sort();
522 }
523 exports.calcPossibleSecurityContexts = calcPossibleSecurityContexts;
524 /**
525 * Compute a new ParseSourceSpan based off an original `sourceSpan` by using
526 * absolute offsets from the specified `absoluteSpan`.
527 *
528 * @param sourceSpan original source span
529 * @param absoluteSpan absolute source span to move to
530 */
531 function moveParseSourceSpan(sourceSpan, absoluteSpan) {
532 // The difference of two absolute offsets provide the relative offset
533 var startDiff = absoluteSpan.start - sourceSpan.start.offset;
534 var endDiff = absoluteSpan.end - sourceSpan.end.offset;
535 return new parse_util_1.ParseSourceSpan(sourceSpan.start.moveBy(startDiff), sourceSpan.end.moveBy(endDiff), sourceSpan.fullStart.moveBy(startDiff), sourceSpan.details);
536 }
537});
538//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmluZGluZ19wYXJzZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21waWxlci9zcmMvdGVtcGxhdGVfcGFyc2VyL2JpbmRpbmdfcGFyc2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRzs7Ozs7Ozs7Ozs7Ozs7SUFHSCxtREFBd0M7SUFDeEMsbUVBQTR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