| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 261 |
| 262 const h; var h = 1; | 262 const h; var h = 1; |
| 263 assertEquals(undefined,h, "h has wrong value"); | 263 assertEquals(undefined,h, "h has wrong value"); |
| 264 | 264 |
| 265 eval("Object.defineProperty(this, 'i', { writable: true });" | 265 eval("Object.defineProperty(this, 'i', { writable: true });" |
| 266 + "const i = 7;" | 266 + "const i = 7;" |
| 267 + "assertEquals(7, i, \"i has wrong value\");"); | 267 + "assertEquals(7, i, \"i has wrong value\");"); |
| 268 | 268 |
| 269 var global = this; | 269 var global = this; |
| 270 assertThrows(function() { | 270 assertThrows(function() { |
| 271 Object.defineProperty(global, 'j', { writable: true }) | 271 Object.defineProperty(global, 'j', { writable: true }); |
| 272 }, TypeError); | 272 }, TypeError); |
| 273 const j = 2; // This is what makes the function above throw, because the | 273 const j = 2; // This is what makes the function above throw, because the |
| 274 // const declaration gets hoisted and makes the property non-configurable. | 274 // const declaration gets hoisted and makes the property non-configurable. |
| 275 assertEquals(2, j, "j has wrong value"); | 275 assertEquals(2, j, "j has wrong value"); |
| 276 | 276 |
| 277 var k = 1; const k; | 277 var k = 1; const k; |
| 278 // You could argue about the expected result here. For now, the winning | 278 // You could argue about the expected result here. For now, the winning |
| 279 // argument is that "const k;" is equivalent to "const k = undefined;". | 279 // argument is that "const k;" is equivalent to "const k = undefined;". |
| 280 assertEquals(undefined, k, "k has wrong value"); | 280 assertEquals(undefined, k, "k has wrong value"); |
| OLD | NEW |