Improve test for 'symbol.exports' (#25523)

* Improve test for 'symbol.exports'

* Remove SymbolFlags.HasExports and SymbolFlags.HasMembers

* Update baseline
This commit is contained in:
Andy
2018-07-11 09:37:32 -07:00
committed by GitHub
parent 990d445bb6
commit 8a3090bc35
7 changed files with 20 additions and 15 deletions

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -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

View File

@@ -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,