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