mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Merge branch 'master' into typeWriter
Conflicts: src/compiler/checker.ts
This commit is contained in:
@@ -25,6 +25,32 @@ module ts {
|
||||
|
||||
var emptyArray: any[] = [];
|
||||
var emptySymbols: SymbolTable = {};
|
||||
|
||||
var checker: TypeChecker = {
|
||||
getProgram: () => program,
|
||||
getDiagnostics: getDiagnostics,
|
||||
getGlobalDiagnostics: getGlobalDiagnostics,
|
||||
getNodeCount: () => sum(program.getSourceFiles(), "nodeCount"),
|
||||
getIdentifierCount: () => sum(program.getSourceFiles(), "identifierCount"),
|
||||
getSymbolCount: () => sum(program.getSourceFiles(), "symbolCount"),
|
||||
getTypeCount: () => typeCount,
|
||||
checkProgram: checkProgram,
|
||||
emitFiles: invokeEmitter,
|
||||
getParentOfSymbol: getParentOfSymbol,
|
||||
getTypeOfSymbol: getTypeOfSymbol,
|
||||
getPropertiesOfType: getPropertiesOfType,
|
||||
getPropertyOfType: getPropertyOfType,
|
||||
getSignaturesOfType: getSignaturesOfType,
|
||||
getIndexTypeOfType: getIndexTypeOfType,
|
||||
getReturnTypeOfSignature: getReturnTypeOfSignature,
|
||||
getSymbolsInScope: getSymbolsInScope,
|
||||
getSymbolInfo: getSymbolInfo,
|
||||
getTypeOfNode: getTypeOfNode,
|
||||
getApparentType: getApparentType,
|
||||
typeToString: typeToString,
|
||||
symbolToString: symbolToString,
|
||||
getAugmentedPropertiesOfApparentType: getAugmentedPropertiesOfApparentType
|
||||
};
|
||||
|
||||
var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined");
|
||||
var argumentsSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "arguments");
|
||||
@@ -71,32 +97,6 @@ module ts {
|
||||
var diagnostics: Diagnostic[] = [];
|
||||
var diagnosticsModified: boolean = false;
|
||||
|
||||
var checker: TypeChecker = {
|
||||
getProgram: () => program,
|
||||
getDiagnostics: getDiagnostics,
|
||||
getGlobalDiagnostics: getGlobalDiagnostics,
|
||||
getNodeCount: () => sum(program.getSourceFiles(), "nodeCount"),
|
||||
getIdentifierCount: () => sum(program.getSourceFiles(), "identifierCount"),
|
||||
getSymbolCount: () => sum(program.getSourceFiles(), "symbolCount"),
|
||||
getTypeCount: () => typeCount,
|
||||
checkProgram: checkProgram,
|
||||
emitFiles: invokeEmitter,
|
||||
getParentOfSymbol: getParentOfSymbol,
|
||||
getTypeOfSymbol: getTypeOfSymbol,
|
||||
getPropertiesOfType: getPropertiesOfType,
|
||||
getPropertyOfType: getPropertyOfType,
|
||||
getSignaturesOfType: getSignaturesOfType,
|
||||
getIndexTypeOfType: getIndexTypeOfType,
|
||||
getReturnTypeOfSignature: getReturnTypeOfSignature,
|
||||
getSymbolsInScope: getSymbolsInScope,
|
||||
getSymbolInfo: getSymbolInfo,
|
||||
getTypeOfNode: getTypeOfNode,
|
||||
getApparentType: getApparentType,
|
||||
typeToString: typeToString,
|
||||
symbolToString: symbolToString,
|
||||
getAugmentedPropertiesOfApparentType: getAugmentedPropertiesOfApparentType
|
||||
};
|
||||
|
||||
function addDiagnostic(diagnostic: Diagnostic) {
|
||||
diagnostics.push(diagnostic);
|
||||
diagnosticsModified = true;
|
||||
@@ -778,7 +778,7 @@ module ts {
|
||||
// But it cant, hence the accessible is going to be undefined, but that doesnt mean m.c is accessible
|
||||
// It is accessible if the parent m is accessible because then m.c can be accessed through qualification
|
||||
meaningToLook = getQualifiedLeftMeaning(meaning);
|
||||
symbol = symbol.parent;
|
||||
symbol = getParentOfSymbol(symbol);
|
||||
}
|
||||
|
||||
// This could be a symbol that is not exported in the external module
|
||||
@@ -901,7 +901,7 @@ module ts {
|
||||
if (accessibleSymbolChain && !needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {
|
||||
break;
|
||||
}
|
||||
symbol = accessibleSymbolChain ? accessibleSymbolChain[0].parent : symbol.parent;
|
||||
symbol = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
|
||||
meaning = getQualifiedLeftMeaning(meaning);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ module ts {
|
||||
}
|
||||
|
||||
function trySetLanguageAndTerritory(language: string, territory: string, errors: Diagnostic[]): boolean {
|
||||
var compilerFilePath = sys.getExecutingFilePath();
|
||||
var compilerFilePath = normalizePath(sys.getExecutingFilePath());
|
||||
var containingDirectoryPath = getDirectoryPath(compilerFilePath);
|
||||
|
||||
var filePath = combinePaths(containingDirectoryPath, language);
|
||||
@@ -62,7 +62,7 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
localizedDiagnosticMessages = JSON.parse(fileContents);
|
||||
ts.localizedDiagnosticMessages = JSON.parse(fileContents);
|
||||
}
|
||||
catch (e) {
|
||||
errors.push(createCompilerDiagnostic(Diagnostics.Corrupted_locale_file_0, filePath));
|
||||
|
||||
42
tests/baselines/reference/moduleSymbolMerging.js
Normal file
42
tests/baselines/reference/moduleSymbolMerging.js
Normal file
@@ -0,0 +1,42 @@
|
||||
//// [tests/cases/compiler/moduleSymbolMerging.ts] ////
|
||||
|
||||
//// [A.ts]
|
||||
|
||||
module A { export interface I {} }
|
||||
|
||||
//// [B.ts]
|
||||
///<reference path="A.ts" />
|
||||
module A { ; }
|
||||
module B {
|
||||
export function f(): A.I { return null; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
//// [A.js]
|
||||
//// [B.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
;
|
||||
})(A || (A = {}));
|
||||
var B;
|
||||
(function (B) {
|
||||
function f() {
|
||||
return null;
|
||||
}
|
||||
B.f = f;
|
||||
})(B || (B = {}));
|
||||
|
||||
|
||||
//// [A.d.ts]
|
||||
declare module A {
|
||||
interface I {
|
||||
}
|
||||
}
|
||||
//// [B.d.ts]
|
||||
/// <reference path='A.d.ts' />
|
||||
declare module A {
|
||||
}
|
||||
declare module B {
|
||||
function f(): A.I;
|
||||
}
|
||||
12
tests/cases/compiler/moduleSymbolMerging.ts
Normal file
12
tests/cases/compiler/moduleSymbolMerging.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// @declaration: true
|
||||
|
||||
// @Filename: A.ts
|
||||
module A { export interface I {} }
|
||||
|
||||
// @Filename: B.ts
|
||||
///<reference path="A.ts" />
|
||||
module A { ; }
|
||||
module B {
|
||||
export function f(): A.I { return null; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user