feat(transpiler): Transform template strings to triple quoted Dart strings
This commit is contained in:
parent
4f416694a5
commit
93f6d26f68
|
@ -5,5 +5,10 @@ export function main() {
|
||||||
it('string interpolation', function() {
|
it('string interpolation', function() {
|
||||||
expect(`${123}-'${456}"`).toEqual('123-\'456"');
|
expect(`${123}-'${456}"`).toEqual('123-\'456"');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('multiline string', function () {
|
||||||
|
expect(`1'
|
||||||
|
2"`).toEqual('1\'\n2"');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,12 +75,11 @@ export class DartParseTreeWriter extends JavaScriptParseTreeWriter {
|
||||||
|
|
||||||
visitTemplateLiteralExpression(tree) {
|
visitTemplateLiteralExpression(tree) {
|
||||||
if (tree.operand) {
|
if (tree.operand) {
|
||||||
this.visitAny(tree.operand);
|
throw new Error('tagged template strings are not supported');
|
||||||
this.writeSpace_();
|
|
||||||
}
|
}
|
||||||
this.writeRaw_('"');
|
this.writeRaw_("'''");
|
||||||
this.visitList(tree.elements);
|
this.visitList(tree.elements);
|
||||||
this.writeRaw_('"');
|
this.writeRaw_("'''");
|
||||||
}
|
}
|
||||||
|
|
||||||
visitTemplateLiteralPortion(tree) {
|
visitTemplateLiteralPortion(tree) {
|
||||||
|
|
Loading…
Reference in New Issue