Skip to content

Commit 00a4953

Browse files
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.
1 parent a9cf216 commit 00a4953

6 files changed

Lines changed: 96 additions & 57 deletions

File tree

src/compiler/binder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ module ts {
125125
: Diagnostics.Duplicate_identifier_0;
126126

127127
forEach(symbol.declarations, declaration => {
128-
file.semanticErrors.push(createDiagnosticForNode(declaration.name, message, getDisplayName(declaration)));
128+
file.semanticDiagnostics.push(createDiagnosticForNode(declaration.name, message, getDisplayName(declaration)));
129129
});
130-
file.semanticErrors.push(createDiagnosticForNode(node.name, message, getDisplayName(node)));
130+
file.semanticDiagnostics.push(createDiagnosticForNode(node.name, message, getDisplayName(node)));
131131

132132
symbol = createSymbol(0, name);
133133
}
@@ -148,7 +148,7 @@ module ts {
148148
if (node.name) {
149149
node.name.parent = node;
150150
}
151-
file.semanticErrors.push(createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0],
151+
file.semanticDiagnostics.push(createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0],
152152
Diagnostics.Duplicate_identifier_0, prototypeSymbol.name));
153153
}
154154
symbol.exports[prototypeSymbol.name] = prototypeSymbol;

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9143,7 +9143,7 @@ module ts {
91439143
// Bind all source files and propagate errors
91449144
forEach(program.getSourceFiles(), file => {
91459145
bindSourceFile(file);
9146-
forEach(file.semanticErrors, addDiagnostic);
9146+
forEach(file.semanticDiagnostics, addDiagnostic);
91479147
});
91489148
// Initialize global symbol table
91499149
forEach(program.getSourceFiles(), file => {

0 commit comments

Comments
 (0)