mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 02:15:10 -05:00
Initial refactoring to support doing grammar checks as a separate pass of the tree.
Right now, this means hiding 'syntacticDiagnostics' behind a getter function that only computes all the syntactic diagnostics (parser+grammar checks) lazily. This will help incremental parsing out as we can reuse nodes that have grammar errors in them, and we dont' have to even do grammar checks if this is not the full-type-check type-checker.
This commit is contained in:
@@ -252,7 +252,7 @@ module ts.formatting {
|
||||
rulesProvider: RulesProvider,
|
||||
requestKind: FormattingRequestKind): TextChange[] {
|
||||
|
||||
var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.syntacticErrors, originalRange);
|
||||
var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.getSyntacticDiagnostics(), originalRange);
|
||||
|
||||
// formatting context is used by rules provider
|
||||
var formattingContext = new FormattingContext(sourceFile, requestKind);
|
||||
|
||||
@@ -714,14 +714,18 @@ module ts {
|
||||
class SourceFileObject extends NodeObject implements SourceFile {
|
||||
public filename: string;
|
||||
public text: string;
|
||||
|
||||
// These methods will have their implementation overridden with the implementation the
|
||||
// compiler actually exports off of SourceFile.
|
||||
public getLineAndCharacterFromPosition(position: number): { line: number; character: number } { return null; }
|
||||
public getPositionFromLineAndCharacter(line: number, character: number): number { return -1; }
|
||||
public getLineStarts(): number[] { return undefined; }
|
||||
public getSyntacticDiagnostics(): Diagnostic[] { return undefined; }
|
||||
|
||||
public amdDependencies: string[];
|
||||
public amdModuleName: string;
|
||||
public referencedFiles: FileReference[];
|
||||
public syntacticErrors: Diagnostic[];
|
||||
public semanticErrors: Diagnostic[];
|
||||
public semanticDiagnostics: Diagnostic[];
|
||||
public hasNoDefaultLib: boolean;
|
||||
public externalModuleIndicator: Node; // The first node that causes this file to be an external module
|
||||
public nodeCount: number;
|
||||
|
||||
Reference in New Issue
Block a user