source: trip-planner-front/node_modules/@angular/compiler-cli/src/metadata/evaluator.js@ 188ee53

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

initial commit

  • Property mode set to 100644
File size: 107.2 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-cli/src/metadata/evaluator", ["require", "exports", "tslib", "typescript", "@angular/compiler-cli/src/metadata/schema"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.Evaluator = exports.errorSymbol = exports.sourceInfo = exports.isPrimitive = exports.recordMapEntry = void 0;
20 var tslib_1 = require("tslib");
21 var ts = require("typescript");
22 var schema_1 = require("@angular/compiler-cli/src/metadata/schema");
23 // In TypeScript 2.1 the spread element kind was renamed.
24 var spreadElementSyntaxKind = ts.SyntaxKind.SpreadElement || ts.SyntaxKind.SpreadElementExpression;
25 function isMethodCallOf(callExpression, memberName) {
26 var expression = callExpression.expression;
27 if (expression.kind === ts.SyntaxKind.PropertyAccessExpression) {
28 var propertyAccessExpression = expression;
29 var name = propertyAccessExpression.name;
30 if (name.kind == ts.SyntaxKind.Identifier) {
31 return name.text === memberName;
32 }
33 }
34 return false;
35 }
36 function isCallOf(callExpression, ident) {
37 var expression = callExpression.expression;
38 if (expression.kind === ts.SyntaxKind.Identifier) {
39 var identifier = expression;
40 return identifier.text === ident;
41 }
42 return false;
43 }
44 /* @internal */
45 function recordMapEntry(entry, node, nodeMap, sourceFile) {
46 if (!nodeMap.has(entry)) {
47 nodeMap.set(entry, node);
48 if (node &&
49 (schema_1.isMetadataImportedSymbolReferenceExpression(entry) ||
50 schema_1.isMetadataImportDefaultReference(entry)) &&
51 entry.line == null) {
52 var info = sourceInfo(node, sourceFile);
53 if (info.line != null)
54 entry.line = info.line;
55 if (info.character != null)
56 entry.character = info.character;
57 }
58 }
59 return entry;
60 }
61 exports.recordMapEntry = recordMapEntry;
62 /**
63 * ts.forEachChild stops iterating children when the callback return a truthy value.
64 * This method inverts this to implement an `every` style iterator. It will return
65 * true if every call to `cb` returns `true`.
66 */
67 function everyNodeChild(node, cb) {
68 return !ts.forEachChild(node, function (node) { return !cb(node); });
69 }
70 function isPrimitive(value) {
71 return Object(value) !== value;
72 }
73 exports.isPrimitive = isPrimitive;
74 function isDefined(obj) {
75 return obj !== undefined;
76 }
77 function getSourceFileOfNode(node) {
78 while (node && node.kind != ts.SyntaxKind.SourceFile) {
79 node = node.parent;
80 }
81 return node;
82 }
83 /* @internal */
84 function sourceInfo(node, sourceFile) {
85 if (node) {
86 sourceFile = sourceFile || getSourceFileOfNode(node);
87 if (sourceFile) {
88 return ts.getLineAndCharacterOfPosition(sourceFile, node.getStart(sourceFile));
89 }
90 }
91 return {};
92 }
93 exports.sourceInfo = sourceInfo;
94 /* @internal */
95 function errorSymbol(message, node, context, sourceFile) {
96 var result = tslib_1.__assign({ __symbolic: 'error', message: message }, sourceInfo(node, sourceFile));
97 if (context) {
98 result.context = context;
99 }
100 return result;
101 }
102 exports.errorSymbol = errorSymbol;
103 /**
104 * Produce a symbolic representation of an expression folding values into their final value when
105 * possible.
106 */
107 var Evaluator = /** @class */ (function () {
108 function Evaluator(symbols, nodeMap, options, recordExport) {
109 if (options === void 0) { options = {}; }
110 this.symbols = symbols;
111 this.nodeMap = nodeMap;
112 this.options = options;
113 this.recordExport = recordExport;
114 }
115 Evaluator.prototype.nameOf = function (node) {
116 if (node && node.kind == ts.SyntaxKind.Identifier) {
117 return node.text;
118 }
119 var result = node && this.evaluateNode(node);
120 if (schema_1.isMetadataError(result) || typeof result === 'string') {
121 return result;
122 }
123 else {
124 return errorSymbol('Name expected', node, { received: (node && node.getText()) || '<missing>' });
125 }
126 };
127 /**
128 * Returns true if the expression represented by `node` can be folded into a literal expression.
129 *
130 * For example, a literal is always foldable. This means that literal expressions such as `1.2`
131 * `"Some value"` `true` `false` are foldable.
132 *
133 * - An object literal is foldable if all the properties in the literal are foldable.
134 * - An array literal is foldable if all the elements are foldable.
135 * - A call is foldable if it is a call to a Array.prototype.concat or a call to CONST_EXPR.
136 * - A property access is foldable if the object is foldable.
137 * - A array index is foldable if index expression is foldable and the array is foldable.
138 * - Binary operator expressions are foldable if the left and right expressions are foldable and
139 * it is one of '+', '-', '*', '/', '%', '||', and '&&'.
140 * - An identifier is foldable if a value can be found for its symbol in the evaluator symbol
141 * table.
142 */
143 Evaluator.prototype.isFoldable = function (node) {
144 return this.isFoldableWorker(node, new Map());
145 };
146 Evaluator.prototype.isFoldableWorker = function (node, folding) {
147 var _this = this;
148 if (node) {
149 switch (node.kind) {
150 case ts.SyntaxKind.ObjectLiteralExpression:
151 return everyNodeChild(node, function (child) {
152 if (child.kind === ts.SyntaxKind.PropertyAssignment) {
153 var propertyAssignment = child;
154 return _this.isFoldableWorker(propertyAssignment.initializer, folding);
155 }
156 return false;
157 });
158 case ts.SyntaxKind.ArrayLiteralExpression:
159 return everyNodeChild(node, function (child) { return _this.isFoldableWorker(child, folding); });
160 case ts.SyntaxKind.CallExpression:
161 var callExpression = node;
162 // We can fold a <array>.concat(<v>).
163 if (isMethodCallOf(callExpression, 'concat') &&
164 arrayOrEmpty(callExpression.arguments).length === 1) {
165 var arrayNode = callExpression.expression.expression;
166 if (this.isFoldableWorker(arrayNode, folding) &&
167 this.isFoldableWorker(callExpression.arguments[0], folding)) {
168 // It needs to be an array.
169 var arrayValue = this.evaluateNode(arrayNode);
170 if (arrayValue && Array.isArray(arrayValue)) {
171 return true;
172 }
173 }
174 }
175 // We can fold a call to CONST_EXPR
176 if (isCallOf(callExpression, 'CONST_EXPR') &&
177 arrayOrEmpty(callExpression.arguments).length === 1)
178 return this.isFoldableWorker(callExpression.arguments[0], folding);
179 return false;
180 case ts.SyntaxKind.NoSubstitutionTemplateLiteral:
181 case ts.SyntaxKind.StringLiteral:
182 case ts.SyntaxKind.NumericLiteral:
183 case ts.SyntaxKind.NullKeyword:
184 case ts.SyntaxKind.TrueKeyword:
185 case ts.SyntaxKind.FalseKeyword:
186 case ts.SyntaxKind.TemplateHead:
187 case ts.SyntaxKind.TemplateMiddle:
188 case ts.SyntaxKind.TemplateTail:
189 return true;
190 case ts.SyntaxKind.ParenthesizedExpression:
191 var parenthesizedExpression = node;
192 return this.isFoldableWorker(parenthesizedExpression.expression, folding);
193 case ts.SyntaxKind.BinaryExpression:
194 var binaryExpression = node;
195 switch (binaryExpression.operatorToken.kind) {
196 case ts.SyntaxKind.PlusToken:
197 case ts.SyntaxKind.MinusToken:
198 case ts.SyntaxKind.AsteriskToken:
199 case ts.SyntaxKind.SlashToken:
200 case ts.SyntaxKind.PercentToken:
201 case ts.SyntaxKind.AmpersandAmpersandToken:
202 case ts.SyntaxKind.BarBarToken:
203 return this.isFoldableWorker(binaryExpression.left, folding) &&
204 this.isFoldableWorker(binaryExpression.right, folding);
205 default:
206 return false;
207 }
208 case ts.SyntaxKind.PropertyAccessExpression:
209 var propertyAccessExpression = node;
210 return this.isFoldableWorker(propertyAccessExpression.expression, folding);
211 case ts.SyntaxKind.ElementAccessExpression:
212 var elementAccessExpression = node;
213 return this.isFoldableWorker(elementAccessExpression.expression, folding) &&
214 this.isFoldableWorker(elementAccessExpression.argumentExpression, folding);
215 case ts.SyntaxKind.Identifier:
216 var identifier = node;
217 var reference = this.symbols.resolve(identifier.text);
218 if (reference !== undefined && isPrimitive(reference)) {
219 return true;
220 }
221 break;
222 case ts.SyntaxKind.TemplateExpression:
223 var templateExpression = node;
224 return templateExpression.templateSpans.every(function (span) { return _this.isFoldableWorker(span.expression, folding); });
225 }
226 }
227 return false;
228 };
229 /**
230 * Produce a JSON serialiable object representing `node`. The foldable values in the expression
231 * tree are folded. For example, a node representing `1 + 2` is folded into `3`.
232 */
233 Evaluator.prototype.evaluateNode = function (node, preferReference) {
234 var _this = this;
235 var t = this;
236 var error;
237 function recordEntry(entry, node) {
238 if (t.options.substituteExpression) {
239 var newEntry = t.options.substituteExpression(entry, node);
240 if (t.recordExport && newEntry != entry && schema_1.isMetadataGlobalReferenceExpression(newEntry)) {
241 t.recordExport(newEntry.name, entry);
242 }
243 entry = newEntry;
244 }
245 return recordMapEntry(entry, node, t.nodeMap);
246 }
247 function isFoldableError(value) {
248 return !t.options.verboseInvalidExpression && schema_1.isMetadataError(value);
249 }
250 var resolveName = function (name, preferReference) {
251 var reference = _this.symbols.resolve(name, preferReference);
252 if (reference === undefined) {
253 // Encode as a global reference. StaticReflector will check the reference.
254 return recordEntry({ __symbolic: 'reference', name: name }, node);
255 }
256 if (reference && schema_1.isMetadataSymbolicReferenceExpression(reference)) {
257 return recordEntry(tslib_1.__assign({}, reference), node);
258 }
259 return reference;
260 };
261 switch (node.kind) {
262 case ts.SyntaxKind.ObjectLiteralExpression:
263 var obj_1 = {};
264 var quoted_1 = [];
265 ts.forEachChild(node, function (child) {
266 switch (child.kind) {
267 case ts.SyntaxKind.ShorthandPropertyAssignment:
268 case ts.SyntaxKind.PropertyAssignment:
269 var assignment = child;
270 if (assignment.name.kind == ts.SyntaxKind.StringLiteral) {
271 var name_1 = assignment.name.text;
272 quoted_1.push(name_1);
273 }
274 var propertyName = _this.nameOf(assignment.name);
275 if (isFoldableError(propertyName)) {
276 error = propertyName;
277 return true;
278 }
279 var propertyValue = isPropertyAssignment(assignment) ?
280 _this.evaluateNode(assignment.initializer, /* preferReference */ true) :
281 resolveName(propertyName, /* preferReference */ true);
282 if (isFoldableError(propertyValue)) {
283 error = propertyValue;
284 return true; // Stop the forEachChild.
285 }
286 else {
287 obj_1[propertyName] = isPropertyAssignment(assignment) ?
288 recordEntry(propertyValue, assignment.initializer) :
289 propertyValue;
290 }
291 }
292 });
293 if (error)
294 return error;
295 if (this.options.quotedNames && quoted_1.length) {
296 obj_1['$quoted$'] = quoted_1;
297 }
298 return recordEntry(obj_1, node);
299 case ts.SyntaxKind.ArrayLiteralExpression:
300 var arr_1 = [];
301 ts.forEachChild(node, function (child) {
302 var e_1, _a;
303 var value = _this.evaluateNode(child, /* preferReference */ true);
304 // Check for error
305 if (isFoldableError(value)) {
306 error = value;
307 return true; // Stop the forEachChild.
308 }
309 // Handle spread expressions
310 if (schema_1.isMetadataSymbolicSpreadExpression(value)) {
311 if (Array.isArray(value.expression)) {
312 try {
313 for (var _b = tslib_1.__values(value.expression), _c = _b.next(); !_c.done; _c = _b.next()) {
314 var spreadValue = _c.value;
315 arr_1.push(spreadValue);
316 }
317 }
318 catch (e_1_1) { e_1 = { error: e_1_1 }; }
319 finally {
320 try {
321 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
322 }
323 finally { if (e_1) throw e_1.error; }
324 }
325 return;
326 }
327 }
328 arr_1.push(value);
329 });
330 if (error)
331 return error;
332 return recordEntry(arr_1, node);
333 case spreadElementSyntaxKind:
334 var spreadExpression = this.evaluateNode(node.expression);
335 return recordEntry({ __symbolic: 'spread', expression: spreadExpression }, node);
336 case ts.SyntaxKind.CallExpression:
337 var callExpression = node;
338 if (isCallOf(callExpression, 'forwardRef') &&
339 arrayOrEmpty(callExpression.arguments).length === 1) {
340 var firstArgument = callExpression.arguments[0];
341 if (firstArgument.kind == ts.SyntaxKind.ArrowFunction) {
342 var arrowFunction = firstArgument;
343 return recordEntry(this.evaluateNode(arrowFunction.body), node);
344 }
345 }
346 var args = arrayOrEmpty(callExpression.arguments).map(function (arg) { return _this.evaluateNode(arg); });
347 if (this.isFoldable(callExpression)) {
348 if (isMethodCallOf(callExpression, 'concat')) {
349 var arrayValue = this.evaluateNode(callExpression.expression.expression);
350 if (isFoldableError(arrayValue))
351 return arrayValue;
352 return arrayValue.concat(args[0]);
353 }
354 }
355 // Always fold a CONST_EXPR even if the argument is not foldable.
356 if (isCallOf(callExpression, 'CONST_EXPR') &&
357 arrayOrEmpty(callExpression.arguments).length === 1) {
358 return recordEntry(args[0], node);
359 }
360 var expression = this.evaluateNode(callExpression.expression);
361 if (isFoldableError(expression)) {
362 return recordEntry(expression, node);
363 }
364 var result = { __symbolic: 'call', expression: expression };
365 if (args && args.length) {
366 result.arguments = args;
367 }
368 return recordEntry(result, node);
369 case ts.SyntaxKind.NewExpression:
370 var newExpression = node;
371 var newArgs = arrayOrEmpty(newExpression.arguments).map(function (arg) { return _this.evaluateNode(arg); });
372 var newTarget = this.evaluateNode(newExpression.expression);
373 if (schema_1.isMetadataError(newTarget)) {
374 return recordEntry(newTarget, node);
375 }
376 var call = { __symbolic: 'new', expression: newTarget };
377 if (newArgs.length) {
378 call.arguments = newArgs;
379 }
380 return recordEntry(call, node);
381 case ts.SyntaxKind.PropertyAccessExpression: {
382 var propertyAccessExpression = node;
383 var expression_1 = this.evaluateNode(propertyAccessExpression.expression);
384 if (isFoldableError(expression_1)) {
385 return recordEntry(expression_1, node);
386 }
387 var member = this.nameOf(propertyAccessExpression.name);
388 if (isFoldableError(member)) {
389 return recordEntry(member, node);
390 }
391 if (expression_1 && this.isFoldable(propertyAccessExpression.expression))
392 return expression_1[member];
393 if (schema_1.isMetadataModuleReferenceExpression(expression_1)) {
394 // A select into a module reference and be converted into a reference to the symbol
395 // in the module
396 return recordEntry({ __symbolic: 'reference', module: expression_1.module, name: member }, node);
397 }
398 return recordEntry({ __symbolic: 'select', expression: expression_1, member: member }, node);
399 }
400 case ts.SyntaxKind.ElementAccessExpression: {
401 var elementAccessExpression = node;
402 var expression_2 = this.evaluateNode(elementAccessExpression.expression);
403 if (isFoldableError(expression_2)) {
404 return recordEntry(expression_2, node);
405 }
406 if (!elementAccessExpression.argumentExpression) {
407 return recordEntry(errorSymbol('Expression form not supported', node), node);
408 }
409 var index = this.evaluateNode(elementAccessExpression.argumentExpression);
410 if (isFoldableError(expression_2)) {
411 return recordEntry(expression_2, node);
412 }
413 if (this.isFoldable(elementAccessExpression.expression) &&
414 this.isFoldable(elementAccessExpression.argumentExpression))
415 return expression_2[index];
416 return recordEntry({ __symbolic: 'index', expression: expression_2, index: index }, node);
417 }
418 case ts.SyntaxKind.Identifier:
419 var identifier = node;
420 var name = identifier.text;
421 return resolveName(name, preferReference);
422 case ts.SyntaxKind.TypeReference:
423 var typeReferenceNode = node;
424 var typeNameNode_1 = typeReferenceNode.typeName;
425 var getReference = function (node) {
426 if (typeNameNode_1.kind === ts.SyntaxKind.QualifiedName) {
427 var qualifiedName = node;
428 var left_1 = _this.evaluateNode(qualifiedName.left);
429 if (schema_1.isMetadataModuleReferenceExpression(left_1)) {
430 return recordEntry({
431 __symbolic: 'reference',
432 module: left_1.module,
433 name: qualifiedName.right.text
434 }, node);
435 }
436 // Record a type reference to a declared type as a select.
437 return { __symbolic: 'select', expression: left_1, member: qualifiedName.right.text };
438 }
439 else {
440 var identifier_1 = typeNameNode_1;
441 var symbol = _this.symbols.resolve(identifier_1.text);
442 if (isFoldableError(symbol) || schema_1.isMetadataSymbolicReferenceExpression(symbol)) {
443 return recordEntry(symbol, node);
444 }
445 return recordEntry(errorSymbol('Could not resolve type', node, { typeName: identifier_1.text }), node);
446 }
447 };
448 var typeReference = getReference(typeNameNode_1);
449 if (isFoldableError(typeReference)) {
450 return recordEntry(typeReference, node);
451 }
452 if (!schema_1.isMetadataModuleReferenceExpression(typeReference) &&
453 typeReferenceNode.typeArguments && typeReferenceNode.typeArguments.length) {
454 var args_1 = typeReferenceNode.typeArguments.map(function (element) { return _this.evaluateNode(element); });
455 // TODO: Remove typecast when upgraded to 2.0 as it will be correctly inferred.
456 // Some versions of 1.9 do not infer this correctly.
457 typeReference.arguments = args_1;
458 }
459 return recordEntry(typeReference, node);
460 case ts.SyntaxKind.UnionType:
461 var unionType = node;
462 // Remove null and undefined from the list of unions.
463 var references = unionType.types
464 .filter(function (n) { return n.kind !== ts.SyntaxKind.UndefinedKeyword &&
465 !(ts.isLiteralTypeNode(n) && n.literal.kind === ts.SyntaxKind.NullKeyword); })
466 .map(function (n) { return _this.evaluateNode(n); });
467 // The remmaining reference must be the same. If two have type arguments consider them
468 // different even if the type arguments are the same.
469 var candidate = null;
470 for (var i = 0; i < references.length; i++) {
471 var reference = references[i];
472 if (schema_1.isMetadataSymbolicReferenceExpression(reference)) {
473 if (candidate) {
474 if (reference.name == candidate.name &&
475 reference.module == candidate.module && !reference.arguments) {
476 candidate = reference;
477 }
478 }
479 else {
480 candidate = reference;
481 }
482 }
483 else {
484 return reference;
485 }
486 }
487 if (candidate)
488 return candidate;
489 break;
490 case ts.SyntaxKind.NoSubstitutionTemplateLiteral:
491 case ts.SyntaxKind.StringLiteral:
492 case ts.SyntaxKind.TemplateHead:
493 case ts.SyntaxKind.TemplateTail:
494 case ts.SyntaxKind.TemplateMiddle:
495 return node.text;
496 case ts.SyntaxKind.NumericLiteral:
497 return parseFloat(node.text);
498 case ts.SyntaxKind.AnyKeyword:
499 return recordEntry({ __symbolic: 'reference', name: 'any' }, node);
500 case ts.SyntaxKind.StringKeyword:
501 return recordEntry({ __symbolic: 'reference', name: 'string' }, node);
502 case ts.SyntaxKind.NumberKeyword:
503 return recordEntry({ __symbolic: 'reference', name: 'number' }, node);
504 case ts.SyntaxKind.BooleanKeyword:
505 return recordEntry({ __symbolic: 'reference', name: 'boolean' }, node);
506 case ts.SyntaxKind.ArrayType:
507 var arrayTypeNode = node;
508 return recordEntry({
509 __symbolic: 'reference',
510 name: 'Array',
511 arguments: [this.evaluateNode(arrayTypeNode.elementType)]
512 }, node);
513 case ts.SyntaxKind.NullKeyword:
514 return null;
515 case ts.SyntaxKind.TrueKeyword:
516 return true;
517 case ts.SyntaxKind.FalseKeyword:
518 return false;
519 case ts.SyntaxKind.ParenthesizedExpression:
520 var parenthesizedExpression = node;
521 return this.evaluateNode(parenthesizedExpression.expression);
522 case ts.SyntaxKind.TypeAssertionExpression:
523 var typeAssertion = node;
524 return this.evaluateNode(typeAssertion.expression);
525 case ts.SyntaxKind.PrefixUnaryExpression:
526 var prefixUnaryExpression = node;
527 var operand = this.evaluateNode(prefixUnaryExpression.operand);
528 if (isDefined(operand) && isPrimitive(operand)) {
529 switch (prefixUnaryExpression.operator) {
530 case ts.SyntaxKind.PlusToken:
531 return +operand;
532 case ts.SyntaxKind.MinusToken:
533 return -operand;
534 case ts.SyntaxKind.TildeToken:
535 return ~operand;
536 case ts.SyntaxKind.ExclamationToken:
537 return !operand;
538 }
539 }
540 var operatorText = void 0;
541 switch (prefixUnaryExpression.operator) {
542 case ts.SyntaxKind.PlusToken:
543 operatorText = '+';
544 break;
545 case ts.SyntaxKind.MinusToken:
546 operatorText = '-';
547 break;
548 case ts.SyntaxKind.TildeToken:
549 operatorText = '~';
550 break;
551 case ts.SyntaxKind.ExclamationToken:
552 operatorText = '!';
553 break;
554 default:
555 return undefined;
556 }
557 return recordEntry({ __symbolic: 'pre', operator: operatorText, operand: operand }, node);
558 case ts.SyntaxKind.BinaryExpression:
559 var binaryExpression = node;
560 var left = this.evaluateNode(binaryExpression.left);
561 var right = this.evaluateNode(binaryExpression.right);
562 if (isDefined(left) && isDefined(right)) {
563 if (isPrimitive(left) && isPrimitive(right))
564 switch (binaryExpression.operatorToken.kind) {
565 case ts.SyntaxKind.BarBarToken:
566 return left || right;
567 case ts.SyntaxKind.AmpersandAmpersandToken:
568 return left && right;
569 case ts.SyntaxKind.AmpersandToken:
570 return left & right;
571 case ts.SyntaxKind.BarToken:
572 return left | right;
573 case ts.SyntaxKind.CaretToken:
574 return left ^ right;
575 case ts.SyntaxKind.EqualsEqualsToken:
576 return left == right;
577 case ts.SyntaxKind.ExclamationEqualsToken:
578 return left != right;
579 case ts.SyntaxKind.EqualsEqualsEqualsToken:
580 return left === right;
581 case ts.SyntaxKind.ExclamationEqualsEqualsToken:
582 return left !== right;
583 case ts.SyntaxKind.LessThanToken:
584 return left < right;
585 case ts.SyntaxKind.GreaterThanToken:
586 return left > right;
587 case ts.SyntaxKind.LessThanEqualsToken:
588 return left <= right;
589 case ts.SyntaxKind.GreaterThanEqualsToken:
590 return left >= right;
591 case ts.SyntaxKind.LessThanLessThanToken:
592 return left << right;
593 case ts.SyntaxKind.GreaterThanGreaterThanToken:
594 return left >> right;
595 case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
596 return left >>> right;
597 case ts.SyntaxKind.PlusToken:
598 return left + right;
599 case ts.SyntaxKind.MinusToken:
600 return left - right;
601 case ts.SyntaxKind.AsteriskToken:
602 return left * right;
603 case ts.SyntaxKind.SlashToken:
604 return left / right;
605 case ts.SyntaxKind.PercentToken:
606 return left % right;
607 }
608 return recordEntry({
609 __symbolic: 'binop',
610 operator: binaryExpression.operatorToken.getText(),
611 left: left,
612 right: right
613 }, node);
614 }
615 break;
616 case ts.SyntaxKind.ConditionalExpression:
617 var conditionalExpression = node;
618 var condition = this.evaluateNode(conditionalExpression.condition);
619 var thenExpression = this.evaluateNode(conditionalExpression.whenTrue);
620 var elseExpression = this.evaluateNode(conditionalExpression.whenFalse);
621 if (isPrimitive(condition)) {
622 return condition ? thenExpression : elseExpression;
623 }
624 return recordEntry({ __symbolic: 'if', condition: condition, thenExpression: thenExpression, elseExpression: elseExpression }, node);
625 case ts.SyntaxKind.FunctionExpression:
626 case ts.SyntaxKind.ArrowFunction:
627 return recordEntry(errorSymbol('Lambda not supported', node), node);
628 case ts.SyntaxKind.TaggedTemplateExpression:
629 return recordEntry(errorSymbol('Tagged template expressions are not supported in metadata', node), node);
630 case ts.SyntaxKind.TemplateExpression:
631 var templateExpression = node;
632 if (this.isFoldable(node)) {
633 return templateExpression.templateSpans.reduce(function (previous, current) { return previous + _this.evaluateNode(current.expression) +
634 _this.evaluateNode(current.literal); }, this.evaluateNode(templateExpression.head));
635 }
636 else {
637 return templateExpression.templateSpans.reduce(function (previous, current) {
638 var expr = _this.evaluateNode(current.expression);
639 var literal = _this.evaluateNode(current.literal);
640 if (isFoldableError(expr))
641 return expr;
642 if (isFoldableError(literal))
643 return literal;
644 if (typeof previous === 'string' && typeof expr === 'string' &&
645 typeof literal === 'string') {
646 return previous + expr + literal;
647 }
648 var result = expr;
649 if (previous !== '') {
650 result = { __symbolic: 'binop', operator: '+', left: previous, right: expr };
651 }
652 if (literal != '') {
653 result = { __symbolic: 'binop', operator: '+', left: result, right: literal };
654 }
655 return result;
656 }, this.evaluateNode(templateExpression.head));
657 }
658 case ts.SyntaxKind.AsExpression:
659 var asExpression = node;
660 return this.evaluateNode(asExpression.expression);
661 case ts.SyntaxKind.ClassExpression:
662 return { __symbolic: 'class' };
663 }
664 return recordEntry(errorSymbol('Expression form not supported', node), node);
665 };
666 return Evaluator;
667 }());
668 exports.Evaluator = Evaluator;
669 function isPropertyAssignment(node) {
670 return node.kind == ts.SyntaxKind.PropertyAssignment;
671 }
672 var empty = ts.createNodeArray();
673 function arrayOrEmpty(v) {
674 return v || empty;
675 }
676});
677//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXZhbHVhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZXItY2xpL3NyYy9tZXRhZGF0YS9ldmFsdWF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOzs7Ozs7Ozs7Ozs7OztJQUVILCtCQUFpQztJQUdqQyxvRUFBcWQ7SUFLcmQseURBQXlEO0lBQ3pELElBQU0sdUJBQXVCLEdBQ3hCLEVBQUUsQ0FBQyxVQUFrQixDQUFDLGFBQWEsSUFBSyxFQUFFLENBQUMsVUFBa0IsQ0FBQyx1QkFBdUIsQ0FBQztJQUUzRixTQUFTLGNBQWMsQ0FBQyxjQUFpQyxFQUFFLFVBQWtCO1FBQzNFLElBQU0sVUFBVSxHQUFHLGNBQWMsQ0FBQyxVQUFVLENBQUM7UUFDN0MsSUFBSSxVQUFVLENBQUMsSUFBSSxLQUFLLEVBQUUsQ0FBQyxVQUFVLENBQUMsd0JBQX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iAgICAgICAgICAgICAgICAgICAgICBub2RlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gUmVjb3JkIGEgdHlwZSByZWZlcmVuY2UgdG8gYSBkZWNsYXJlZCB0eXBlIGFzIGEgc2VsZWN0LlxuICAgICAgICAgICAgICAgIHJldHVybiB7X19zeW1ib2xpYzogJ3NlbGVjdCcsIGV4cHJlc3Npb246IGxlZnQsIG1lbWJlcjogcXVhbGlmaWVkTmFtZS5yaWdodC50ZXh0fTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb25zdCBpZGVudGlmaWVyID0gPHRzLklkZW50aWZpZXI+dHlwZU5hbWVOb2RlO1xuICAgICAgICAgICAgICAgIGNvbnN0IHN5bWJvbCA9IHRoaXMuc3ltYm9scy5yZXNvbHZlKGlkZW50aWZpZXIudGV4dCk7XG4gICAgICAgICAgICAgICAgaWYgKGlzRm9sZGFibGVFcnJvcihzeW1ib2wpIHx8IGlzTWV0YWRhdGFTeW1ib2xpY1JlZmVyZW5jZUV4cHJlc3Npb24oc3ltYm9sKSkge1xuICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlY29yZEVudHJ5KHN5bWJvbCwgbm9kZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiByZWNvcmRFbnRyeShcbiAgICAgICAgICAgICAgICAgICAgZXJyb3JTeW1ib2woJ0NvdWxkIG5vdCByZXNvbHZlIHR5cGUnLCBub2RlLCB7dHlwZU5hbWU6IGlkZW50aWZpZXIudGV4dH0pLCBub2RlKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgY29uc3QgdHlwZVJlZmVyZW5jZSA9IGdldFJlZmVyZW5jZSh0eXBlTmFtZU5vZGUpO1xuICAgICAgICBpZiAoaXNGb2xkYWJsZUVycm9yKHR5cGVSZWZlcmVuY2UpKSB7XG4gICAgICAgICAgcmV0dXJuIHJlY29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tcbiAgICAgICAgICAgIGNhc2UgdHMuU3ludGF4S2luZC5FeGNsYW1hdGlvblRva2VuOlxuICAgICAgICAgICAgICByZXR1cm4gIW9wZXJhbmQ7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGxldCBvcGVyYXRvclRleHQ6ICcrJ3wnLSd8J34nfCchJztcbiAgICAgICAgc3dpdGNoIChwcmVmaXhVbmFyeUV4cHJlc3Npb24ub3BlcmF0b3IpIHtcbiAgICAgICAgICBjYXNlIHRzLlN5bnRheEtpbmQuUGx1c1Rva2VuOlxuICAgICAgICAgICAgb3BlcmF0b3JUZXh0ID0gJysnO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgY2FzZSB0cy5TeW50YXhLaW5kLk1pbnVzVG9rZW46XG4gICAgICAgICAgICBvcGVyYXRvclRleHQgPSAnLSc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBjYXNlIHRzLlN5bnRheEtpbmQuVGlsZGVUb2tlbjpcbiAgICAgICAgICAgIG9wZXJhdG9yVGV4dCA9ICd+JztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIGNhc2UgdHMuU3ludGF4S2luZC5FeGNsYW1hdGlvblRva2VuOlxuICAgICAgICAgICAgb3BlcmF0b3JUZXh0ID0gJyEnO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlY29yZEVudHJ5KHtfX3N5bWJvbGljOiAncHJlJywgb3BlcmF0b3I6IG9wZXJhdG9yVGV4dCwgb3BlcmFuZDogb3BlcmFuZH0sIG5vZGUpO1xuICAgICAgY2FzZSB0cy5TeW50YXhLaW5kLkJpbmFyeUV4cHJlc3Npb246XG4gICAgICAgIGNvbnN0IGJpbmFyeUV4cHJlc3Npb24gPSA8dHMuQmluYXJ5RXhwcmVzc2lvbj5ub2R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lxuICAgICAgICAgICAgICAgIHJldHVybiAoPGFueT5sZWZ0KSA8PCAoPGFueT5yaWdodCk7XG4gICAgICAgICAgICAgIGNhc2UgdHMuU3ludGF4S2luZC5HcmVhdGVyVGhhbkdyZWF0ZXJUaGFuVG9rZW46XG4gICAgICAgICAgICAgICAgcmV0dXJuIDxhbnk+bGVmdCA+PiA8YW55PnJpZ2h0O1xuICAgICAgICAgICAgICBjYXNlIHRzLlN5bnRheEtpbmQuR3JlYXRlclRoYW5HcmVhdGVyVGhhbkdyZWF0ZXJUaGFuVG9rZW46XG4gICAgICAgICAgICAgICAgcmV0dXJuIDxhbnk+bGVmdCA+Pj4gPGFueT5yaWdodDtcbiAgICAgICAgICAgICAgY2FzZSB0cy5TeW50YXhLaW5kLlBsdXNUb2tlbjpcbiAgICAgICAgICAgICAgICByZXR1cm4gPGFueT5sZWZ0ICsgPGFueT5yaWdodDtcbiAgICAgICAgICAgICAgY2FzZSB0cy5TeW50YXhLaW5kLk1pbnVzVG9rZW46XG4gICAgICAgICAgICAgICAgcmV0dXJuIDxhbnk+bGVmdCAtIDxhbnk+cmlnaHQ7XG4gICAgICAgICAgICAgIGNhc2UgdHMuU3ludGF4S2luZC5Bc3Rlcmlza1Rva2VuOlxuICAgICAgICAgICAgICAgIHJldHVybiA8YW55PmxlZnQgKiA8YW55PnJpZ2h0O1xuICAgICAgICAgICAgICBjYXNlIHRzLlN5bnRheEtpbmQuU2xhc2hUb2tlbjpcbiAgICAgICAgICAgICAgICByZXR1cm4gPGFueT5sZWZ0IC8gPGFueT5yaWdodDtcbiAgICAgICAgICAgICAgY2FzZSB0cy5TeW50YXhLaW5kLlBlcmNlbnRUb2tlbjpcbiAgICAgICAgICAgICAgICByZXR1cm4gPGFueT5sZWZ0ICUgPGFueT5yaWdodDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICByZXR1cm4gcmVjb3JkRW50cnkoXG4gICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICBfX3N5bWJvbG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Y29uc3QgZXhwciA9IHRoaXMuZXZhbHVhdGVOb2RlKGN1cnJlbnQuZXhwcmVzc2lvbik7XG4gICAgICAgICAgICBjb25zdCBsaXRlcmFsID0gdGhpcy5ldmFsdWF0ZU5vZGUoY3VycmVudC5saXRlcmFsKTtcbiAgICAgICAgICAgIGlmIChpc0ZvbGRhYmxlRXJyb3IoZXhwcikpIHJldHVybiBleHByO1xuICAgICAgICAgICAgaWYgKGlzRm9sZGFibGVFcnJvcihsaXRlcmFsKSkgcmV0dXJuIGxpdGVyYWw7XG4gICAgICAgICAgICBpZiAodHlwZW9mIHByZXZpb3VzID09PSAnc3RyaW5nJyAmJiB0eXBlb2YgZXhwciA9PT0gJ3N0cmluZycgJiZcbiAgICAgICAgICAgICAgICB0eXBlb2YgbGl0ZXJhbCA9PT0gJ3N0cmluZycpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIHByZXZpb3VzICsgZXhwciArIGxpdGVyYWw7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsZXQgcmVzdWx0ID0gZXhwcjtcbiAgICAgICAgICAgIGlmIChwcmV2aW91cyAhPT0gJycpIHtcbiAgICAgICAgICAgICAgcmVzdWx0ID0ge19fc3ltYm9saWM6ICdiaW5vcCcsIG9wZXJhdG9yOiAnKycsIGxlZnQ6IHByZXZpb3VzLCByaWdodDogZXhwcn07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobGl0ZXJhbCAhPSAnJykge1xuICAgICAgICAgICAgICByZXN1bHQgPSB7X19zeW1ib2xpYzogJ2Jpbm9wJywgb3BlcmF0b3I6ICcrJywgbGVmdDogcmVzdWx0LCByaWdodDogbGl0ZXJhbH07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICAgIH0sIHRoaXMuZXZhbHVhdGVOb2RlKHRlbXBsYXRlRXhwcmVzc2lvbi5oZWFkKSk7XG4gICAgICAgIH1cbiAgICAgIGNhc2UgdHMuU3ludGF4S2luZC5Bc0V4cHJlc3Npb246XG4gICAgICAgIGNvbnN0IGFzRXhwcmVzc2lvbiA9IDx0cy5Bc0V4cHJlc3Npb24+bm9kZTtcbiAgICAgICAgcmV0dXJuIHRoaXMuZXZhbHVhdGVOb2RlKGFzRXhwcmVzc2lvbi5leHByZXNzaW9uKTtcbiAgICAgIGNhc2UgdHMuU3ludGF4S2luZC5DbGFzc0V4cHJlc3Npb246XG4gICAgICAgIHJldHVybiB7X19zeW1ib2xpYzogJ2NsYXNzJ307XG4gICAgfVxuICAgIHJldHVybiByZWNvcmRFbnRyeShlcnJvclN5bWJvbCgnRXhwcmVzc2lvbiBmb3JtIG5vdCBzdXBwb3J0ZWQnLCBub2RlKSwgbm9kZSk7XG4gIH1cbn1cblxuZnVuY3Rpb24gaXNQcm9wZXJ0eUFzc2lnbm1lbnQobm9kZTogdHMuTm9kZSk6IG5vZGUgaXMgdHMuUHJvcGVydHlBc3NpZ25tZW50IHtcbiAgcmV0dXJuIG5vZGUua2luZCA9PSB0cy5TeW50YXhLaW5kLlByb3BlcnR5QXNzaWdubWVudDtcbn1cblxuY29uc3QgZW1wdHkgPSB0cy5jcmVhdGVOb2RlQXJyYXk8YW55PigpO1xuXG5mdW5jdGlvbiBhcnJheU9yRW1wdHk8VCBleHRlbmRzIHRzLk5vZGU+KHY6IHRzLk5vZGVBcnJheTxUPnx1bmRlZmluZWQpOiB0cy5Ob2RlQXJyYXk8VD4ge1xuICByZXR1cm4gdiB8fCBlbXB0eTtcbn1cbiJdfQ==
Note: See TracBrowser for help on using the repository browser.