/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ (function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define("@angular/compiler/src/aot/generated_file", ["require", "exports", "@angular/compiler/src/output/output_ast", "@angular/compiler/src/output/ts_emitter"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toTypeScript = exports.GeneratedFile = void 0; var output_ast_1 = require("@angular/compiler/src/output/output_ast"); var ts_emitter_1 = require("@angular/compiler/src/output/ts_emitter"); var GeneratedFile = /** @class */ (function () { function GeneratedFile(srcFileUrl, genFileUrl, sourceOrStmts) { this.srcFileUrl = srcFileUrl; this.genFileUrl = genFileUrl; if (typeof sourceOrStmts === 'string') { this.source = sourceOrStmts; this.stmts = null; } else { this.source = null; this.stmts = sourceOrStmts; } } GeneratedFile.prototype.isEquivalent = function (other) { if (this.genFileUrl !== other.genFileUrl) { return false; } if (this.source) { return this.source === other.source; } if (other.stmts == null) { return false; } // Note: the constructor guarantees that if this.source is not filled, // then this.stmts is. return output_ast_1.areAllEquivalent(this.stmts, other.stmts); }; return GeneratedFile; }()); exports.GeneratedFile = GeneratedFile; function toTypeScript(file, preamble) { if (preamble === void 0) { preamble = ''; } if (!file.stmts) { throw new Error("Illegal state: No stmts present on GeneratedFile " + file.genFileUrl); } return new ts_emitter_1.TypeScriptEmitter().emitStatements(file.genFileUrl, file.stmts, preamble); } exports.toTypeScript = toTypeScript; }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXJhdGVkX2ZpbGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21waWxlci9zcmMvYW90L2dlbmVyYXRlZF9maWxlLnRzIl0sIm5hbWVzIjpbXSw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