Add another test for runtime order of template literals (#6092)
More proof that it really is unsafe to merge the .concat calls if the
value is an expression that has any chance of executing impure code 😢
This commit is contained in:
parent
cd66657f34
commit
0538c3cd8c
19
packages/babel-plugin-transform-es2015-template-literals/test/fixtures/spec/order2/exec.js
vendored
Normal file
19
packages/babel-plugin-transform-es2015-template-literals/test/fixtures/spec/order2/exec.js
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
const calls = [];
|
||||
|
||||
`
|
||||
${{
|
||||
[Symbol.toPrimitive]() {
|
||||
calls.push(1);
|
||||
return "foo";
|
||||
}
|
||||
}}
|
||||
${1 +
|
||||
{
|
||||
valueOf() {
|
||||
calls.push(2);
|
||||
return 2;
|
||||
}
|
||||
}}
|
||||
`;
|
||||
|
||||
assert.deepEqual(calls, [1, 2]);
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"minNodeVersion": "6.0.0"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user