Skip to content

Commit

Permalink
Add another test for runtime order of template literals (#6092)
Browse files Browse the repository at this point in the history
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 馃槩
  • Loading branch information
Diogo Franco committed Aug 12, 2017
1 parent cd66657 commit 0538c3c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"minNodeVersion": "6.0.0"
}

0 comments on commit 0538c3c

Please sign in to comment.