@@ -31,6 +31,36 @@ var ts;
31
31
/// <reference path="types.ts"/>
32
32
var ts;
33
33
(function (ts) {
34
+ function createFileMap(getCanonicalFileName) {
35
+ var files = {};
36
+ return {
37
+ get: get,
38
+ set: set,
39
+ contains: contains,
40
+ remove: remove,
41
+ forEachValue: forEachValueInMap
42
+ };
43
+ function set(fileName, value) {
44
+ files[normalizeKey(fileName)] = value;
45
+ }
46
+ function get(fileName) {
47
+ return files[normalizeKey(fileName)];
48
+ }
49
+ function contains(fileName) {
50
+ return hasProperty(files, normalizeKey(fileName));
51
+ }
52
+ function remove(fileName) {
53
+ var key = normalizeKey(fileName);
54
+ delete files[key];
55
+ }
56
+ function forEachValueInMap(f) {
57
+ forEachValue(files, f);
58
+ }
59
+ function normalizeKey(key) {
60
+ return getCanonicalFileName(normalizeSlashes(key));
61
+ }
62
+ }
63
+ ts.createFileMap = createFileMap;
34
64
function forEach(array, callback) {
35
65
if (array) {
36
66
for (var i = 0, len = array.length; i < len; i++) {
@@ -7758,7 +7788,7 @@ var ts;
7758
7788
token === 18) {
7759
7789
return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers);
7760
7790
}
7761
- if (decorators) {
7791
+ if (decorators || modifiers ) {
7762
7792
var name_3 = createMissingNode(65, true, ts.Diagnostics.Declaration_expected);
7763
7793
return parsePropertyDeclaration(fullStart, decorators, modifiers, name_3, undefined);
7764
7794
}
@@ -8162,7 +8192,7 @@ var ts;
8162
8192
case 85:
8163
8193
return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);
8164
8194
default:
8165
- if (decorators) {
8195
+ if (decorators || modifiers ) {
8166
8196
var node = createMissingNode(219, true, ts.Diagnostics.Declaration_expected);
8167
8197
node.pos = fullStart;
8168
8198
node.decorators = decorators;
@@ -8238,7 +8268,7 @@ var ts;
8238
8268
}
8239
8269
sourceFile.referencedFiles = referencedFiles;
8240
8270
sourceFile.amdDependencies = amdDependencies;
8241
- sourceFile.amdModuleName = amdModuleName;
8271
+ sourceFile.moduleName = amdModuleName;
8242
8272
}
8243
8273
function setExternalModuleIndicator(sourceFile) {
8244
8274
sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) {
@@ -8849,21 +8879,24 @@ var ts;
8849
8879
if (!ts.isExternalModule(location))
8850
8880
break;
8851
8881
case 206:
8852
- if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) {
8853
- if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 218)) {
8854
- break loop;
8855
- }
8856
- result = undefined;
8857
- }
8858
- else if (location.kind === 228 ||
8882
+ var moduleExports = getSymbolOfNode(location).exports;
8883
+ if (location.kind === 228 ||
8859
8884
(location.kind === 206 && location.name.kind === 8)) {
8860
- result = getSymbolOfNode(location).exports["default"];
8885
+ if (ts.hasProperty(moduleExports, name) &&
8886
+ moduleExports[name].flags === 8388608 &&
8887
+ ts.getDeclarationOfKind(moduleExports[name], 218)) {
8888
+ break;
8889
+ }
8890
+ result = moduleExports["default"];
8861
8891
var localSymbol = ts.getLocalSymbolForExportDefault(result);
8862
8892
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
8863
8893
break loop;
8864
8894
}
8865
8895
result = undefined;
8866
8896
}
8897
+ if (result = getSymbol(moduleExports, name, meaning & 8914931)) {
8898
+ break loop;
8899
+ }
8867
8900
break;
8868
8901
case 205:
8869
8902
if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) {
@@ -24450,10 +24483,10 @@ var ts;
24450
24483
emitSetters(exportStarFunction);
24451
24484
writeLine();
24452
24485
emitExecute(node, startIndex);
24453
- emitTempDeclarations(true);
24454
24486
decreaseIndent();
24455
24487
writeLine();
24456
24488
write("}");
24489
+ emitTempDeclarations(true);
24457
24490
}
24458
24491
function emitSetters(exportStarFunction) {
24459
24492
write("setters:[");
@@ -24553,7 +24586,11 @@ var ts;
24553
24586
collectExternalModuleInfo(node);
24554
24587
ts.Debug.assert(!exportFunctionForFile);
24555
24588
exportFunctionForFile = makeUniqueName("exports");
24556
- write("System.register([");
24589
+ write("System.register(");
24590
+ if (node.moduleName) {
24591
+ write("\"" + node.moduleName + "\", ");
24592
+ }
24593
+ write("[");
24557
24594
for (var i = 0; i < externalImports.length; ++i) {
24558
24595
var text = getExternalModuleNameText(externalImports[i]);
24559
24596
if (i !== 0) {
@@ -24626,8 +24663,8 @@ var ts;
24626
24663
collectExternalModuleInfo(node);
24627
24664
writeLine();
24628
24665
write("define(");
24629
- if (node.amdModuleName ) {
24630
- write("\"" + node.amdModuleName + "\", ");
24666
+ if (node.moduleName ) {
24667
+ write("\"" + node.moduleName + "\", ");
24631
24668
}
24632
24669
emitAMDDependencies(node, true);
24633
24670
write(") {");
@@ -25201,14 +25238,14 @@ var ts;
25201
25238
function createProgram(rootNames, options, host) {
25202
25239
var program;
25203
25240
var files = [];
25204
- var filesByName = {};
25205
25241
var diagnostics = ts.createDiagnosticCollection();
25206
25242
var seenNoDefaultLib = options.noLib;
25207
25243
var commonSourceDirectory;
25208
25244
var diagnosticsProducingTypeChecker;
25209
25245
var noDiagnosticsTypeChecker;
25210
25246
var start = new Date().getTime();
25211
25247
host = host || createCompilerHost(options);
25248
+ var filesByName = ts.createFileMap(function (fileName) { return host.getCanonicalFileName(fileName); });
25212
25249
ts.forEach(rootNames, function (name) { return processRootFile(name, false); });
25213
25250
if (!seenNoDefaultLib) {
25214
25251
processRootFile(host.getDefaultLibFileName(options), true);
@@ -25264,8 +25301,7 @@ var ts;
25264
25301
return emitResult;
25265
25302
}
25266
25303
function getSourceFile(fileName) {
25267
- fileName = host.getCanonicalFileName(ts.normalizeSlashes(fileName));
25268
- return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined;
25304
+ return filesByName.get(fileName);
25269
25305
}
25270
25306
function getDiagnosticsHelper(sourceFile, getDiagnostics) {
25271
25307
if (sourceFile) {
@@ -25361,26 +25397,27 @@ var ts;
25361
25397
}
25362
25398
function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) {
25363
25399
var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName));
25364
- if (ts.hasProperty(filesByName, canonicalName)) {
25400
+ if (filesByName.contains( canonicalName)) {
25365
25401
return getSourceFileFromCache(fileName, canonicalName, false);
25366
25402
}
25367
25403
else {
25368
25404
var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
25369
25405
var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath);
25370
- if (ts.hasProperty(filesByName, canonicalAbsolutePath)) {
25406
+ if (filesByName.contains( canonicalAbsolutePath)) {
25371
25407
return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, true);
25372
25408
}
25373
- var file = filesByName[canonicalName] = host.getSourceFile(fileName, options.target, function (hostErrorMessage) {
25409
+ var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) {
25374
25410
if (refFile) {
25375
25411
diagnostics.add(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
25376
25412
}
25377
25413
else {
25378
25414
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
25379
25415
}
25380
25416
});
25417
+ filesByName.set(canonicalName, file);
25381
25418
if (file) {
25382
25419
seenNoDefaultLib = seenNoDefaultLib || file.hasNoDefaultLib;
25383
- filesByName[ canonicalAbsolutePath] = file;
25420
+ filesByName.set( canonicalAbsolutePath, file) ;
25384
25421
if (!options.noResolve) {
25385
25422
var basePath = ts.getDirectoryPath(fileName);
25386
25423
processReferencedFiles(file, basePath);
@@ -25396,7 +25433,7 @@ var ts;
25396
25433
return file;
25397
25434
}
25398
25435
function getSourceFileFromCache(fileName, canonicalName, useAbsolutePath) {
25399
- var file = filesByName[ canonicalName] ;
25436
+ var file = filesByName.get( canonicalName) ;
25400
25437
if (file && host.useCaseSensitiveFileNames()) {
25401
25438
var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName;
25402
25439
if (canonicalName !== sourceFileName) {
0 commit comments