Don't create errors directly when parsing template spans.
This commit is contained in:
parent
2f634b7e54
commit
94febee138
4 changed files with 3 additions and 9 deletions
|
@ -119,7 +119,6 @@ module ts {
|
||||||
const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized" },
|
const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized" },
|
||||||
const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block." },
|
const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block." },
|
||||||
let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." },
|
let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." },
|
||||||
Invalid_template_literal_expected: { code: 1158, category: DiagnosticCategory.Error, key: "Invalid template literal; expected '}'" },
|
|
||||||
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." },
|
||||||
Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." },
|
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." },
|
Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." },
|
||||||
|
|
|
@ -467,10 +467,6 @@
|
||||||
"category": "Error",
|
"category": "Error",
|
||||||
"code": 1157
|
"code": 1157
|
||||||
},
|
},
|
||||||
"Invalid template literal; expected '}'": {
|
|
||||||
"category": "Error",
|
|
||||||
"code": 1158
|
|
||||||
},
|
|
||||||
"Tagged templates are only available when targeting ECMAScript 6 and higher.": {
|
"Tagged templates are only available when targeting ECMAScript 6 and higher.": {
|
||||||
"category": "Error",
|
"category": "Error",
|
||||||
"code": 1159
|
"code": 1159
|
||||||
|
|
|
@ -1676,13 +1676,12 @@ module ts {
|
||||||
literal = parseLiteralNode();
|
literal = parseLiteralNode();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
error(Diagnostics.Invalid_template_literal_expected);
|
parseExpected(SyntaxKind.CloseBraceToken);
|
||||||
literal = <LiteralExpression>createMissingNode();
|
literal = <LiteralExpression>createMissingNode();
|
||||||
literal.text = "";
|
literal.text = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
span.literal = literal;
|
span.literal = literal;
|
||||||
|
|
||||||
return finishNode(span);
|
return finishNode(span);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
tests/cases/conformance/es6/templates/TemplateExpression1.ts(1,19): error TS1158: Invalid template literal; expected '}'
|
tests/cases/conformance/es6/templates/TemplateExpression1.ts(1,19): error TS1005: '}' expected.
|
||||||
tests/cases/conformance/es6/templates/TemplateExpression1.ts(1,17): error TS2304: Cannot find name 'a'.
|
tests/cases/conformance/es6/templates/TemplateExpression1.ts(1,17): error TS2304: Cannot find name 'a'.
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/es6/templates/TemplateExpression1.ts (2 errors) ====
|
==== tests/cases/conformance/es6/templates/TemplateExpression1.ts (2 errors) ====
|
||||||
var v = `foo ${ a
|
var v = `foo ${ a
|
||||||
|
|
||||||
!!! error TS1158: Invalid template literal; expected '}'
|
!!! error TS1005: '}' expected.
|
||||||
~
|
~
|
||||||
!!! error TS2304: Cannot find name 'a'.
|
!!! error TS2304: Cannot find name 'a'.
|
Loading…
Reference in a new issue