source: trip-planner-front/node_modules/@angular/compiler-cli/src/metadata/collector.js@ 8d391a1

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

initial commit

  • Property mode set to 100644
File size: 117.3 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/collector", ["require", "exports", "tslib", "typescript", "@angular/compiler-cli/src/metadata/evaluator", "@angular/compiler-cli/src/metadata/schema", "@angular/compiler-cli/src/metadata/symbols"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.MetadataCollector = void 0;
20 var tslib_1 = require("tslib");
21 var ts = require("typescript");
22 var evaluator_1 = require("@angular/compiler-cli/src/metadata/evaluator");
23 var schema_1 = require("@angular/compiler-cli/src/metadata/schema");
24 var symbols_1 = require("@angular/compiler-cli/src/metadata/symbols");
25 var isStatic = function (node) {
26 return ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Static;
27 };
28 /**
29 * Collect decorator metadata from a TypeScript module.
30 */
31 var MetadataCollector = /** @class */ (function () {
32 function MetadataCollector(options) {
33 if (options === void 0) { options = {}; }
34 this.options = options;
35 }
36 /**
37 * Returns a JSON.stringify friendly form describing the decorators of the exported classes from
38 * the source file that is expected to correspond to a module.
39 */
40 MetadataCollector.prototype.getMetadata = function (sourceFile, strict, substituteExpression) {
41 var _this = this;
42 if (strict === void 0) { strict = false; }
43 var locals = new symbols_1.Symbols(sourceFile);
44 var nodeMap = new Map();
45 var composedSubstituter = substituteExpression && this.options.substituteExpression ?
46 function (value, node) {
47 return _this.options.substituteExpression(substituteExpression(value, node), node);
48 } :
49 substituteExpression;
50 var evaluatorOptions = substituteExpression ? tslib_1.__assign(tslib_1.__assign({}, this.options), { substituteExpression: composedSubstituter }) :
51 this.options;
52 var metadata;
53 var evaluator = new evaluator_1.Evaluator(locals, nodeMap, evaluatorOptions, function (name, value) {
54 if (!metadata)
55 metadata = {};
56 metadata[name] = value;
57 });
58 var exports = undefined;
59 function objFromDecorator(decoratorNode) {
60 return evaluator.evaluateNode(decoratorNode.expression);
61 }
62 function recordEntry(entry, node) {
63 if (composedSubstituter) {
64 entry = composedSubstituter(entry, node);
65 }
66 return evaluator_1.recordMapEntry(entry, node, nodeMap, sourceFile);
67 }
68 function errorSym(message, node, context) {
69 return evaluator_1.errorSymbol(message, node, context, sourceFile);
70 }
71 function maybeGetSimpleFunction(functionDeclaration) {
72 if (functionDeclaration.name && functionDeclaration.name.kind == ts.SyntaxKind.Identifier) {
73 var nameNode = functionDeclaration.name;
74 var functionName = nameNode.text;
75 var functionBody = functionDeclaration.body;
76 if (functionBody && functionBody.statements.length == 1) {
77 var statement = functionBody.statements[0];
78 if (statement.kind === ts.SyntaxKind.ReturnStatement) {
79 var returnStatement = statement;
80 if (returnStatement.expression) {
81 var func = {
82 __symbolic: 'function',
83 parameters: namesOf(functionDeclaration.parameters),
84 value: evaluator.evaluateNode(returnStatement.expression)
85 };
86 if (functionDeclaration.parameters.some(function (p) { return p.initializer != null; })) {
87 func.defaults = functionDeclaration.parameters.map(function (p) { return p.initializer && evaluator.evaluateNode(p.initializer); });
88 }
89 return recordEntry({ func: func, name: functionName }, functionDeclaration);
90 }
91 }
92 }
93 }
94 }
95 function classMetadataOf(classDeclaration) {
96 var e_1, _a, e_2, _b;
97 var result = { __symbolic: 'class' };
98 function getDecorators(decorators) {
99 if (decorators && decorators.length)
100 return decorators.map(function (decorator) { return objFromDecorator(decorator); });
101 return undefined;
102 }
103 function referenceFrom(node) {
104 var result = evaluator.evaluateNode(node);
105 if (schema_1.isMetadataError(result) || schema_1.isMetadataSymbolicReferenceExpression(result) ||
106 schema_1.isMetadataSymbolicSelectExpression(result)) {
107 return result;
108 }
109 else {
110 return errorSym('Symbol reference expected', node);
111 }
112 }
113 // Add class parents
114 if (classDeclaration.heritageClauses) {
115 classDeclaration.heritageClauses.forEach(function (hc) {
116 if (hc.token === ts.SyntaxKind.ExtendsKeyword && hc.types) {
117 hc.types.forEach(function (type) { return result.extends = referenceFrom(type.expression); });
118 }
119 });
120 }
121 // Add arity if the type is generic
122 var typeParameters = classDeclaration.typeParameters;
123 if (typeParameters && typeParameters.length) {
124 result.arity = typeParameters.length;
125 }
126 // Add class decorators
127 if (classDeclaration.decorators) {
128 result.decorators = getDecorators(classDeclaration.decorators);
129 }
130 // member decorators
131 var members = null;
132 function recordMember(name, metadata) {
133 if (!members)
134 members = {};
135 var data = members.hasOwnProperty(name) ? members[name] : [];
136 data.push(metadata);
137 members[name] = data;
138 }
139 // static member
140 var statics = null;
141 function recordStaticMember(name, value) {
142 if (!statics)
143 statics = {};
144 statics[name] = value;
145 }
146 try {
147 for (var _c = tslib_1.__values(classDeclaration.members), _d = _c.next(); !_d.done; _d = _c.next()) {
148 var member = _d.value;
149 var isConstructor = false;
150 switch (member.kind) {
151 case ts.SyntaxKind.Constructor:
152 case ts.SyntaxKind.MethodDeclaration:
153 isConstructor = member.kind === ts.SyntaxKind.Constructor;
154 var method = member;
155 if (isStatic(method)) {
156 var maybeFunc = maybeGetSimpleFunction(method);
157 if (maybeFunc) {
158 recordStaticMember(maybeFunc.name, maybeFunc.func);
159 }
160 continue;
161 }
162 var methodDecorators = getDecorators(method.decorators);
163 var parameters = method.parameters;
164 var parameterDecoratorData = [];
165 var parametersData = [];
166 var hasDecoratorData = false;
167 var hasParameterData = false;
168 try {
169 for (var parameters_1 = (e_2 = void 0, tslib_1.__values(parameters)), parameters_1_1 = parameters_1.next(); !parameters_1_1.done; parameters_1_1 = parameters_1.next()) {
170 var parameter = parameters_1_1.value;
171 var parameterData = getDecorators(parameter.decorators);
172 parameterDecoratorData.push(parameterData);
173 hasDecoratorData = hasDecoratorData || !!parameterData;
174 if (isConstructor) {
175 if (parameter.type) {
176 parametersData.push(referenceFrom(parameter.type));
177 }
178 else {
179 parametersData.push(null);
180 }
181 hasParameterData = true;
182 }
183 }
184 }
185 catch (e_2_1) { e_2 = { error: e_2_1 }; }
186 finally {
187 try {
188 if (parameters_1_1 && !parameters_1_1.done && (_b = parameters_1.return)) _b.call(parameters_1);
189 }
190 finally { if (e_2) throw e_2.error; }
191 }
192 var data = { __symbolic: isConstructor ? 'constructor' : 'method' };
193 var name = isConstructor ? '__ctor__' : evaluator.nameOf(member.name);
194 if (methodDecorators) {
195 data.decorators = methodDecorators;
196 }
197 if (hasDecoratorData) {
198 data.parameterDecorators = parameterDecoratorData;
199 }
200 if (hasParameterData) {
201 data.parameters = parametersData;
202 }
203 if (!schema_1.isMetadataError(name)) {
204 recordMember(name, data);
205 }
206 break;
207 case ts.SyntaxKind.PropertyDeclaration:
208 case ts.SyntaxKind.GetAccessor:
209 case ts.SyntaxKind.SetAccessor:
210 var property = member;
211 if (isStatic(property)) {
212 var name_1 = evaluator.nameOf(property.name);
213 if (!schema_1.isMetadataError(name_1) && !shouldIgnoreStaticMember(name_1)) {
214 if (property.initializer) {
215 var value = evaluator.evaluateNode(property.initializer);
216 recordStaticMember(name_1, value);
217 }
218 else {
219 recordStaticMember(name_1, errorSym('Variable not initialized', property.name));
220 }
221 }
222 }
223 var propertyDecorators = getDecorators(property.decorators);
224 if (propertyDecorators) {
225 var name_2 = evaluator.nameOf(property.name);
226 if (!schema_1.isMetadataError(name_2)) {
227 recordMember(name_2, { __symbolic: 'property', decorators: propertyDecorators });
228 }
229 }
230 break;
231 }
232 }
233 }
234 catch (e_1_1) { e_1 = { error: e_1_1 }; }
235 finally {
236 try {
237 if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
238 }
239 finally { if (e_1) throw e_1.error; }
240 }
241 if (members) {
242 result.members = members;
243 }
244 if (statics) {
245 result.statics = statics;
246 }
247 return recordEntry(result, classDeclaration);
248 }
249 // Collect all exported symbols from an exports clause.
250 var exportMap = new Map();
251 ts.forEachChild(sourceFile, function (node) {
252 switch (node.kind) {
253 case ts.SyntaxKind.ExportDeclaration:
254 var exportDeclaration = node;
255 var moduleSpecifier = exportDeclaration.moduleSpecifier, exportClause = exportDeclaration.exportClause;
256 if (!moduleSpecifier && exportClause && ts.isNamedExports(exportClause)) {
257 // If there is a module specifier there is also an exportClause
258 exportClause.elements.forEach(function (spec) {
259 var exportedAs = spec.name.text;
260 var name = (spec.propertyName || spec.name).text;
261 exportMap.set(name, exportedAs);
262 });
263 }
264 }
265 });
266 var isExport = function (node) { return sourceFile.isDeclarationFile ||
267 ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export; };
268 var isExportedIdentifier = function (identifier) {
269 return identifier && exportMap.has(identifier.text);
270 };
271 var isExported = function (node) {
272 return isExport(node) || isExportedIdentifier(node.name);
273 };
274 var exportedIdentifierName = function (identifier) {
275 return identifier && (exportMap.get(identifier.text) || identifier.text);
276 };
277 var exportedName = function (node) {
278 return exportedIdentifierName(node.name);
279 };
280 // Pre-declare classes and functions
281 ts.forEachChild(sourceFile, function (node) {
282 switch (node.kind) {
283 case ts.SyntaxKind.ClassDeclaration:
284 var classDeclaration = node;
285 if (classDeclaration.name) {
286 var className = classDeclaration.name.text;
287 if (isExported(classDeclaration)) {
288 locals.define(className, { __symbolic: 'reference', name: exportedName(classDeclaration) });
289 }
290 else {
291 locals.define(className, errorSym('Reference to non-exported class', node, { className: className }));
292 }
293 }
294 break;
295 case ts.SyntaxKind.InterfaceDeclaration:
296 var interfaceDeclaration = node;
297 if (interfaceDeclaration.name) {
298 var interfaceName = interfaceDeclaration.name.text;
299 // All references to interfaces should be converted to references to `any`.
300 locals.define(interfaceName, { __symbolic: 'reference', name: 'any' });
301 }
302 break;
303 case ts.SyntaxKind.FunctionDeclaration:
304 var functionDeclaration = node;
305 if (!isExported(functionDeclaration)) {
306 // Report references to this function as an error.
307 var nameNode = functionDeclaration.name;
308 if (nameNode && nameNode.text) {
309 locals.define(nameNode.text, errorSym('Reference to a non-exported function', nameNode, { name: nameNode.text }));
310 }
311 }
312 break;
313 }
314 });
315 ts.forEachChild(sourceFile, function (node) {
316 var e_3, _a, e_4, _b;
317 switch (node.kind) {
318 case ts.SyntaxKind.ExportDeclaration:
319 // Record export declarations
320 var exportDeclaration = node;
321 var moduleSpecifier = exportDeclaration.moduleSpecifier, exportClause = exportDeclaration.exportClause;
322 if (!moduleSpecifier) {
323 // no module specifier -> export {propName as name};
324 if (exportClause && ts.isNamedExports(exportClause)) {
325 exportClause.elements.forEach(function (spec) {
326 var name = spec.name.text;
327 // If the symbol was not already exported, export a reference since it is a
328 // reference to an import
329 if (!metadata || !metadata[name]) {
330 var propNode = spec.propertyName || spec.name;
331 var value = evaluator.evaluateNode(propNode);
332 if (!metadata)
333 metadata = {};
334 metadata[name] = recordEntry(value, node);
335 }
336 });
337 }
338 }
339 if (moduleSpecifier && moduleSpecifier.kind == ts.SyntaxKind.StringLiteral) {
340 // Ignore exports that don't have string literals as exports.
341 // This is allowed by the syntax but will be flagged as an error by the type checker.
342 var from = moduleSpecifier.text;
343 var moduleExport = { from: from };
344 if (exportClause && ts.isNamedExports(exportClause)) {
345 moduleExport.export = exportClause.elements.map(function (spec) { return spec.propertyName ? { name: spec.propertyName.text, as: spec.name.text } :
346 spec.name.text; });
347 }
348 if (!exports)
349 exports = [];
350 exports.push(moduleExport);
351 }
352 break;
353 case ts.SyntaxKind.ClassDeclaration:
354 var classDeclaration = node;
355 if (classDeclaration.name) {
356 if (isExported(classDeclaration)) {
357 var name = exportedName(classDeclaration);
358 if (name) {
359 if (!metadata)
360 metadata = {};
361 metadata[name] = classMetadataOf(classDeclaration);
362 }
363 }
364 }
365 // Otherwise don't record metadata for the class.
366 break;
367 case ts.SyntaxKind.TypeAliasDeclaration:
368 var typeDeclaration = node;
369 if (typeDeclaration.name && isExported(typeDeclaration)) {
370 var name = exportedName(typeDeclaration);
371 if (name) {
372 if (!metadata)
373 metadata = {};
374 metadata[name] = { __symbolic: 'interface' };
375 }
376 }
377 break;
378 case ts.SyntaxKind.InterfaceDeclaration:
379 var interfaceDeclaration = node;
380 if (interfaceDeclaration.name && isExported(interfaceDeclaration)) {
381 var name = exportedName(interfaceDeclaration);
382 if (name) {
383 if (!metadata)
384 metadata = {};
385 metadata[name] = { __symbolic: 'interface' };
386 }
387 }
388 break;
389 case ts.SyntaxKind.FunctionDeclaration:
390 // Record functions that return a single value. Record the parameter
391 // names substitution will be performed by the StaticReflector.
392 var functionDeclaration = node;
393 if (isExported(functionDeclaration) && functionDeclaration.name) {
394 var name = exportedName(functionDeclaration);
395 var maybeFunc = maybeGetSimpleFunction(functionDeclaration);
396 if (name) {
397 if (!metadata)
398 metadata = {};
399 // TODO(alxhub): The literal here is not valid FunctionMetadata.
400 metadata[name] =
401 maybeFunc ? recordEntry(maybeFunc.func, node) : { __symbolic: 'function' };
402 }
403 }
404 break;
405 case ts.SyntaxKind.EnumDeclaration:
406 var enumDeclaration = node;
407 if (isExported(enumDeclaration)) {
408 var enumValueHolder = {};
409 var enumName = exportedName(enumDeclaration);
410 var nextDefaultValue = 0;
411 var writtenMembers = 0;
412 try {
413 for (var _c = tslib_1.__values(enumDeclaration.members), _d = _c.next(); !_d.done; _d = _c.next()) {
414 var member = _d.value;
415 var enumValue = void 0;
416 if (!member.initializer) {
417 enumValue = nextDefaultValue;
418 }
419 else {
420 enumValue = evaluator.evaluateNode(member.initializer);
421 }
422 var name = undefined;
423 if (member.name.kind == ts.SyntaxKind.Identifier) {
424 var identifier = member.name;
425 name = identifier.text;
426 enumValueHolder[name] = enumValue;
427 writtenMembers++;
428 }
429 if (typeof enumValue === 'number') {
430 nextDefaultValue = enumValue + 1;
431 }
432 else if (name) {
433 // TODO(alxhub): 'left' here has a name propery which is not valid for
434 // MetadataSymbolicSelectExpression.
435 nextDefaultValue = {
436 __symbolic: 'binary',
437 operator: '+',
438 left: {
439 __symbolic: 'select',
440 expression: recordEntry({ __symbolic: 'reference', name: enumName }, node),
441 name: name
442 },
443 };
444 }
445 else {
446 nextDefaultValue =
447 recordEntry(errorSym('Unsupported enum member name', member.name), node);
448 }
449 }
450 }
451 catch (e_3_1) { e_3 = { error: e_3_1 }; }
452 finally {
453 try {
454 if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
455 }
456 finally { if (e_3) throw e_3.error; }
457 }
458 if (writtenMembers) {
459 if (enumName) {
460 if (!metadata)
461 metadata = {};
462 metadata[enumName] = recordEntry(enumValueHolder, node);
463 }
464 }
465 }
466 break;
467 case ts.SyntaxKind.VariableStatement:
468 var variableStatement = node;
469 var _loop_1 = function (variableDeclaration) {
470 if (variableDeclaration.name.kind == ts.SyntaxKind.Identifier) {
471 var nameNode = variableDeclaration.name;
472 var varValue = void 0;
473 if (variableDeclaration.initializer) {
474 varValue = evaluator.evaluateNode(variableDeclaration.initializer);
475 }
476 else {
477 varValue = recordEntry(errorSym('Variable not initialized', nameNode), nameNode);
478 }
479 var exported = false;
480 if (isExport(variableStatement) || isExport(variableDeclaration) ||
481 isExportedIdentifier(nameNode)) {
482 var name = exportedIdentifierName(nameNode);
483 if (name) {
484 if (!metadata)
485 metadata = {};
486 metadata[name] = recordEntry(varValue, node);
487 }
488 exported = true;
489 }
490 if (typeof varValue == 'string' || typeof varValue == 'number' ||
491 typeof varValue == 'boolean') {
492 locals.define(nameNode.text, varValue);
493 if (exported) {
494 locals.defineReference(nameNode.text, { __symbolic: 'reference', name: nameNode.text });
495 }
496 }
497 else if (!exported) {
498 if (varValue && !schema_1.isMetadataError(varValue)) {
499 locals.define(nameNode.text, recordEntry(varValue, node));
500 }
501 else {
502 locals.define(nameNode.text, recordEntry(errorSym('Reference to a local symbol', nameNode, { name: nameNode.text }), node));
503 }
504 }
505 }
506 else {
507 // Destructuring (or binding) declarations are not supported,
508 // var {<identifier>[, <identifier>]+} = <expression>;
509 // or
510 // var [<identifier>[, <identifier}+] = <expression>;
511 // are not supported.
512 var report_1 = function (nameNode) {
513 switch (nameNode.kind) {
514 case ts.SyntaxKind.Identifier:
515 var name = nameNode;
516 var varValue = errorSym('Destructuring not supported', name);
517 locals.define(name.text, varValue);
518 if (isExport(node)) {
519 if (!metadata)
520 metadata = {};
521 metadata[name.text] = varValue;
522 }
523 break;
524 case ts.SyntaxKind.BindingElement:
525 var bindingElement = nameNode;
526 report_1(bindingElement.name);
527 break;
528 case ts.SyntaxKind.ObjectBindingPattern:
529 case ts.SyntaxKind.ArrayBindingPattern:
530 var bindings = nameNode;
531 bindings.elements.forEach(report_1);
532 break;
533 }
534 };
535 report_1(variableDeclaration.name);
536 }
537 };
538 try {
539 for (var _e = tslib_1.__values(variableStatement.declarationList.declarations), _f = _e.next(); !_f.done; _f = _e.next()) {
540 var variableDeclaration = _f.value;
541 _loop_1(variableDeclaration);
542 }
543 }
544 catch (e_4_1) { e_4 = { error: e_4_1 }; }
545 finally {
546 try {
547 if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
548 }
549 finally { if (e_4) throw e_4.error; }
550 }
551 break;
552 }
553 });
554 if (metadata || exports) {
555 if (!metadata)
556 metadata = {};
557 else if (strict) {
558 validateMetadata(sourceFile, nodeMap, metadata);
559 }
560 var result = {
561 __symbolic: 'module',
562 version: this.options.version || schema_1.METADATA_VERSION,
563 metadata: metadata
564 };
565 if (sourceFile.moduleName)
566 result.importAs = sourceFile.moduleName;
567 if (exports)
568 result.exports = exports;
569 return result;
570 }
571 };
572 return MetadataCollector;
573 }());
574 exports.MetadataCollector = MetadataCollector;
575 // This will throw if the metadata entry given contains an error node.
576 function validateMetadata(sourceFile, nodeMap, metadata) {
577 var locals = new Set(['Array', 'Object', 'Set', 'Map', 'string', 'number', 'any']);
578 function validateExpression(expression) {
579 if (!expression) {
580 return;
581 }
582 else if (Array.isArray(expression)) {
583 expression.forEach(validateExpression);
584 }
585 else if (typeof expression === 'object' && !expression.hasOwnProperty('__symbolic')) {
586 Object.getOwnPropertyNames(expression).forEach(function (v) { return validateExpression(expression[v]); });
587 }
588 else if (schema_1.isMetadataError(expression)) {
589 reportError(expression);
590 }
591 else if (schema_1.isMetadataGlobalReferenceExpression(expression)) {
592 if (!locals.has(expression.name)) {
593 var reference = metadata[expression.name];
594 if (reference) {
595 validateExpression(reference);
596 }
597 }
598 }
599 else if (schema_1.isFunctionMetadata(expression)) {
600 validateFunction(expression);
601 }
602 else if (schema_1.isMetadataSymbolicExpression(expression)) {
603 switch (expression.__symbolic) {
604 case 'binary':
605 var binaryExpression = expression;
606 validateExpression(binaryExpression.left);
607 validateExpression(binaryExpression.right);
608 break;
609 case 'call':
610 case 'new':
611 var callExpression = expression;
612 validateExpression(callExpression.expression);
613 if (callExpression.arguments)
614 callExpression.arguments.forEach(validateExpression);
615 break;
616 case 'index':
617 var indexExpression = expression;
618 validateExpression(indexExpression.expression);
619 validateExpression(indexExpression.index);
620 break;
621 case 'pre':
622 var prefixExpression = expression;
623 validateExpression(prefixExpression.operand);
624 break;
625 case 'select':
626 var selectExpression = expression;
627 validateExpression(selectExpression.expression);
628 break;
629 case 'spread':
630 var spreadExpression = expression;
631 validateExpression(spreadExpression.expression);
632 break;
633 case 'if':
634 var ifExpression = expression;
635 validateExpression(ifExpression.condition);
636 validateExpression(ifExpression.elseExpression);
637 validateExpression(ifExpression.thenExpression);
638 break;
639 }
640 }
641 }
642 function validateMember(classData, member) {
643 if (member.decorators) {
644 member.decorators.forEach(validateExpression);
645 }
646 if (schema_1.isMethodMetadata(member) && member.parameterDecorators) {
647 member.parameterDecorators.forEach(validateExpression);
648 }
649 // Only validate parameters of classes for which we know that are used with our DI
650 if (classData.decorators && schema_1.isConstructorMetadata(member) && member.parameters) {
651 member.parameters.forEach(validateExpression);
652 }
653 }
654 function validateClass(classData) {
655 if (classData.decorators) {
656 classData.decorators.forEach(validateExpression);
657 }
658 if (classData.members) {
659 Object.getOwnPropertyNames(classData.members)
660 .forEach(function (name) { return classData.members[name].forEach(function (m) { return validateMember(classData, m); }); });
661 }
662 if (classData.statics) {
663 Object.getOwnPropertyNames(classData.statics).forEach(function (name) {
664 var staticMember = classData.statics[name];
665 if (schema_1.isFunctionMetadata(staticMember)) {
666 validateExpression(staticMember.value);
667 }
668 else {
669 validateExpression(staticMember);
670 }
671 });
672 }
673 }
674 function validateFunction(functionDeclaration) {
675 if (functionDeclaration.value) {
676 var oldLocals = locals;
677 if (functionDeclaration.parameters) {
678 locals = new Set(oldLocals.values());
679 if (functionDeclaration.parameters)
680 functionDeclaration.parameters.forEach(function (n) { return locals.add(n); });
681 }
682 validateExpression(functionDeclaration.value);
683 locals = oldLocals;
684 }
685 }
686 function shouldReportNode(node) {
687 if (node) {
688 var nodeStart = node.getStart();
689 return !(node.pos != nodeStart &&
690 sourceFile.text.substring(node.pos, nodeStart).indexOf('@dynamic') >= 0);
691 }
692 return true;
693 }
694 function reportError(error) {
695 var node = nodeMap.get(error);
696 if (shouldReportNode(node)) {
697 var lineInfo = error.line != undefined ? error.character != undefined ?
698 ":" + (error.line + 1) + ":" + (error.character + 1) :
699 ":" + (error.line + 1) :
700 '';
701 throw new Error("" + sourceFile.fileName + lineInfo + ": Metadata collected contains an error that will be reported at runtime: " + expandedMessage(error) + ".\n " + JSON.stringify(error));
702 }
703 }
704 Object.getOwnPropertyNames(metadata).forEach(function (name) {
705 var entry = metadata[name];
706 try {
707 if (schema_1.isClassMetadata(entry)) {
708 validateClass(entry);
709 }
710 }
711 catch (e) {
712 var node = nodeMap.get(entry);
713 if (shouldReportNode(node)) {
714 if (node) {
715 var _a = sourceFile.getLineAndCharacterOfPosition(node.getStart()), line = _a.line, character = _a.character;
716 throw new Error(sourceFile.fileName + ":" + (line + 1) + ":" + (character + 1) + ": Error encountered in metadata generated for exported symbol '" + name + "': \n " + e.message);
717 }
718 throw new Error("Error encountered in metadata generated for exported symbol " + name + ": \n " + e.message);
719 }
720 }
721 });
722 }
723 // Collect parameter names from a function.
724 function namesOf(parameters) {
725 var e_5, _a;
726 var result = [];
727 function addNamesOf(name) {
728 var e_6, _a;
729 if (name.kind == ts.SyntaxKind.Identifier) {
730 var identifier = name;
731 result.push(identifier.text);
732 }
733 else {
734 var bindingPattern = name;
735 try {
736 for (var _b = tslib_1.__values(bindingPattern.elements), _c = _b.next(); !_c.done; _c = _b.next()) {
737 var element = _c.value;
738 var name_3 = element.name;
739 if (name_3) {
740 addNamesOf(name_3);
741 }
742 }
743 }
744 catch (e_6_1) { e_6 = { error: e_6_1 }; }
745 finally {
746 try {
747 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
748 }
749 finally { if (e_6) throw e_6.error; }
750 }
751 }
752 }
753 try {
754 for (var parameters_2 = tslib_1.__values(parameters), parameters_2_1 = parameters_2.next(); !parameters_2_1.done; parameters_2_1 = parameters_2.next()) {
755 var parameter = parameters_2_1.value;
756 addNamesOf(parameter.name);
757 }
758 }
759 catch (e_5_1) { e_5 = { error: e_5_1 }; }
760 finally {
761 try {
762 if (parameters_2_1 && !parameters_2_1.done && (_a = parameters_2.return)) _a.call(parameters_2);
763 }
764 finally { if (e_5) throw e_5.error; }
765 }
766 return result;
767 }
768 function shouldIgnoreStaticMember(memberName) {
769 return memberName.startsWith('ngAcceptInputType_') || memberName.startsWith('ngTemplateGuard_');
770 }
771 function expandedMessage(error) {
772 switch (error.message) {
773 case 'Reference to non-exported class':
774 if (error.context && error.context.className) {
775 return "Reference to a non-exported class " + error.context.className + ". Consider exporting the class";
776 }
777 break;
778 case 'Variable not initialized':
779 return 'Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler';
780 case 'Destructuring not supported':
781 return 'Referencing an exported destructured variable or constant is not supported by the template compiler. Consider simplifying this to avoid destructuring';
782 case 'Could not resolve type':
783 if (error.context && error.context.typeName) {
784 return "Could not resolve type " + error.context.typeName;
785 }
786 break;
787 case 'Function call not supported':
788 var prefix = error.context && error.context.name ? "Calling function '" + error.context.name + "', f" : 'F';
789 return prefix +
790 'unction calls are not supported. Consider replacing the function or lambda with a reference to an exported function';
791 case 'Reference to a local symbol':
792 if (error.context && error.context.name) {
793 return "Reference to a local (non-exported) symbol '" + error.context.name + "'. Consider exporting the symbol";
794 }
795 }
796 return error.message;
797 }
798});
799//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sbGVjdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZXItY2xpL3NyYy9tZXRhZGF0YS9jb2xsZWN0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOzs7Ozs7Ozs7Ozs7OztJQUVILCtCQUFpQztJQUVqQywwRUFBbUU7SUFDbkUsb0VBQXUxQjtJQUN2MUIsc0VBQWtDO0lBRWxDLElBQU0sUUFBUSxHQUFHLFVBQUMsSUFBb0I7UUFDbEMsT0FBQSxFQUFFLENBQUMsd0JBQXdCLENBQUMsSUFBSSxDQUFDLEdBQUcsRUFBRSxDQUFDLGFBQWEsQ0FBQyxNQUFNO0lBQTNELENBQTJELENBQUM7SUE0QmhFOztPQUVHO0lBQ0g7UUFDRSwyQkFBb0IsT0FBOEI7WUFBOUIsd0JBQUEsRUFBQSxZQUE4QjtZQUE5QixZQUFPLEdBQVAsT0FBTyxDQUF1QjtRQUFHLENBQUM7UUFFdEQ7OztXQUdHO1FBQ0ksdUNBQVcsR0FBbEIsVUFDSSxVQUF5QixFQUFFLE1BQXVCLEVBQ2xELG9CQUE2RTtZQUZqRixpQkE4ZkM7WUE3ZjhCLHVCQUFBLEVBQUEsY0FBdUI7WUFHcEQsSUFBTSxNQUFNLEdBQUcsSUFBSSxpQkFBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO1lBQ3ZDLElBQU0sT0FBTyxHQUNULElBQUksR0FBRyxFQUEyRSxDQUFDO1lBQ3ZGLElBQU0sbUJBQW1CLEdBQUcsb0JBQW9CLElBQUksSUFBSSxDQUFDLE9BQU8sQ0FBQyxvQkF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aWNzID0ge307XG4gICAgICAgIHN0YXRpY3NbbmFtZV0gPSB2YWx1ZTtcbiAgICAgIH1cblxuICAgICAgZm9yIChjb25zdCBtZW1iZXIgb2YgY2xhc3NEZWNsYXJhdGlvbi5tZW1iZXJzKSB7XG4gICAgICAgIGxldCBpc0NvbnN0cnVjdG9yID0gZmFsc2U7XG4gICAgICAgIHN3aXRjaCAobWVtYmVyLmtpbmQpIHtcbiAgICAgICAgICBjYXNlIHRzLlN5bnRheEtpbmQuQ29uc3RydWN0b3I6XG4gICAgICAgICAgY2FzZSB0cy5TeW50YXhLaW5kLk1ldGhvZERlY2xhcmF0aW9uOlxuICAgICAgICAgICAgaXNDb25zdHJ1Y3RvciA9IG1lbWJlci5raW5kID09PSB0cy5TeW50YXhLaW5kLkNvbnN0cnVjdG9yO1xuICAgICAgICAgICAgY29uc3QgbWV0aG9kID0gPHRzLk1ldGhvZERlY2xhcmF0aW9ufHRzLkNvbnN0cnVjdG9yRGVjbGFyYXRpb24+bWVtYmVyO1xuICAgICAgICAgICAgaWYgKGlzU3RhdGljKG1ldGhvZCkpIHtcbiAgICAgICAgICAgICAgY29uc3QgbWF5YmVGdW5jID0gbWF5YmVHZXRTaW1wbGVGdW5jdGlvbig8dHMuTWV0aG9kRGVjbGFyYXRpb24+bWV0aG9kKTtcbiAgICAgICAgICAgICAgaWYgKG1heWJlRnVuYykge1xuICAgICAgICAgICAgICAgIHJlY29yZFN0YXRpY01lbWJlcihtYXliZUZ1bmMubmFtZSwgbWF5YmVGdW5jLmZ1bmMpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29uc3QgbWV0aG9kRGVjb3JhdG9ycyA9IGdldERlY29yYXRvcnMobWV0aG9kLmRlY29yYXRvcnMpO1xuICAgICAgICAgICAgY29uc3QgcGFyYW1ldGVycyA9IG1ldGhvZC5wYXJhbWV0ZXJzO1xuICAgICAgICAgICAgY29uc3QgcGFyYW1ldGVyRGVjb3JhdG9yRGF0YTogKChNZXRhZGF0YVN5bWJvbGljRXhwcmVzc2lvbiB8IE1ldGFkYXRhRXJyb3IpW118XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5kZWZpbmVkKVtdID0gW107XG4gICAgICAgICAgICBjb25zdCBwYXJhbWV0ZXJzRGF0YTogKE1ldGFkYXRhU3ltYm9saWNSZWZlcmVuY2VFeHByZXNzaW9ufE1ldGFkYXRhRXJyb3J8XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1ldGFkYXRhU3ltYm9saWNTZWxlY3RFeHByZXNzaW9ufG51bGwpW10gPSBbXTtcbiAgICAgICAgICAgIGxldCBoYXNEZWNvcmF0b3JEYXRhOiBib29sZWFuID0gZmFsc2U7XG4gICAgICAgICAgICBsZXQgaGFzUGFyYW1ldGVyRGF0YTogYm9vbGVhbiA9IGZhbHNlO1xuICAgICAgICAgICAgZm9yIChjb25zdCBwYXJhbWV0ZXIgb2YgcGFyYW1ldGVycykge1xuICAgICAgICAgICAgICBjb25zdCBwYXJhbWV0ZXJEYXRhID0gZ2V0RGVjb3JhdG9ycyhwYXJhbWV0ZXIuZGVjb3JhdG9ycyk7XG4gICAgICAgICAgICAgIHBhcmFtZXRlckRlY29yYXRvckRhdGEucHVzaChwYXJhbWV0ZXJEYXRhKTtcbiAgICAgICAgICAgICAgaGFzRGVjb3JhdG9yRGF0YSA9IGhhc0RlY29yYXRvckRhdGEgfHwgISFwYXJhbWV0ZXJEYXRhO1xuICAgICAgICAgICAgICBpZiAoaXNDb25zdHJ1Y3Rvcikge1xuICAgICAgICAgICAgICAgIGlmIChwYXJhbWV0ZXIudHlwZSkge1xuICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyc0RhdGEucHVzaChyZWZlcmVuY2VGcm9tKHBhcmFtZXRlci50eXBlKSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIHBhcmFtZXRlcnNEYXRhLnB1c2gobnVsbCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGhhc1BhcmFtZXRlckRhdGEgPSB0cnVlO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb25zdCBkYXRhOiBNZXRob2RNZXRhZGF0YSA9IHtfX3N5bWJvbGljOiBpc0NvbnN0cnVjdG9yID8gJ2NvbnN0cnVjdG9yJyA6ICdtZXRob2QnfTtcbiAgICAgICAgICAgIGNvbnN0IG5hbWUgPSBpc0NvbnN0cnVjdG9yID8gJ19fY3Rvcl9fJyA6IGV2YWx1YXRvci5uYW1lT2YobWVtYmVyLm5hbWUpO1xuICAgICAgICAgICAgaWYgKG1ldGhvZERlY29yYXRvcnMpIHtcbiAgICAgICAgICAgICAgZGF0YS5kZWNvcmF0b3JzID0gbWV0aG9kRGVjb3JhdG9ycztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChoYXNEZWNvcmF0b3JEYXRhKSB7XG4gICAgICAgICAgICAgIGRhdGEucGFyYW1ldGVyRGVjb3JhdG9ycyA9IHBhcmFtZXRlckRlY29yYXRvckRhdGE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoaGFzUGFyYW1ldGVyRGF0YSkge1xuICAgICAgICAgICAgICAoPENvbnN0cnVjdG9yTWV0YWRhdGE+ZGF0YSkucGFyYW1ldGVycyA9IHBhcmFtZXRlcnNEYXRhO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFpc01ldGFkYXRhRXJyb3IobmFtZSkpIHtcbiAgICAgICAgICAgICAgcmVjb3JkTWVtYmVyKG5hbWUsIGRhdGEpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgY2FzZSB0cy5TeW50YXhLaW5kLlByb3BlcnR5RGVjbGFyYXRpb246XG4gICAgICAgICAgY2FzZSB0cy5TeW50YXhLaW5kLkdldEFjY2Vzc29yOlxuICAgICAgICAgIGNhc2UgdHMuU3ludGF4S2luZC5TZXRBY2Nlc3NvcjpcbiAgICAgICAgICAgIGNvbnN0IHByb3BlcnR5ID0gPHRzLlByb3BlcnR5RGVjbGFyYXRpb24+bWVtYmVyO1xuICAgICAgICAgICAgaWYgKGlzU3RhdGljKHByb3BlcnR5KSkge1xuICAgICAgICAgICAgICBjb25zdCBuYW1lID0gZXZhbHVhdG9yLm5hbWVPZihwcm9wZXJ0eS5uYW1lKTtcbiAgICAgICAgICAgICAgaWYgKCFpc01ldGFkYXRhRXJyb3IobmFtZSkgJiYgIXNob3VsZElnbm9yZVN0YXRpY01lbWJlcihuYW1lKSkge1xuICAgICAgICAgICAgICAgIGlmIChwcm9wZXJ0eS5pbml0aWFsaXplcikge1xuICAgICAgICAgICAgICAgICAgY29uc3QgdmFsdWUgPSBldmFsdWF0b3IuZXZhbHVhdGVOb2RlKHByb3BlcnR5LmluaXRpYWxpemVyKTtcbiAgICAgICAgICAgICAgICAgIHJlY29yZFN0YXRpY01lbWJlcihuYW1lLCB2YWx1ZSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIHJlY29yZFN0YXRpY01lbWJlcihuYW1lLCBlcnJvclN5bSgnVmFyaWFibGUgbm90IGluaXRpYWxpemVkJywgcHJvcGVydHkubmFtZSkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29uc3QgcHJvcGVydHlEZWNvcmF0b3JzID0gZ2V0RGVjb3JhdG9ycyhwcm9wZXJ0eS5kZWNvcmF0b3JzKTtcbiAgICAgICAgICAgIGlmIChwcm9wZXJ0eURlY29yYXRvcnMpIHtcbiAgICAgICAgICAgICAgY29uc3QgbmFtZSA9IGV2YWx1YXRvci5uYW1lT2YocHJvcGVydHkubmFtZSk7XG4gICAgICAgICAgICAgIGlmICghaXNNZXRhZGF0YUV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BhcyBuYW1lfTtcbiAgICAgICAgICAgIGlmIChleHBvcnRDbGF1c2UgJiYgdHMuaXNOYW1lZEV4cG9ydHMoZXhwb3J0Q2xhdXNlKSkge1xuICAgICAgICAgICAgICBleHBvcnRDbGF1c2UuZWxlbWVudHMuZm9yRWFjaChzcGVjID0+IHtcbiAgICAgICAgICAgICAgICBjb25zdCBuYW1lID0gc3BlYy5uYW1lLnRleHQ7XG4gICAgICAgICAgICAgICAgLy8gSWYgdGhlIHN5bWJvbCB3YXMgbm90IGFscmVhZHkgZXhwb3J0ZWQsIGV4cG9ydCBhIHJlZmVyZW5jZSBzaW5jZSBpdCBpcyBhXG4gICAgICAgICAgICAgICAgLy8gcmVmZXJlbmNlIHRvIGFuIGltcG9ydFxuICAgICAgICAgICAgICAgIGlmICghbWV0YWRhdGEgfHwgIW1ldGFkYXRhW25hbWVdKSB7XG4gICAgICAgICAgICAgICAgICBjb25zdCBwcm9wTm9kZSA9IHNwZWMucHJvcGVydHlOYW1lIHx8IHNwZWMubmFtZTtcbiAgICAgICAgICAgICAgICAgIGNvbnN0IHZhbHVlOiBNZXRhZGF0YVZhbHVlID0gZXZhbHVhdG9yLmV2YWx1YXRlTm9kZShwcm9wTm9kZSk7XG4gICAgICAgICAgICAgICAgICBpZiAoIW1ldGFkYXRhKSBtZXRhZGF0YSA9IHt9O1xuICAgICAgICAgICAgICAgICAgbWV0YWRhdGFbbmFtZV0gPSByZWNvcmRFbnRyeSh2YWx1ZSwgbm9kZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAobW9kdWxlU3BlY2lmaWVyICYmIG1vZHVsZVNwZWNpZmllci5raW5kID09IHRzLlN5bnRheEtpbmQuU3RyaW5nTGl0ZXJhbCkge1xuICAgICAgICAgICAgLy8gSWdub3JlIGV4cG9ydHMgdGhhdCBkb24ndCBoYXZlIHN0cmluZyBsaXRlcm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J0ZWQoY2xhc3NEZWNsYXJhdGlvbikpIHtcbiAgICAgICAgICAgICAgY29uc3QgbmFtZSA9IGV4cG9ydGVkTmFtZShjbGFzc0RlY2xhcmF0aW9uKTtcbiAgICAgICAgICAgICAgaWYgKG5hbWUpIHtcbiAgICAgICAgICAgICAgICBpZiAoIW1ldGFkYXRhKSBtZXRhZGF0YSA9IHt9O1xuICAgICAgICAgICAgICAgIG1ldGFkYXRhW25hbWVdID0gY2xhc3NNZXRhZGF0YU9mKGNsYXNzRGVjbGFyYXRpb24pO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIC8vIE90aGVyd2lzZSBkb24ndCByZWNvcmQgbWV0YWRhdGEgZm9yIHRoZSBjbGFzcy5cbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIHRzLlN5bnRheEtpbmQuVHlwZUFsaWFzRGVjbGFyYXRpb246XG4gICAgICAgICAgY29uc3QgdHlwZURlY2xhcmF0aW9uID0gPHRzLlR5cGVBbGlhc0RlY2xhcmF0aW9uPm5vZGU7XG4gICAgICAgICAgaWYgKHR5cGVEZWNsYXJhdGlvbi5uYW1lICYmIGlzRXhwb3J0ZWQodHlwZURlY2xhcmF0aW9uKSkge1xuICAgICAgICAgICAgY29uc3QgbmFtZSA9IGV4cG9ydGVkTmFtZSh0eXBlRGVjbGFyYXRpb24pO1xuICAgICAgICAgICAgaWYgKG5hbWUpIHtcbiAgICAgICAgICAgICAgaWYgKCFtZXRhZGF0YSkgbWV0YWRhdGEgPSB7fTtcbiAgICAgICAgICAgICAgbWV0YWRhdGFbbmFtZV0gPSB7X19zeW1ib2xpYzogJ2ludGVyZmFjZSd9O1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIHRzLlN5bnRheEtpbmQuSW50ZXJmYWNlRGVjbGFyYXRpb246XG4gICAgICAgICAgY29uc3QgaW50ZXJmYW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ZTtcbiAgICAgICAgICAgICAgaWYgKCFtZW1iZXIuaW5pdGlhbGl6ZXIpIHtcbiAgICAgICAgICAgICAgICBlbnVtVmFsdWUgPSBuZXh0RGVmYXVsdFZhbHVlO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGVudW1WYWx1ZSA9IGV2YWx1YXRvci5ldmFsdWF0ZU5vZGUobWVtYmVyLmluaXRpYWxpemVyKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBsZXQgbmFtZTogc3RyaW5nfHVuZGVmaW5lZCA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgaWYgKG1lbWJlci5uYW1lLmtpbmQgPT0gdHMuU3ludGF4S2luZC5JZGVudGlmaWVyKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgaWRlbnRpZmllciA9IDx0cy5JZGVudGlmaWVyPm1lbWJlci5uYW1lO1xuICAgICAgICAgICAgICAgIG5hbWUgPSBpZGVudGlmaWVyLnRleHQ7XG4gICAgICAgICAgICAgICAgZW51bVZhbHVlSG9sZGVyW25hbWVdID0gZW51bVZhbHVlO1xuICAgICAgICAgICAgICAgIHdyaXR0ZW5NZW1iZXJzKys7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYgKHR5cGVvZiBlbnVtVmFsdWUgPT09ICdudW1iZXInKSB7XG4gICAgICAgICAgICAgICAgbmV4dERlZmF1bHRWYWx1ZSA9IGVudW1WYWx1ZSArIDE7XG4gICAgICAgICAgICAgIH0gZWxzZSBpZiAobmFtZSkge1xuICAgICAgICAgICAgICAgIC8vIFRPRE8oYWx4aHViKTogJ2xlZnQnIGhlcmUgaGFzIGEgbmFtZSBwcm9wZXJ5IHdoaWNoIGlzIG5vdCB2YWxpZCBmb3JcbiAgICAgICAgICAgICAgICAvLyBNZXRhZGF0YVN5bWJvbGljU2VsZWN0RXhwcmVzc2lvbi5cbiAgICAgICAgICAgICAgICBuZXh0RGVmYXVsdFZhbHVlID0ge1xuICAgICAgICAgICAgICAgICAgX19zeW1ib2xpYzogJ2JpbmFyeScsXG4gICAgICAgICAgICAgICAgICBvcGVyYXRvcjogJysnLFxuICAgICAgICAgICAgICAgICAgbGVmdDoge1xuICAgICAgICAgICAgICAgICAgICBfX3N5bWJvbGljOiAnc2VsZWN0JyxcbiAgICAgICAgICAgICAgICAgICAgZXhwcmVzc2lvbjogcmVjb3JkRW50cnkoe19fc3ltYm9saWM6ICdyZWZlcmVuY2UnLCBuYW1lOiBlbnVtTmFtZX0sIG5vZGUpLFxuICAgICAgICAgICAgICAgICAgICBuYW1lXG4gICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIH0gYXMgYW55O1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIG5leHREZWZhdWx0VmFsdWUgPVxuICAgICAgICAgICAgICAgICAgICByZWNvcmRFbnRyeShlcnJvclN5bSgnVW5zdXBwb3J0ZWQgZW51bSBtZW1iZXIgbmFtZScsIG1lbWJlci5uYW1lKSwgbm9kZSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh3cml0dGVuTWVtYmVycykge1xuICAgICAgICAgICAgICBpZiAoZW51bU5hbWUpIHtcbiAgICAgICAgICAgICAgICBpZiAoIW1ldGFkYXRhKSBtZXRhZGF0YSA9IHt9O1xuICAgICAgICAgICAgICAgIG1ldGFkYXRhW2VudW1OYW1lXSA9IHJlY29yZEVudHJ5KGVudW1WYWx1ZUhvbGRlciwgbm9kZSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSB0cy5TeW50YXhLaW5kLlZhcmlhYmxlU3RhdGVtZW50OlxuICAgICAgICAgIGNvbnN0IHZhcmlhYmxlU3RhdGVtZW50ID0gPHRzLlZhcmlhYmxlU3RhdGVtZW50Pm5vZGU7XG4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ICAgICAgICAgaWYgKCFtZXRhZGF0YSkgbWV0YWRhdGEgPSB7fTtcbiAgICAgICAgICAgICAgICAgIG1ldGFkYXRhW25hbWVdID0gcmVjb3JkRW50cnkodmFyVmFsdWUsIG5vZGUpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBleHBvcnRlZCA9IHRydWU7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYgKHR5cGVvZiB2YXJWYWx1ZSA9PSAnc3RyaW5nJyB8fCB0eXBlb2YgdmFyVmFsdWUgPT0gJ251bWJlcicgfHxcbiAgICAgICAgICAgICAgICAgIHR5cGVvZiB2YXJWYWx1ZSA9PSAnYm9vbGVhbicpIHtcbiAgICAgICAgICAgICAgICBsb2NhbHMuZGVmaW5lKG5hbWVOb2RlLnRleHQsIHZhclZhbHVlKTtcbiAgICAgICAgICAgICAgICBpZiAoZXhwb3J0ZWQpIHtcbiAgICAgICAgICAgICAgICAgIGxvY2Fscy5kZWZpbmVSZWZlcmVuY2UoXG4gICAgICAgICAgICAgICAgICAgICAgbmFtZU5vZGUudGV4dCwge19fc3ltYm9saWM6ICdyZWZlcmVuY2UnLCBuYW1lOiBuYW1lTm9kZS50ZXh0fSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9IGVsc2UgaWYgKCFleHBvcnRlZCkge1xuICAgICAgICAgICAgICAgIGlmICh2YXJWYWx1ZSAmJiAhaXNNZXRhZGF0YUVycm9yKHZhclZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgbG9jYWxzLmRlZmluZShuYW1lTm9kZS50ZXh0LCByZWNvcmRFbnRyeSh2YXJWYWx1ZSwgbm9kZSkpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICBsb2NhbHMuZGVmaW5lKFxuICAgICAgICAgICAgICAgICAgICAgIG5hbWVOb2RlLnRleHQsXG4gICAgICAgICAgICAgICAgICAgICAgcmVjb3JkRW50cnkoXG4gICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yU3ltKCdSZWZlcmVuY2UgdG8gYSBsb2NhbCBzeW1ib2wnLCBuYW1lTm9kZSwge25hbWU6IG5hbWVOb2RlLnRleHR9KSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgbm9kZSkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgLy8gRGVzdHJ1Y3R1cmluZyAob3IgYmluZGluZykgZGVjbGFyYXRpb25zIGFyZSBub3Qgc3VwcG9ydGVkLFxuICAgICAgICAgICAgICAvLyB2YXIgezxpZGVudGlmaWVyPlssIDxpZGVudGlmaWVyPl0rfSA9IDxleHByZXNzaW9uPjtcbiAgICAgICAgICAgICAgLy8gICBvclxuICAgICAgICAgICAgICAvLyB2YXIgWzxpZGVudGlmaWVyPlssIDxpZGVudGlmaWVyfStdID0gPGV4cHJlc3Npb24+O1xuICAgICAgICAgICAgICAvLyBhcmUgbm90IHN1cHBvcnRlZC5cbiAgICAgICAgICAgICAgY29uc3QgcmVwb3J0OiAobmFtZU5vZGU6IHRzLk5vZGUpID0+IHZvaWQgPSAobmFtZU5vZGU6IHRzLk5vZGUpID0+IHtcbiAgICAgICAgICAgICAgICBzd2l0Y2ggKG5hbWVOb2RlLmtpbmQpIHtcbiAgICAgICAgICAgICAgICAgIGNhc2UgdHMuU3ludGF4S2luZC5JZGVudGlmaWVyOlxuICAgICAgICAgICAgICAgICAgICBjb25zdCBuYW1lID0gPHRzLklkZW50aWZpZXI+bmFtZU5vZGU7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHZhclZhbHVlID0gZXJyb3JTeW0oJ0Rlc3RydWN0dXJpbmcgbm90IHN1cHBvcnRlZCcsIG5hbWUpO1xuICAgICAgICAgICAgICAgICAgICBsb2NhbHMuZGVmaW5lKG5hbWUudGV4dCwgdmFyVmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoaXNFeHBvcnQobm9kZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICBpZiAoIW1ldGFkYXRhKSBtZXRhZGF0YSA9IHt9O1xuICAgICAgICAgICAgICAgICAgICAgIG1ldGFkYXRhW25hbWUudGV4dF0gPSB2YXJWYWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgIGNhc2UgdHMuU3ludGF4S2luZC5CaW5kaW5nRWxlbWVudDpcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgYmluZGluZ0VsZW1lbnQgPSA8dHMuQmluZGluZ0VsZW1lbnQ+bmFtZU5vZGU7XG4gICAgICAgICAgICAgICAgICAgIHJlcG9ydChiaW5kaW5nRWxlbWVudC5uYW1lKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICBjYXNlIHRzLlN5bnRheEtpbmQuT2JqZWN0QmluZGluZ1BhdHRlcm46XG4gICAgICAgICAgICAgICAgICBjYXNlIHRzLlN5bnRheEtpbmQuQXJyYXlCaW5kaW5nUGF0dGVybjpcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgYmluZGluZ3MgPSA8dHMuQmluZGluZ1BhdHRlcm4+bmFtZU5vZGU7XG4gICAgICAgICAgICAgICAgICAgIChiaW5kaW5ncyBhcyBhbnkpLmVsZW1lbnRzLmZvckVhY2gocmVwb3J0KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICByZXBvcnQodmFyaWFibGVEZWNsYXJhdGlvbi5uYW1lKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgYnJlYWs7XG4gICAgICB9XG4gICAgfSk7XG5cbiAgICBpZiAobWV0YWRhdGEgfHwgZXhwb3J0cykge1xuICAgICAgaWYgKCFtZXRhZGF0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mZvckVhY2gobiA9PiBsb2NhbHMuYWRkKG4pKTtcbiAgICAgIH1cbiAgICAgIHZhbGlkYXRlRXhwcmVzc2lvbihmdW5jdGlvbkRlY2xhcmF0aW9uLnZhbHVlKTtcbiAgICAgIGxvY2FscyA9IG9sZExvY2FscztcbiAgICB9XG4gIH1cblxuICBmdW5jdGlvbiBzaG91bGRSZXBvcnROb2RlKG5vZGU6IHRzLk5vZGV8dW5kZWZpbmVkKSB7XG4gICAgaWYgKG5vZGUpIHtcbiAgICAgIGNvbnN0IG5vZGVTdGFydCA9IG5vZGUuZ2V0U3RhcnQoKTtcbiAgICAgIHJldHVybiAhKFxuICAgICAgICAgIG5vZGUucG9zICE9IG5vZGVTdGFydCAmJlxuICAgICAgICAgIHNvdXJjZUZpbGUudGV4dC5zdWJzdHJpbmcobm9kZS5wb3MsIG5vZGVTdGFydCkuaW5kZXhPZignQGR5bmFtaWMnKSA+PSAwKTtcbiAgICB9XG4gICAgcmV0dXJuIHRydWU7XG4gIH1cblxuICBmdW5jdGlvbiByZXBvcnRFcnJvcihlcnJvcjogTWV0YWRhdGFFcnJvcikge1xuICAgIGNvbnN0IG5vZGUgPSBub2RlTWFwLmdldChlcnJvcik7XG4gICAgaWYgKHNob3VsZFJlcG9ydE5vZGUobm9kZSkpIHtcbiAgICAgIGNvbnN0IGxpbmVJbmZvID0gZXJyb3IubGluZSAhPSB1bmRlZmluZWQgPyBlcnJvci5jaGFyYWN0ZXIgIT0gdW5kZWZpbmVkID9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBgOiR7ZXJyb3IubGluZSArIDF9OiR7ZXJyb3IuY2hhcmFjdGVyICsgMX1gIDpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBgOiR7ZXJyb3IubGluZSArIDF9YCA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJyc7XG4gICAgICB0a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9ydGluZyB0aGUgc3ltYm9sYDtcbiAgICAgIH1cbiAgfVxuICByZXR1cm4gZXJyb3IubWVzc2FnZTtcbn1cbiJdfQ==
Note: See TracBrowser for help on using the repository browser.