(symbolTable, context, bundled)
| 54121 | } |
| 54122 | } |
| 54123 | function symbolTableToDeclarationStatements(symbolTable, context, bundled) { |
| 54124 | var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 169 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); |
| 54125 | var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (_decorators, mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 168 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); |
| 54126 | // TODO: Use `setOriginalNode` on original declaration names where possible so these declarations see some kind of |
| 54127 | // declaration mapping |
| 54128 | // We save the enclosing declaration off here so it's not adjusted by well-meaning declaration |
| 54129 | // emit codepaths which want to apply more specific contexts (so we can still refer to the root real declaration |
| 54130 | // we're trying to emit from later on) |
| 54131 | var enclosingDeclaration = context.enclosingDeclaration; |
| 54132 | var results = []; |
| 54133 | var visitedSymbols = new ts.Set(); |
| 54134 | var deferredPrivatesStack = []; |
| 54135 | var oldcontext = context; |
| 54136 | context = __assign(__assign({}, oldcontext), { usedSymbolNames: new ts.Set(oldcontext.usedSymbolNames), remappedSymbolNames: new ts.Map(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function (sym, decl, meaning) { |
| 54137 | var accessibleResult = isSymbolAccessible(sym, decl, meaning, /*computeAliases*/ false); |
| 54138 | if (accessibleResult.accessibility === 0 /* SymbolAccessibility.Accessible */) { |
| 54139 | // Lookup the root symbol of the chain of refs we'll use to access it and serialize it |
| 54140 | var chain = lookupSymbolChainWorker(sym, context, meaning); |
| 54141 | if (!(sym.flags & 4 /* SymbolFlags.Property */)) { |
| 54142 | includePrivateSymbol(chain[0]); |
| 54143 | } |
| 54144 | } |
| 54145 | else if (oldcontext.tracker && oldcontext.tracker.trackSymbol) { |
| 54146 | return oldcontext.tracker.trackSymbol(sym, decl, meaning); |
| 54147 | } |
| 54148 | return false; |
| 54149 | } }) }); |
| 54150 | context.tracker = wrapSymbolTrackerToReportForContext(context, context.tracker); |
| 54151 | ts.forEachEntry(symbolTable, function (symbol, name) { |
| 54152 | var baseName = ts.unescapeLeadingUnderscores(name); |
| 54153 | void getInternalSymbolName(symbol, baseName); // Called to cache values into `usedSymbolNames` and `remappedSymbolNames` |
| 54154 | }); |
| 54155 | var addingDeclare = !bundled; |
| 54156 | var exportEquals = symbolTable.get("export=" /* InternalSymbolName.ExportEquals */); |
| 54157 | if (exportEquals && symbolTable.size > 1 && exportEquals.flags & 2097152 /* SymbolFlags.Alias */) { |
| 54158 | symbolTable = ts.createSymbolTable(); |
| 54159 | // Remove extraneous elements from root symbol table (they'll be mixed back in when the target of the `export=` is looked up) |
| 54160 | symbolTable.set("export=" /* InternalSymbolName.ExportEquals */, exportEquals); |
| 54161 | } |
| 54162 | visitSymbolTable(symbolTable); |
| 54163 | return mergeRedundantStatements(results); |
| 54164 | function isIdentifierAndNotUndefined(node) { |
| 54165 | return !!node && node.kind === 79 /* SyntaxKind.Identifier */; |
| 54166 | } |
| 54167 | function getNamesOfDeclaration(statement) { |
| 54168 | if (ts.isVariableStatement(statement)) { |
| 54169 | return ts.filter(ts.map(statement.declarationList.declarations, ts.getNameOfDeclaration), isIdentifierAndNotUndefined); |
| 54170 | } |
| 54171 | return ts.filter([ts.getNameOfDeclaration(statement)], isIdentifierAndNotUndefined); |
| 54172 | } |
| 54173 | function flattenExportAssignedNamespace(statements) { |
| 54174 | var exportAssignment = ts.find(statements, ts.isExportAssignment); |
| 54175 | var nsIndex = ts.findIndex(statements, ts.isModuleDeclaration); |
| 54176 | var ns = nsIndex !== -1 ? statements[nsIndex] : undefined; |
| 54177 | if (ns && exportAssignment && exportAssignment.isExportEquals && |
| 54178 | ts.isIdentifier(exportAssignment.expression) && ts.isIdentifier(ns.name) && ts.idText(ns.name) === ts.idText(exportAssignment.expression) && |
| 54179 | ns.body && ts.isModuleBlock(ns.body)) { |
| 54180 | // Pass 0: Correct situations where a module has both an `export = ns` and multiple top-level exports by stripping the export modifiers from |
no test coverage detected
searching dependent graphs…