mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 10:41:56 -05:00
Remove unnecessary diagnostics split on SourceFile.
This commit is contained in:
@@ -357,14 +357,6 @@ module ts {
|
||||
forEachChild(sourceFile, walk);
|
||||
}
|
||||
|
||||
export function getSyntacticDiagnostics(sourceFile: SourceFile): Diagnostic[] {
|
||||
if (!sourceFile.syntacticDiagnostics) {
|
||||
sourceFile.syntacticDiagnostics = sourceFile.referenceDiagnostics.concat(sourceFile.parseDiagnostics);
|
||||
}
|
||||
|
||||
return sourceFile.syntacticDiagnostics;
|
||||
}
|
||||
|
||||
function moveElementEntirelyPastChangeRange(element: IncrementalElement, delta: number) {
|
||||
if (element.length) {
|
||||
visitArray(<IncrementalNodeArray>element);
|
||||
@@ -880,7 +872,6 @@ module ts {
|
||||
sourceFile.end = sourceText.length;
|
||||
sourceFile.text = sourceText;
|
||||
|
||||
sourceFile.referenceDiagnostics = [];
|
||||
sourceFile.parseDiagnostics = [];
|
||||
sourceFile.bindDiagnostics = [];
|
||||
sourceFile.languageVersion = languageVersion;
|
||||
@@ -4698,7 +4689,7 @@ module ts {
|
||||
referencedFiles.push(fileReference);
|
||||
}
|
||||
if (diagnosticMessage) {
|
||||
sourceFile.referenceDiagnostics.push(createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage));
|
||||
sourceFile.parseDiagnostics.push(createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -4706,7 +4697,7 @@ module ts {
|
||||
var amdModuleNameMatchResult = amdModuleNameRegEx.exec(comment);
|
||||
if (amdModuleNameMatchResult) {
|
||||
if (amdModuleName) {
|
||||
sourceFile.referenceDiagnostics.push(createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments));
|
||||
sourceFile.parseDiagnostics.push(createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments));
|
||||
}
|
||||
amdModuleName = amdModuleNameMatchResult[2];
|
||||
}
|
||||
|
||||
@@ -225,13 +225,17 @@ module ts {
|
||||
}
|
||||
|
||||
function getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]{
|
||||
return getDiagnosticsHelper(sourceFile, ts.getSyntacticDiagnostics);
|
||||
return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile);
|
||||
}
|
||||
|
||||
function getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[]{
|
||||
return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile);
|
||||
}
|
||||
|
||||
function getSyntacticDiagnosticsForFile(sourceFile: SourceFile): Diagnostic[] {
|
||||
return sourceFile.parseDiagnostics;
|
||||
}
|
||||
|
||||
function getSemanticDiagnosticsForFile(sourceFile: SourceFile): Diagnostic[] {
|
||||
var typeChecker = getDiagnosticsProducingTypeChecker();
|
||||
|
||||
|
||||
@@ -902,20 +902,13 @@ module ts {
|
||||
/* @internal */ identifierCount: number;
|
||||
/* @internal */ symbolCount: number;
|
||||
|
||||
// Diagnostics reported about the "///<reference" comments in the file.
|
||||
/* @internal */ referenceDiagnostics: Diagnostic[];
|
||||
|
||||
// Parse errors refer specifically to things the parser could not understand at all (like
|
||||
// missing tokens, or tokens it didn't know how to deal with).
|
||||
// File level diagnostics reported by the parser (includes diagnostics about /// references
|
||||
// as well as code diagnostics).
|
||||
/* @internal */ parseDiagnostics: Diagnostic[];
|
||||
|
||||
// File level diagnostics reported by the binder.
|
||||
/* @internal */ bindDiagnostics: Diagnostic[];
|
||||
|
||||
// Returns all syntactic diagnostics (i.e. the reference, parser and grammar diagnostics).
|
||||
// This field should never be used directly, use getSyntacticDiagnostics function instead.
|
||||
/* @internal */ syntacticDiagnostics: Diagnostic[];
|
||||
|
||||
// Stores a line map for the file.
|
||||
// This field should never be used directly to obtain line map, use getLineMap function instead.
|
||||
/* @internal */ lineMap: number[];
|
||||
|
||||
Reference in New Issue
Block a user