Skip to content

Commit 93f6d26

Browse files
Tommy Odomrkirov
authored andcommitted
feat(transpiler): Transform template strings to triple quoted Dart strings
1 parent 4f41669 commit 93f6d26

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

tools/transpiler/spec/lang_spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,10 @@ export function main() {
55
it('string interpolation', function() {
66
expect(`${123}-'${456}"`).toEqual('123-\'456"');
77
});
8+
9+
it('multiline string', function () {
10+
expect(`1'
11+
2"`).toEqual('1\'\n2"');
12+
});
813
});
914
}

tools/transpiler/src/outputgeneration/DartParseTreeWriter.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,11 @@ export class DartParseTreeWriter extends JavaScriptParseTreeWriter {
7575

7676
visitTemplateLiteralExpression(tree) {
7777
if (tree.operand) {
78-
this.visitAny(tree.operand);
79-
this.writeSpace_();
78+
throw new Error('tagged template strings are not supported');
8079
}
81-
this.writeRaw_('"');
80+
this.writeRaw_("'''");
8281
this.visitList(tree.elements);
83-
this.writeRaw_('"');
82+
this.writeRaw_("'''");
8483
}
8584

8685
visitTemplateLiteralPortion(tree) {

0 commit comments

Comments
 (0)