Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/tokenizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,15 @@ export class Tokenizer extends DiagnosticEmitter {
var quote = text.charCodeAt(pos++);
var start = pos;
var result = "";

if (quote == CharCode.BACKTICK) {
this.warning(
DiagnosticCode.Not_implemented_0,
this.range(start - 1, end),
"Template Literals can only be used for multi-line strings. Interpolation is not supported."
);
}

while (true) {
if (pos >= end) {
result += text.substring(start, pos);
Expand Down
1 change: 1 addition & 0 deletions tests/parser/literals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
7_;
1.a;
2.0b;
`123`;

// technically invalid, but not handled by AS yet, TS1005: ';' expected
3 4;
Expand Down
2 changes: 2 additions & 0 deletions tests/parser/literals.ts.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ b;
a;
2;
b;
"123";
3;
4;
5;
Expand All @@ -82,3 +83,4 @@ b;
// ERROR 6188: "Numeric separators are not allowed here." in literals.ts(70,2+0)
// ERROR 1351: "An identifier or keyword cannot immediately follow a numeric literal." in literals.ts(71,3+0)
// ERROR 1351: "An identifier or keyword cannot immediately follow a numeric literal." in literals.ts(72,4+0)
// WARNING 100: "Not implemented: Template Literals can only be used for multi-line strings. Interpolation is not supported." in literals.ts(73,1+102)