Skip to content

Commit d02d9bf

Browse files
committed
Merge branch 'master' into typeWriter
Conflicts: src/compiler/checker.ts
2 parents dc44edf + 7a5512c commit d02d9bf

File tree

4 files changed

+84
-30
lines changed

4 files changed

+84
-30
lines changed

src/compiler/checker.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,32 @@ module ts {
2525

2626
var emptyArray: any[] = [];
2727
var emptySymbols: SymbolTable = {};
28+
29+
var checker: TypeChecker = {
30+
getProgram: () => program,
31+
getDiagnostics: getDiagnostics,
32+
getGlobalDiagnostics: getGlobalDiagnostics,
33+
getNodeCount: () => sum(program.getSourceFiles(), "nodeCount"),
34+
getIdentifierCount: () => sum(program.getSourceFiles(), "identifierCount"),
35+
getSymbolCount: () => sum(program.getSourceFiles(), "symbolCount"),
36+
getTypeCount: () => typeCount,
37+
checkProgram: checkProgram,
38+
emitFiles: invokeEmitter,
39+
getParentOfSymbol: getParentOfSymbol,
40+
getTypeOfSymbol: getTypeOfSymbol,
41+
getPropertiesOfType: getPropertiesOfType,
42+
getPropertyOfType: getPropertyOfType,
43+
getSignaturesOfType: getSignaturesOfType,
44+
getIndexTypeOfType: getIndexTypeOfType,
45+
getReturnTypeOfSignature: getReturnTypeOfSignature,
46+
getSymbolsInScope: getSymbolsInScope,
47+
getSymbolInfo: getSymbolInfo,
48+
getTypeOfNode: getTypeOfNode,
49+
getApparentType: getApparentType,
50+
typeToString: typeToString,
51+
symbolToString: symbolToString,
52+
getAugmentedPropertiesOfApparentType: getAugmentedPropertiesOfApparentType
53+
};
2854

2955
var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined");
3056
var argumentsSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "arguments");
@@ -71,32 +97,6 @@ module ts {
7197
var diagnostics: Diagnostic[] = [];
7298
var diagnosticsModified: boolean = false;
7399

74-
var checker: TypeChecker = {
75-
getProgram: () => program,
76-
getDiagnostics: getDiagnostics,
77-
getGlobalDiagnostics: getGlobalDiagnostics,
78-
getNodeCount: () => sum(program.getSourceFiles(), "nodeCount"),
79-
getIdentifierCount: () => sum(program.getSourceFiles(), "identifierCount"),
80-
getSymbolCount: () => sum(program.getSourceFiles(), "symbolCount"),
81-
getTypeCount: () => typeCount,
82-
checkProgram: checkProgram,
83-
emitFiles: invokeEmitter,
84-
getParentOfSymbol: getParentOfSymbol,
85-
getTypeOfSymbol: getTypeOfSymbol,
86-
getPropertiesOfType: getPropertiesOfType,
87-
getPropertyOfType: getPropertyOfType,
88-
getSignaturesOfType: getSignaturesOfType,
89-
getIndexTypeOfType: getIndexTypeOfType,
90-
getReturnTypeOfSignature: getReturnTypeOfSignature,
91-
getSymbolsInScope: getSymbolsInScope,
92-
getSymbolInfo: getSymbolInfo,
93-
getTypeOfNode: getTypeOfNode,
94-
getApparentType: getApparentType,
95-
typeToString: typeToString,
96-
symbolToString: symbolToString,
97-
getAugmentedPropertiesOfApparentType: getAugmentedPropertiesOfApparentType
98-
};
99-
100100
function addDiagnostic(diagnostic: Diagnostic) {
101101
diagnostics.push(diagnostic);
102102
diagnosticsModified = true;
@@ -778,7 +778,7 @@ module ts {
778778
// But it cant, hence the accessible is going to be undefined, but that doesnt mean m.c is accessible
779779
// It is accessible if the parent m is accessible because then m.c can be accessed through qualification
780780
meaningToLook = getQualifiedLeftMeaning(meaning);
781-
symbol = symbol.parent;
781+
symbol = getParentOfSymbol(symbol);
782782
}
783783

784784
// This could be a symbol that is not exported in the external module
@@ -901,7 +901,7 @@ module ts {
901901
if (accessibleSymbolChain && !needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {
902902
break;
903903
}
904-
symbol = accessibleSymbolChain ? accessibleSymbolChain[0].parent : symbol.parent;
904+
symbol = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
905905
meaning = getQualifiedLeftMeaning(meaning);
906906
}
907907

src/compiler/tsc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module ts {
3838
}
3939

4040
function trySetLanguageAndTerritory(language: string, territory: string, errors: Diagnostic[]): boolean {
41-
var compilerFilePath = sys.getExecutingFilePath();
41+
var compilerFilePath = normalizePath(sys.getExecutingFilePath());
4242
var containingDirectoryPath = getDirectoryPath(compilerFilePath);
4343

4444
var filePath = combinePaths(containingDirectoryPath, language);
@@ -62,7 +62,7 @@ module ts {
6262
return false;
6363
}
6464
try {
65-
localizedDiagnosticMessages = JSON.parse(fileContents);
65+
ts.localizedDiagnosticMessages = JSON.parse(fileContents);
6666
}
6767
catch (e) {
6868
errors.push(createCompilerDiagnostic(Diagnostics.Corrupted_locale_file_0, filePath));
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//// [tests/cases/compiler/moduleSymbolMerging.ts] ////
2+
3+
//// [A.ts]
4+
5+
module A { export interface I {} }
6+
7+
//// [B.ts]
8+
///<reference path="A.ts" />
9+
module A { ; }
10+
module B {
11+
export function f(): A.I { return null; }
12+
}
13+
14+
15+
16+
//// [A.js]
17+
//// [B.js]
18+
var A;
19+
(function (A) {
20+
;
21+
})(A || (A = {}));
22+
var B;
23+
(function (B) {
24+
function f() {
25+
return null;
26+
}
27+
B.f = f;
28+
})(B || (B = {}));
29+
30+
31+
//// [A.d.ts]
32+
declare module A {
33+
interface I {
34+
}
35+
}
36+
//// [B.d.ts]
37+
/// <reference path='A.d.ts' />
38+
declare module A {
39+
}
40+
declare module B {
41+
function f(): A.I;
42+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// @declaration: true
2+
3+
// @Filename: A.ts
4+
module A { export interface I {} }
5+
6+
// @Filename: B.ts
7+
///<reference path="A.ts" />
8+
module A { ; }
9+
module B {
10+
export function f(): A.I { return null; }
11+
}
12+

0 commit comments

Comments
 (0)