feat(transpiler): Transform template strings to triple quoted Dart strings

This commit is contained in:
Tommy Odom 2014-11-09 10:06:20 -05:00 committed by Rado Kirov
parent 4f416694a5
commit 93f6d26f68
2 changed files with 8 additions and 4 deletions

View File

@ -5,5 +5,10 @@ export function main() {
it('string interpolation', function() {
expect(`${123}-'${456}"`).toEqual('123-\'456"');
});
it('multiline string', function () {
expect(`1'
2"`).toEqual('1\'\n2"');
});
});
}

View File

@ -75,12 +75,11 @@ export class DartParseTreeWriter extends JavaScriptParseTreeWriter {
visitTemplateLiteralExpression(tree) {
if (tree.operand) {
this.visitAny(tree.operand);
this.writeSpace_();
throw new Error('tagged template strings are not supported');
}
this.writeRaw_('"');
this.writeRaw_("'''");
this.visitList(tree.elements);
this.writeRaw_('"');
this.writeRaw_("'''");
}
visitTemplateLiteralPortion(tree) {