Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6b1cc89
Use native maps when they're available
Dec 5, 2016
b15ffda
Simplify forEachKeyInMap and someKeyInMap
Dec 8, 2016
863e4d6
Clean up helpers
Dec 8, 2016
8121de7
Fix target error for gulp
Dec 8, 2016
8dbb8e7
Add comment
Dec 8, 2016
55fc62b
Merge branch 'master' into map5
Dec 12, 2016
5c304d0
Remove `createObject`; use `Object.create` directly.
Dec 12, 2016
b53b5cf
Remove the "set" function and use `map.set` with multiple lines of co…
Dec 12, 2016
8386d49
Use sparse arrays for number-keyed maps
Dec 27, 2016
5555258
Add iterators to Map interface, and shim iterators
Dec 27, 2016
3d7b5e6
Make `createMapLike` private and rename to `createDictionaryObject`
Dec 27, 2016
9e33585
Merge branch 'master' into map5
Dec 27, 2016
f510897
Remove "sparseArray" constructor function and just use array literals
Dec 28, 2016
39c19a7
Inline `keysOfMap` and `valuesOfMap`.
Dec 28, 2016
932eaa3
Rename and consolidate map iteration helpers
Dec 28, 2016
145f0b2
Add `createMultiMap` to replace `multiMapAdd` and `multiMapRemove`
Dec 28, 2016
346a865
Merge branch 'master' into map5
Dec 28, 2016
2e6f369
Replace SparseArray<T> with T[]
Dec 28, 2016
a677712
Merge branch 'master' into map5
Dec 29, 2016
8c5afd7
Merge branch 'master' into map5
Jan 6, 2017
9221336
Fix name: `mapEntries` is more accurate
Jan 6, 2017
c28d98a
Fix test
Jan 9, 2017
a0641b2
Merge branch 'master' into map5
Jan 9, 2017
f0e1fd9
Merge branch 'master' into map5
Jan 11, 2017
37e18d9
Add `createMapFromTemplate` helper
Jan 11, 2017
30462e1
Merge branch 'master' into map5
Jan 11, 2017
b98e82e
Fix one more use of `createMapFromTemplate`
Jan 12, 2017
113338c
Merge branch 'master' into map5
Jan 12, 2017
6b6c34b
Fix typo
Jan 12, 2017
30ccc7a
Merge branch 'master' into map5
Jan 17, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1808,19 +1808,20 @@ namespace ts {
}
}

// If symbol is directly available by its name in the symbol table
if (isAccessible(symbols.get(symbol.name))) {
return [symbol];
}
function trySymbolTable(symbols: SymbolTable) {
// If symbol is directly available by its name in the symbol table
if (isAccessible(symbols.get(symbol.name))) {
return [symbol];
}

// Check if symbol is any of the alias
return forEachInMap(symbols, symbolFromSymbolTable => {
if (symbolFromSymbolTable.flags & SymbolFlags.Alias
&& symbolFromSymbolTable.name !== "export="
&& !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)) {
if (!useOnlyExternalAliasing || // We can use any type of alias to get the name
// Is this external alias, then use it to name
ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) {
// Check if symbol is any of the alias
return forEachInMap(symbols, symbolFromSymbolTable => {
if (symbolFromSymbolTable.flags & SymbolFlags.Alias
&& symbolFromSymbolTable.name !== "export="
&& !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)) {
if (!useOnlyExternalAliasing || // We can use any type of alias to get the name
// Is this external alias, then use it to name
ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) {

const resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) {
Expand Down Expand Up @@ -4083,16 +4084,15 @@ namespace ts {
enumType.symbol = symbol;
if (enumHasLiteralMembers(symbol)) {
const memberTypeList: Type[] = [];
const memberTypes = createMap<EnumLiteralType>();
const memberTypes = sparseArray<EnumLiteralType>();
for (const declaration of enumType.symbol.declarations) {
if (declaration.kind === SyntaxKind.EnumDeclaration) {
computeEnumMemberValues(<EnumDeclaration>declaration);
for (const member of (<EnumDeclaration>declaration).members) {
const memberSymbol = getSymbolOfNode(member);
const value = getEnumMemberValue(member);
if (!memberTypes.has(value)) {
const memberType = createEnumLiteralType(memberSymbol, enumType, "" + value);
memberTypes.set(value, memberType);
if (!memberTypes[value]) {
const memberType = memberTypes[value] = createEnumLiteralType(memberSymbol, enumType, "" + value);
memberTypeList.push(memberType);
}
}
Expand All @@ -4114,7 +4114,7 @@ namespace ts {
if (!links.declaredType) {
const enumType = <EnumType>getDeclaredTypeOfEnum(getParentOfSymbol(symbol));
links.declaredType = enumType.flags & TypeFlags.Union ?
enumType.memberTypes.get(getEnumMemberValue(<EnumMember>symbol.valueDeclaration)) :
enumType.memberTypes[getEnumMemberValue(<EnumMember>symbol.valueDeclaration)] :
enumType;
}
return links.declaredType;
Expand Down Expand Up @@ -6212,7 +6212,7 @@ namespace ts {
if (!links.resolvedType) {
// Deferred resolution of members is handled by resolveObjectTypeMembers
const aliasSymbol = getAliasSymbolForTypeNode(node);
if (mapIsEmpty(node.symbol.members) && !aliasSymbol) {
if (node.symbol.members.size === 0 && !aliasSymbol) {
links.resolvedType = emptyTypeLiteralType;
}
else {
Expand Down
8 changes: 4 additions & 4 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ namespace ts {
}

function serializeCompilerOptions(options: CompilerOptions): MapLike<CompilerOptionsValue> {
const result = createMapLike<CompilerOptionsValue>();
const result: ts.MapLike<CompilerOptionsValue> = {};
const optionsNameMap = getOptionNameMap().optionNameMap;

for (const name in options) {
Expand All @@ -777,7 +777,7 @@ namespace ts {
break;
default:
const value = options[name];
let optionDefinition = optionsNameMap.get(name.toLowerCase());
const optionDefinition = optionsNameMap.get(name.toLowerCase());
if (optionDefinition) {
const customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition);
if (!customTypeMap) {
Expand Down Expand Up @@ -1302,7 +1302,7 @@ namespace ts {
// /a/b/a?z - Watch /a/b directly to catch any new file matching a?z
const rawExcludeRegex = getRegularExpressionForWildcard(exclude, path, "exclude");
const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i");
const wildcardDirectories = createMapLike<WatchDirectoryFlags>();
const wildcardDirectories: ts.MapLike<WatchDirectoryFlags> = {};
if (include !== undefined) {
const recursiveKeys: string[] = [];
for (const file of include) {
Expand All @@ -1325,7 +1325,7 @@ namespace ts {
}

// Remove any subpaths under an existing recursively watched directory.
for (const key in wildcardDirectories) {
for (const key in wildcardDirectories) if (hasProperty(wildcardDirectories, key)) {
for (const recursiveKey of recursiveKeys) {
if (key !== recursiveKey && containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) {
delete wildcardDirectories[key];
Expand Down
Loading