| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --harmony-arrow-functions --allow-natives-syntax | 5 // Flags: --allow-natives-syntax |
| 6 | 6 |
| 7 (function(x) { | 7 (function(x) { |
| 8 (function(x) { | 8 (function(x) { |
| 9 var boom = (() => eval(x)); | 9 var boom = (() => eval(x)); |
| 10 assertEquals(23, boom()); | 10 assertEquals(23, boom()); |
| 11 assertEquals(23, boom()); | 11 assertEquals(23, boom()); |
| 12 %OptimizeFunctionOnNextCall(boom); | 12 %OptimizeFunctionOnNextCall(boom); |
| 13 assertEquals(23, boom()); | 13 assertEquals(23, boom()); |
| 14 assertEquals("23", x); | 14 assertEquals("23", x); |
| 15 })("23"); | 15 })("23"); |
| 16 assertEquals("42", x); | 16 assertEquals("42", x); |
| 17 })("42"); | 17 })("42"); |
| 18 | 18 |
| 19 (function(x) { | 19 (function(x) { |
| 20 (function(x) { | 20 (function(x) { |
| 21 var boom = (() => (eval("var x = 66"), x)); | 21 var boom = (() => (eval("var x = 66"), x)); |
| 22 assertEquals(66, boom()); | 22 assertEquals(66, boom()); |
| 23 assertEquals(66, boom()); | 23 assertEquals(66, boom()); |
| 24 %OptimizeFunctionOnNextCall(boom); | 24 %OptimizeFunctionOnNextCall(boom); |
| 25 assertEquals(66, boom()); | 25 assertEquals(66, boom()); |
| 26 assertEquals("23", x); | 26 assertEquals("23", x); |
| 27 })("23"); | 27 })("23"); |
| 28 assertEquals("42", x); | 28 assertEquals("42", x); |
| 29 })("42"); | 29 })("42"); |
| OLD | NEW |