mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-27 04:46:25 -05:00
Move grammar check: throwStatement; there are still errors from incomplete grammar migration
This commit is contained in:
@@ -8241,6 +8241,10 @@ module ts {
|
||||
}
|
||||
|
||||
function checkThrowStatement(node: ThrowStatement) {
|
||||
if (node.expression === undefined) {
|
||||
grammarErrorAfterFirstToken(getSourceFileOfNode(node), node, Diagnostics.Line_break_not_permitted_here);
|
||||
}
|
||||
|
||||
if (node.expression) {
|
||||
checkExpression(node.expression);
|
||||
}
|
||||
@@ -10353,6 +10357,15 @@ module ts {
|
||||
return grammarErrorOnNode(node, Diagnostics.Invalid_use_of_0_in_strict_mode, name);
|
||||
}
|
||||
|
||||
function grammarErrorAfterFirstToken(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean {
|
||||
if (!hasParseDiagnostics(sourceFile)) {
|
||||
var scanner = createScanner(compilerOptions.target, /*skipTrivia*/ true, sourceFile.text);
|
||||
scanToken(scanner, node.pos);
|
||||
diagnostics.push(createFileDiagnostic(sourceFile, scanner.getTextPos(), 0, message, arg0, arg1, arg2));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
initializeTypeChecker();
|
||||
|
||||
return checker;
|
||||
|
||||
@@ -105,7 +105,7 @@ module ts {
|
||||
Type_parameter_declaration_expected: { code: 1139, category: DiagnosticCategory.Error, key: "Type parameter declaration expected." },
|
||||
Type_argument_expected: { code: 1140, category: DiagnosticCategory.Error, key: "Type argument expected." },
|
||||
String_literal_expected: { code: 1141, category: DiagnosticCategory.Error, key: "String literal expected.", isEarly: true },
|
||||
Line_break_not_permitted_here: { code: 1142, category: DiagnosticCategory.Error, key: "Line break not permitted here." },
|
||||
Line_break_not_permitted_here: { code: 1142, category: DiagnosticCategory.Error, key: "Line break not permitted here.", isEarly: true },
|
||||
or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "'{' or ';' expected." },
|
||||
Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members.", isEarly: true },
|
||||
Declaration_expected: { code: 1146, category: DiagnosticCategory.Error, key: "Declaration expected." },
|
||||
|
||||
@@ -476,7 +476,8 @@
|
||||
},
|
||||
"Line break not permitted here.": {
|
||||
"category": "Error",
|
||||
"code": 1142
|
||||
"code": 1142,
|
||||
"isEarly": true
|
||||
},
|
||||
"'{' or ';' expected.": {
|
||||
"category": "Error",
|
||||
|
||||
@@ -4671,7 +4671,7 @@ module ts {
|
||||
//case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(<ShorthandPropertyAssignment>node);
|
||||
//case SyntaxKind.SwitchStatement: return checkSwitchStatement(<SwitchStatement>node);
|
||||
//case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(<TaggedTemplateExpression>node);
|
||||
case SyntaxKind.ThrowStatement: return checkThrowStatement(<ThrowStatement>node);
|
||||
//case SyntaxKind.ThrowStatement: return checkThrowStatement(<ThrowStatement>node);
|
||||
case SyntaxKind.TypeReference: return checkTypeReference(<TypeReferenceNode>node);
|
||||
case SyntaxKind.VariableDeclaration: return checkVariableDeclaration(<VariableDeclaration>node);
|
||||
case SyntaxKind.VariableStatement: return checkVariableStatement(<VariableStatement>node);
|
||||
|
||||
Reference in New Issue
Block a user