mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Improve test for 'symbol.exports' (#25523)
* Improve test for 'symbol.exports' * Remove SymbolFlags.HasExports and SymbolFlags.HasMembers * Update baseline
This commit is contained in:
@@ -225,11 +225,11 @@ namespace ts {
|
||||
node.symbol = symbol;
|
||||
symbol.declarations = append(symbol.declarations, node);
|
||||
|
||||
if (symbolFlags & SymbolFlags.HasExports && !symbol.exports) {
|
||||
if (symbolFlags & (SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.Module | SymbolFlags.Variable) && !symbol.exports) {
|
||||
symbol.exports = createSymbolTable();
|
||||
}
|
||||
|
||||
if (symbolFlags & SymbolFlags.HasMembers && !symbol.members) {
|
||||
if (symbolFlags & (SymbolFlags.Class | SymbolFlags.Interface | SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral) && !symbol.members) {
|
||||
symbol.members = createSymbolTable();
|
||||
}
|
||||
|
||||
|
||||
@@ -2417,12 +2417,12 @@ namespace ts {
|
||||
// The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example,
|
||||
// module 'a' can 'export * from "b"' and 'b' can 'export * from "a"' without error.
|
||||
function visit(symbol: Symbol | undefined): SymbolTable | undefined {
|
||||
if (!(symbol && symbol.flags & SymbolFlags.HasExports && pushIfUnique(visitedSymbols, symbol))) {
|
||||
if (!(symbol && symbol.exports && pushIfUnique(visitedSymbols, symbol))) {
|
||||
return;
|
||||
}
|
||||
const symbols = cloneMap(symbol.exports!);
|
||||
const symbols = cloneMap(symbol.exports);
|
||||
// All export * declarations are collected in an __export symbol by the binder
|
||||
const exportStars = symbol.exports!.get(InternalSymbolName.ExportStar);
|
||||
const exportStars = symbol.exports.get(InternalSymbolName.ExportStar);
|
||||
if (exportStars) {
|
||||
const nestedSymbols = createSymbolTable();
|
||||
const lookupTable = createMap<ExportCollisionTracker>() as ExportCollisionTrackerTable;
|
||||
|
||||
@@ -171,8 +171,8 @@ namespace ts {
|
||||
}
|
||||
const t = getTypeOfSymbol(symbol);
|
||||
visitType(t); // Should handle members on classes and such
|
||||
if (symbol.flags & SymbolFlags.HasExports) {
|
||||
symbol.exports!.forEach(visitSymbol);
|
||||
if (symbol.exports) {
|
||||
symbol.exports.forEach(visitSymbol);
|
||||
}
|
||||
forEach(symbol.declarations, d => {
|
||||
// Type queries are too far resolved when we just visit the symbol's type
|
||||
|
||||
@@ -3439,9 +3439,6 @@ namespace ts {
|
||||
|
||||
ExportHasLocal = Function | Class | Enum | ValueModule,
|
||||
|
||||
HasExports = Class | Enum | Module | Variable,
|
||||
HasMembers = Class | Interface | TypeLiteral | ObjectLiteral,
|
||||
|
||||
BlockScoped = BlockScopedVariable | Class | Enum,
|
||||
|
||||
PropertyOrAccessor = Property | Accessor,
|
||||
|
||||
Reference in New Issue
Block a user