Skip to content

Commit 04c54f8

Browse files
committed
Merge branch 'master' into issue3979
2 parents b584d59 + 478cc32 commit 04c54f8

File tree

550 files changed

+9788
-7058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

550 files changed

+9788
-7058
lines changed

Jakefile.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ var harnessSources = harnessCoreSources.concat([
141141
"session.ts",
142142
"versionCache.ts",
143143
"convertToBase64.ts",
144-
"transpile.ts"
144+
"transpile.ts",
145+
"reuseProgramStructure.ts",
146+
"cachingInServerLSHost.ts"
145147
].map(function (f) {
146148
return path.join(unittestsDirectory, f);
147149
})).concat([

lib/typescriptServices.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,7 @@ declare namespace ts {
14501450
function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
14511451
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
14521452
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
1453+
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant: ts.LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
14531454
}
14541455
declare namespace ts {
14551456
function getDefaultLibFileName(options: CompilerOptions): string;

src/compiler/checker.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -965,28 +965,19 @@ namespace ts {
965965
// Escape the name in the "require(...)" clause to ensure we find the right symbol.
966966
let moduleName = escapeIdentifier(moduleReferenceLiteral.text);
967967

968-
if (!moduleName) return;
968+
if (!moduleName) {
969+
return;
970+
}
969971
let isRelative = isExternalModuleNameRelative(moduleName);
970972
if (!isRelative) {
971973
let symbol = getSymbol(globals, "\"" + moduleName + "\"", SymbolFlags.ValueModule);
972974
if (symbol) {
973975
return symbol;
974976
}
975977
}
976-
let fileName: string;
977-
let sourceFile: SourceFile;
978-
while (true) {
979-
fileName = normalizePath(combinePaths(searchPath, moduleName));
980-
sourceFile = forEach(supportedExtensions, extension => host.getSourceFile(fileName + extension));
981-
if (sourceFile || isRelative) {
982-
break;
983-
}
984-
let parentPath = getDirectoryPath(searchPath);
985-
if (parentPath === searchPath) {
986-
break;
987-
}
988-
searchPath = parentPath;
989-
}
978+
979+
let fileName = getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text);
980+
let sourceFile = fileName && host.getSourceFile(fileName);
990981
if (sourceFile) {
991982
if (sourceFile.symbol) {
992983
return sourceFile.symbol;
@@ -2175,10 +2166,13 @@ namespace ts {
21752166
function collectLinkedAliases(node: Identifier): Node[] {
21762167
let exportSymbol: Symbol;
21772168
if (node.parent && node.parent.kind === SyntaxKind.ExportAssignment) {
2178-
exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, Diagnostics.Cannot_find_name_0, node);
2169+
exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias, Diagnostics.Cannot_find_name_0, node);
21792170
}
21802171
else if (node.parent.kind === SyntaxKind.ExportSpecifier) {
2181-
exportSymbol = getTargetOfExportSpecifier(<ExportSpecifier>node.parent);
2172+
let exportSpecifier = <ExportSpecifier>node.parent;
2173+
exportSymbol = (<ExportDeclaration>exportSpecifier.parent.parent).moduleSpecifier ?
2174+
getExternalModuleMember(<ExportDeclaration>exportSpecifier.parent.parent, exportSpecifier) :
2175+
resolveEntityName(exportSpecifier.propertyName || exportSpecifier.name, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias);
21822176
}
21832177
let result: Node[] = [];
21842178
if (exportSymbol) {
@@ -13328,7 +13322,7 @@ namespace ts {
1332813322
}
1332913323
}
1333013324
else {
13331-
if (languageVersion >= ScriptTarget.ES6) {
13325+
if (languageVersion >= ScriptTarget.ES6 && !isInAmbientContext(node)) {
1333213326
// Import equals declaration is deprecated in es6 or above
1333313327
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead);
1333413328
}
@@ -13851,7 +13845,11 @@ namespace ts {
1385113845
}
1385213846
break;
1385313847
}
13854-
13848+
13849+
if (introducesArgumentsExoticObject(location)) {
13850+
copySymbol(argumentsSymbol, meaning);
13851+
}
13852+
1385513853
memberFlags = location.flags;
1385613854
location = location.parent;
1385713855
}

src/compiler/core.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ namespace ts {
2424
set,
2525
contains,
2626
remove,
27+
clear,
2728
forEachValue: forEachValueInMap
2829
};
2930

@@ -51,6 +52,10 @@ namespace ts {
5152
function normalizeKey(key: string) {
5253
return getCanonicalFileName(normalizeSlashes(key));
5354
}
55+
56+
function clear() {
57+
files = {};
58+
}
5459
}
5560

5661
export const enum Comparison {
@@ -716,7 +721,7 @@ namespace ts {
716721
/**
717722
* List of supported extensions in order of file resolution precedence.
718723
*/
719-
export const supportedExtensions = [".tsx", ".ts", ".d.ts"];
724+
export const supportedExtensions = [".ts", ".tsx", ".d.ts"];
720725

721726
const extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"];
722727
export function removeFileExtension(path: string): string {

0 commit comments

Comments
 (0)