Merge pull request #2790 from moretti/issue-2613
Preserve indentation in template literals, fixes #2613
This commit is contained in:
commit
9eee677321
@ -18,7 +18,7 @@ export function TemplateLiteral(node: Object) {
|
||||
this.print(quasis[i], node);
|
||||
|
||||
if (i + 1 < quasis.length) {
|
||||
this.push("${ ");
|
||||
this._push("${ ");
|
||||
this.print(node.expressions[i], node);
|
||||
this.push(" }");
|
||||
}
|
||||
|
||||
18
packages/babel-generator/test/fixtures/harmony-edgecase/templates-indentation/actual.js
vendored
Normal file
18
packages/babel-generator/test/fixtures/harmony-edgecase/templates-indentation/actual.js
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
function multilineTemplate() {
|
||||
return `I'm done reconfoobling
|
||||
${ 'the energy motron' }
|
||||
${'...or whatever'}`;
|
||||
}
|
||||
|
||||
{
|
||||
const foo = `spam
|
||||
and eggs!`;
|
||||
|
||||
const bar = `${
|
||||
4 +
|
||||
2
|
||||
}`;
|
||||
|
||||
const hello = `Hello
|
||||
${ 'world' }`;
|
||||
}
|
||||
15
packages/babel-generator/test/fixtures/harmony-edgecase/templates-indentation/expected.js
vendored
Normal file
15
packages/babel-generator/test/fixtures/harmony-edgecase/templates-indentation/expected.js
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
function multilineTemplate() {
|
||||
return `I'm done reconfoobling
|
||||
${ 'the energy motron' }
|
||||
${ '...or whatever' }`;
|
||||
}
|
||||
|
||||
{
|
||||
const foo = `spam
|
||||
and eggs!`;
|
||||
|
||||
const bar = `${ 4 + 2 }`;
|
||||
|
||||
const hello = `Hello
|
||||
${ 'world' }`;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user