| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 { | 94 { |
| 95 let z = one + 3; | 95 let z = one + 3; |
| 96 const v = one + 5; | 96 const v = one + 5; |
| 97 function f() { | 97 function f() { |
| 98 assertEquals(1, eval('one')); | 98 assertEquals(1, eval('one')); |
| 99 assertEquals(2, eval('x')); | 99 assertEquals(2, eval('x')); |
| 100 assertEquals(3, eval('y')); | 100 assertEquals(3, eval('y')); |
| 101 assertEquals(4, eval('z')); | 101 assertEquals(4, eval('z')); |
| 102 assertEquals(5, eval('u')); | 102 assertEquals(5, eval('u')); |
| 103 assertEquals(6, eval('v')); | 103 assertEquals(6, eval('v')); |
| 104 }; | 104 } |
| 105 f(); |
| 105 } | 106 } |
| 106 } | 107 } |
| 107 f4(1); | 108 f4(1); |
| 108 | 109 |
| 109 | 110 |
| 110 // Lookup from closure. | 111 // Lookup from closure. |
| 111 function f5(one) { | 112 function f5(one) { |
| 112 var x = one + 1; | 113 var x = one + 1; |
| 113 let y = one + 2; | 114 let y = one + 2; |
| 114 const u = one + 4; | 115 const u = one + 4; |
| 115 { | 116 { |
| 116 let z = one + 3; | 117 let z = one + 3; |
| 117 const v = one + 5; | 118 const v = one + 5; |
| 118 function f() { | 119 function f() { |
| 119 assertEquals(1, one); | 120 assertEquals(1, one); |
| 120 assertEquals(2, x); | 121 assertEquals(2, x); |
| 121 assertEquals(3, y); | 122 assertEquals(3, y); |
| 122 assertEquals(4, z); | 123 assertEquals(4, z); |
| 123 assertEquals(5, u); | 124 assertEquals(5, u); |
| 124 assertEquals(6, v); | 125 assertEquals(6, v); |
| 125 }; | 126 } |
| 127 f(); |
| 126 } | 128 } |
| 127 } | 129 } |
| 128 f5(1); | 130 f5(1); |
| 129 | 131 |
| 130 | 132 |
| 131 // Return from block. | 133 // Return from block. |
| 132 function f6() { | 134 function f6() { |
| 133 let x = 1; | 135 let x = 1; |
| 134 const u = 3; | 136 const u = 3; |
| 135 { | 137 { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 const_accessors[i] = function() { return z; } | 262 const_accessors[i] = function() { return z; } |
| 261 } | 263 } |
| 262 for (var j = 0; j < 10; j++) { | 264 for (var j = 0; j < 10; j++) { |
| 263 y = j + 10; | 265 y = j + 10; |
| 264 assertEquals(j, let_accessors[j]()); | 266 assertEquals(j, let_accessors[j]()); |
| 265 assertEquals(y, var_accessors[j]()); | 267 assertEquals(y, var_accessors[j]()); |
| 266 assertEquals(j, const_accessors[j]()); | 268 assertEquals(j, const_accessors[j]()); |
| 267 } | 269 } |
| 268 } | 270 } |
| 269 f8(); | 271 f8(); |
| OLD | NEW |