Move grammar checking: taggedTemplateExpression

This commit is contained in:
Yui T
2014-12-14 21:12:14 -08:00
parent a4f17b1417
commit b388eb3c2a
9 changed files with 33 additions and 27 deletions
+5
View File
@@ -6303,6 +6303,11 @@ module ts {
}
function checkTaggedTemplateExpression(node: TaggedTemplateExpression): Type {
// Grammar checking
if (compilerOptions.target < ScriptTarget.ES6) {
grammarErrorOnFirstToken(node.template, Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher);
}
return getReturnTypeOfSignature(getResolvedSignature(node));
}
@@ -119,7 +119,7 @@ module ts {
const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized", isEarly: true },
const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block.", isEarly: true },
let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block.", isEarly: true },
Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." },
Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher.", isEarly: true },
Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." },
Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." },
An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional.", isEarly: true },
+2 -1
View File
@@ -540,7 +540,8 @@
},
"Tagged templates are only available when targeting ECMAScript 6 and higher.": {
"category": "Error",
"code": 1159
"code": 1159,
"isEarly": true
},
"Unterminated template literal.": {
"category": "Error",
+1 -1
View File
@@ -4670,7 +4670,7 @@ module ts {
case SyntaxKind.SourceFile: return checkSourceFile(<SourceFile>node);
//case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(<ShorthandPropertyAssignment>node);
//case SyntaxKind.SwitchStatement: return checkSwitchStatement(<SwitchStatement>node);
case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(<TaggedTemplateExpression>node);
//case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(<TaggedTemplateExpression>node);
case SyntaxKind.ThrowStatement: return checkThrowStatement(<ThrowStatement>node);
case SyntaxKind.TypeReference: return checkTypeReference(<TypeReferenceNode>node);
case SyntaxKind.VariableDeclaration: return checkVariableDeclaration(<VariableDeclaration>node);