source: trip-planner-front/node_modules/@angular/compiler-cli/src/metadata/symbols.js@ 571e0df

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

initial commit

  • Property mode set to 100644
File size: 20.9 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/symbols", ["require", "exports", "tslib", "typescript"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.Symbols = void 0;
20 var tslib_1 = require("tslib");
21 var ts = require("typescript");
22 var Symbols = /** @class */ (function () {
23 function Symbols(sourceFile) {
24 this.sourceFile = sourceFile;
25 this.references = new Map();
26 }
27 Symbols.prototype.resolve = function (name, preferReference) {
28 return (preferReference && this.references.get(name)) || this.symbols.get(name);
29 };
30 Symbols.prototype.define = function (name, value) {
31 this.symbols.set(name, value);
32 };
33 Symbols.prototype.defineReference = function (name, value) {
34 this.references.set(name, value);
35 };
36 Symbols.prototype.has = function (name) {
37 return this.symbols.has(name);
38 };
39 Object.defineProperty(Symbols.prototype, "symbols", {
40 get: function () {
41 var result = this._symbols;
42 if (!result) {
43 result = this._symbols = new Map();
44 populateBuiltins(result);
45 this.buildImports();
46 }
47 return result;
48 },
49 enumerable: false,
50 configurable: true
51 });
52 Symbols.prototype.buildImports = function () {
53 var _this = this;
54 var symbols = this._symbols;
55 // Collect the imported symbols into this.symbols
56 var stripQuotes = function (s) { return s.replace(/^['"]|['"]$/g, ''); };
57 var visit = function (node) {
58 var e_1, _a;
59 switch (node.kind) {
60 case ts.SyntaxKind.ImportEqualsDeclaration:
61 var importEqualsDeclaration = node;
62 if (importEqualsDeclaration.moduleReference.kind ===
63 ts.SyntaxKind.ExternalModuleReference) {
64 var externalReference = importEqualsDeclaration.moduleReference;
65 if (externalReference.expression) {
66 // An `import <identifier> = require(<module-specifier>);
67 if (!externalReference.expression.parent) {
68 // The `parent` field of a node is set by the TypeScript binder (run as
69 // part of the type checker). Setting it here allows us to call `getText()`
70 // even if the `SourceFile` was not type checked (which looks for `SourceFile`
71 // in the parent chain). This doesn't damage the node as the binder unconditionally
72 // sets the parent.
73 externalReference.expression.parent = externalReference;
74 externalReference.parent = _this.sourceFile;
75 }
76 var from_1 = stripQuotes(externalReference.expression.getText());
77 symbols.set(importEqualsDeclaration.name.text, { __symbolic: 'reference', module: from_1 });
78 break;
79 }
80 }
81 symbols.set(importEqualsDeclaration.name.text, { __symbolic: 'error', message: "Unsupported import syntax" });
82 break;
83 case ts.SyntaxKind.ImportDeclaration:
84 var importDecl = node;
85 if (!importDecl.importClause) {
86 // An `import <module-specifier>` clause which does not bring symbols into scope.
87 break;
88 }
89 if (!importDecl.moduleSpecifier.parent) {
90 // See note above in the `ImportEqualDeclaration` case.
91 importDecl.moduleSpecifier.parent = importDecl;
92 importDecl.parent = _this.sourceFile;
93 }
94 var from = stripQuotes(importDecl.moduleSpecifier.getText());
95 if (importDecl.importClause.name) {
96 // An `import <identifier> form <module-specifier>` clause. Record the default symbol.
97 symbols.set(importDecl.importClause.name.text, { __symbolic: 'reference', module: from, default: true });
98 }
99 var bindings = importDecl.importClause.namedBindings;
100 if (bindings) {
101 switch (bindings.kind) {
102 case ts.SyntaxKind.NamedImports:
103 try {
104 // An `import { [<identifier> [, <identifier>] } from <module-specifier>` clause
105 for (var _b = tslib_1.__values(bindings.elements), _c = _b.next(); !_c.done; _c = _b.next()) {
106 var binding = _c.value;
107 symbols.set(binding.name.text, {
108 __symbolic: 'reference',
109 module: from,
110 name: binding.propertyName ? binding.propertyName.text : binding.name.text
111 });
112 }
113 }
114 catch (e_1_1) { e_1 = { error: e_1_1 }; }
115 finally {
116 try {
117 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
118 }
119 finally { if (e_1) throw e_1.error; }
120 }
121 break;
122 case ts.SyntaxKind.NamespaceImport:
123 // An `input * as <identifier> from <module-specifier>` clause.
124 symbols.set(bindings.name.text, { __symbolic: 'reference', module: from });
125 break;
126 }
127 }
128 break;
129 }
130 ts.forEachChild(node, visit);
131 };
132 if (this.sourceFile) {
133 ts.forEachChild(this.sourceFile, visit);
134 }
135 };
136 return Symbols;
137 }());
138 exports.Symbols = Symbols;
139 function populateBuiltins(symbols) {
140 // From lib.core.d.ts (all "define const")
141 ['Object', 'Function', 'String', 'Number', 'Array', 'Boolean', 'Map', 'NaN', 'Infinity', 'Math',
142 'Date', 'RegExp', 'Error', 'Error', 'EvalError', 'RangeError', 'ReferenceError', 'SyntaxError',
143 'TypeError', 'URIError', 'JSON', 'ArrayBuffer', 'DataView', 'Int8Array', 'Uint8Array',
144 'Uint8ClampedArray', 'Uint16Array', 'Int16Array', 'Int32Array', 'Uint32Array', 'Float32Array',
145 'Float64Array']
146 .forEach(function (name) { return symbols.set(name, { __symbolic: 'reference', name: name }); });
147 }
148});
149//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3ltYm9scy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyLWNsaS9zcmMvbWV0YWRhdGEvc3ltYm9scy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7Ozs7Ozs7Ozs7Ozs7O0lBRUgsK0JBQWlDO0lBSWpDO1FBS0UsaUJBQW9CLFVBQXlCO1lBQXpCLGVBQVUsR0FBVixVQUFVLENBQWU7WUFGckMsZUFBVSxHQUFHLElBQUksR0FBRyxFQUErQyxDQUFDO1FBRTVCLENBQUM7UUFFakQseUJBQU8sR0FBUCxVQUFRLElBQVksRUFBRSxlQUF5QjtZQ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gICAgICAgICAgICBjYXNlIHRzLlN5bnRheEtpbmQuTmFtZWRJbXBvcnRzOlxuICAgICAgICAgICAgICAgIC8vIEFuIGBpbXBvcnQgeyBbPGlkZW50aWZpZXI+IFssIDxpZGVudGlmaWVyPl0gfSBmcm9tIDxtb2R1bGUtc3BlY2lmaWVyPmAgY2xhdXNlXG4gICAgICAgICAgICAgICAgZm9yIChjb25zdCBiaW5kaW5nIG9mICg8dHMuTmFtZWRJbXBvcnRzPmJpbmRpbmdzKS5lbGVtZW50cykge1xuICAgICAgICAgICAgICAgICAgc3ltYm9scy5zZXQoYmluZGluZy5uYW1lLnRleHQsIHtcbiAgICAgICAgICAgICAgICAgICAgX19zeW1ib2xpYzogJ3JlZmVyZW5jZScsXG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZTogZnJvbSxcbiAgICAgICAgICAgICAgICAgICAgbmFtZTogYmluZGluZy5wcm9wZXJ0eU5hbWUgPyBiaW5kaW5nLnByb3BlcnR5TmFtZS50ZXh0IDogYmluZGluZy5uYW1lLnRleHRcbiAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgY2FzZSB0cy5TeW50YXhLaW5kLk5hbWVzcGFjZUltcG9ydDpcbiAgICAgICAgICAgICAgICAvLyBBbiBgaW5wdXQgKiBhcyA8aWRlbnRpZmllcj4gZnJvbSA8bW9kdWxlLXNwZWNpZmllcj5gIGNsYXVzZS5cbiAgICAgICAgICAgICAgICBzeW1ib2xzLnNldChcbiAgICAgICAgICAgICAgICAgICAgKDx0cy5OYW1lc3BhY2VJbXBvcnQ+YmluZGluZ3MpLm5hbWUudGV4dCxcbiAgICAgICAgICAgICAgICAgICAge19fc3ltYm9saWM6ICdyZWZlcmVuY2UnLCBtb2R1bGU6IGZyb219KTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgYnJlYWs7XG4gICAgICB9XG4gICAgICB0cy5mb3JFYWNoQ2hpbGQobm9kZSwgdmlzaXQpO1xuICAgIH07XG4gICAgaWYgKHRoaXMuc291cmNlRmlsZSkge1xuICAgICAgdHMuZm9yRWFjaENoaWxkKHRoaXMuc291cmNlRmlsZSwgdmlzaXQpO1xuICAgIH1cbiAgfVxufVxuXG5mdW5jdGlvbiBwb3B1bGF0ZUJ1aWx0aW5zKHN5bWJvbHM6IE1hcDxzdHJpbmcsIE1ldGFkYXRhVmFsdWU+KSB7XG4gIC8vIEZyb20gbGliLmNvcmUuZC50cyAoYWxsIFwiZGVmaW5lIGNvbnN0XCIpXG4gIFsnT2JqZWN0JywgJ0Z1bmN0aW9uJywgJ1N0cmluZycsICdOdW1iZXInLCAnQXJyYXknLCAnQm9vbGVhbicsICdNYXAnLCAnTmFOJywgJ0luZmluaXR5JywgJ01hdGgnLFxuICAgJ0RhdGUnLCAnUmVnRXhwJywgJ0Vycm9yJywgJ0Vycm9yJywgJ0V2YWxFcnJvcicsICdSYW5nZUVycm9yJywgJ1JlZmVyZW5jZUVycm9yJywgJ1N5bnRheEVycm9yJyxcbiAgICdUeXBlRXJyb3InLCAnVVJJRXJyb3InLCAnSlNPTicsICdBcnJheUJ1ZmZlcicsICdEYXRhVmlldycsICdJbnQ4QXJyYXknLCAnVWludDhBcnJheScsXG4gICAnVWludDhDbGFtcGVkQXJyYXknLCAnVWludDE2QXJyYXknLCAnSW50MTZBcnJheScsICdJbnQzMkFycmF5JywgJ1VpbnQzMkFycmF5JywgJ0Zsb2F0MzJBcnJheScsXG4gICAnRmxvYXQ2NEFycmF5J11cbiAgICAgIC5mb3JFYWNoKG5hbWUgPT4gc3ltYm9scy5zZXQobmFtZSwge19fc3ltYm9saWM6ICdyZWZlcmVuY2UnLCBuYW1lfSkpO1xufVxuIl19
Note: See TracBrowser for help on using the repository browser.