Merge branch 'master' into cancellableDiagnostics
Conflicts: src/compiler/checker.ts src/compiler/program.ts src/compiler/types.ts src/services/services.ts
This commit is contained in:
commit
e015b17638
|
@ -159,6 +159,14 @@ namespace ts {
|
|||
}
|
||||
};
|
||||
|
||||
let subtypeRelation: Map<RelationComparisonResult> = {};
|
||||
let assignableRelation: Map<RelationComparisonResult> = {};
|
||||
let identityRelation: Map<RelationComparisonResult> = {};
|
||||
|
||||
initializeTypeChecker();
|
||||
|
||||
return checker;
|
||||
|
||||
function getEmitResolver(sourceFile: SourceFile, cancellationToken: CancellationTokenObject) {
|
||||
// Ensure we have all the type information in place for this file so that all the
|
||||
// emitter questions of this resolver will return the right information.
|
||||
|
@ -4221,10 +4229,6 @@ namespace ts {
|
|||
|
||||
// TYPE CHECKING
|
||||
|
||||
let subtypeRelation: Map<RelationComparisonResult> = {};
|
||||
let assignableRelation: Map<RelationComparisonResult> = {};
|
||||
let identityRelation: Map<RelationComparisonResult> = {};
|
||||
|
||||
function isTypeIdenticalTo(source: Type, target: Type): boolean {
|
||||
return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined);
|
||||
}
|
||||
|
@ -13641,9 +13645,5 @@ namespace ts {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
initializeTypeChecker();
|
||||
|
||||
return checker;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,8 +105,9 @@ namespace ts {
|
|||
}
|
||||
|
||||
export function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationTokenObject): Diagnostic[] {
|
||||
let diagnostics = program.getSyntacticDiagnostics(sourceFile, cancellationToken).concat(
|
||||
program.getGlobalDiagnostics(cancellationToken)).concat(
|
||||
let diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(
|
||||
program.getSyntacticDiagnostics(sourceFile, cancellationToken),
|
||||
program.getGlobalDiagnostics(cancellationToken),
|
||||
program.getSemanticDiagnostics(sourceFile, cancellationToken));
|
||||
|
||||
if (program.getCompilerOptions().declaration) {
|
||||
|
@ -179,10 +180,10 @@ namespace ts {
|
|||
getSourceFiles: () => files,
|
||||
getCompilerOptions: () => options,
|
||||
getSyntacticDiagnostics,
|
||||
getOptionsDiagnostics,
|
||||
getGlobalDiagnostics,
|
||||
getSemanticDiagnostics,
|
||||
getDeclarationDiagnostics,
|
||||
getCompilerOptionsDiagnostics,
|
||||
getTypeChecker,
|
||||
getClassifiableNames,
|
||||
getDiagnosticsProducingTypeChecker,
|
||||
|
@ -344,19 +345,15 @@ namespace ts {
|
|||
});
|
||||
}
|
||||
|
||||
function getCompilerOptionsDiagnostics(): Diagnostic[] {
|
||||
function getOptionsDiagnostics(): Diagnostic[] {
|
||||
let allDiagnostics: Diagnostic[] = [];
|
||||
addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
|
||||
return sortAndDeduplicateDiagnostics(allDiagnostics);
|
||||
}
|
||||
|
||||
function getGlobalDiagnostics(): Diagnostic[] {
|
||||
let typeChecker = getDiagnosticsProducingTypeChecker();
|
||||
|
||||
let allDiagnostics: Diagnostic[] = [];
|
||||
addRange(allDiagnostics, typeChecker.getGlobalDiagnostics());
|
||||
addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
|
||||
|
||||
addRange(allDiagnostics, getDiagnosticsProducingTypeChecker().getGlobalDiagnostics());
|
||||
return sortAndDeduplicateDiagnostics(allDiagnostics);
|
||||
}
|
||||
|
||||
|
|
|
@ -1212,11 +1212,11 @@ namespace ts {
|
|||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationTokenObject): EmitResult;
|
||||
|
||||
getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationTokenObject): Diagnostic[];
|
||||
getOptionsDiagnostics(cancellationToken?: CancellationTokenObject): Diagnostic[];
|
||||
getGlobalDiagnostics(cancellationToken?: CancellationTokenObject): Diagnostic[];
|
||||
getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationTokenObject): Diagnostic[];
|
||||
getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationTokenObject): Diagnostic[];
|
||||
getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationTokenObject): Diagnostic[];
|
||||
/* @internal */ getCompilerOptionsDiagnostics(cancellationToken?: CancellationTokenObject): Diagnostic[];
|
||||
|
||||
/**
|
||||
* Gets a type checker that can be used to semantically analyze source fils in the program.
|
||||
|
|
|
@ -973,6 +973,9 @@ namespace ts {
|
|||
|
||||
getSyntacticDiagnostics(fileName: string): Diagnostic[];
|
||||
getSemanticDiagnostics(fileName: string): Diagnostic[];
|
||||
|
||||
// TODO: Rename this to getProgramDiagnostics to better indicate that these are any
|
||||
// diagnostics present for the program level, and not just 'options' diagnostics.
|
||||
getCompilerOptionsDiagnostics(): Diagnostic[];
|
||||
|
||||
/**
|
||||
|
@ -1790,8 +1793,8 @@ namespace ts {
|
|||
|
||||
var program = createProgram([inputFileName], options, compilerHost);
|
||||
|
||||
addRange(/*to*/ diagnostics, /*from*/ sourceFile.parseDiagnostics);
|
||||
addRange(/*to*/ diagnostics, /*from*/ program.getCompilerOptionsDiagnostics());
|
||||
addRange(/*to*/ diagnostics, /*from*/ program.getSyntacticDiagnostics(sourceFile));
|
||||
addRange(/*to*/ diagnostics, /*from*/ program.getOptionsDiagnostics());
|
||||
|
||||
// Emit
|
||||
program.emit();
|
||||
|
@ -2770,7 +2773,8 @@ namespace ts {
|
|||
|
||||
function getCompilerOptionsDiagnostics() {
|
||||
synchronizeHostData();
|
||||
return program.getGlobalDiagnostics(cancellationToken);
|
||||
return program.getOptionsDiagnostics(cancellationToken).concat(
|
||||
program.getGlobalDiagnostics(cancellationToken));
|
||||
}
|
||||
|
||||
/// Completion
|
||||
|
|
|
@ -10,7 +10,7 @@ if (perftest.hasLogIOFlag()) {
|
|||
var content = perftest.readFile(s);
|
||||
return content !== undefined ? ts.createSourceFile(s, content, v) : undefined;
|
||||
},
|
||||
getDefaultLibFilename: () => ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(perftest.getExecutingFilePath())), "lib.d.ts"),
|
||||
getDefaultLibFileName: () => ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(perftest.getExecutingFilePath())), "lib.d.ts"),
|
||||
writeFile: (f: string, content: string) => { throw new Error("Unexpected operation: writeFile"); },
|
||||
getCurrentDirectory: () => perftest.getCurrentDirectory(),
|
||||
getCanonicalFileName: (f: string) => ts.sys.useCaseSensitiveFileNames ? f : f.toLowerCase(),
|
||||
|
@ -19,8 +19,8 @@ if (perftest.hasLogIOFlag()) {
|
|||
};
|
||||
|
||||
var commandLine = ts.parseCommandLine(perftest.getArgsWithoutLogIOFlag());
|
||||
var program = ts.createProgram(commandLine.filenames, commandLine.options, compilerHost);
|
||||
var fileNames = program.getSourceFiles().map(f => f.filename);
|
||||
var program = ts.createProgram(commandLine.fileNames, commandLine.options, compilerHost);
|
||||
var fileNames = program.getSourceFiles().map(f => f.fileName);
|
||||
perftest.writeIOLog(fileNames);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in a new issue