Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 5 | // Flags: --no-harmony-restrictive-declarations |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 6 | |
| 7 | // Previously, this caused a CHECK fail in debug mode |
| 8 | // https://code.google.com/p/chromium/issues/detail?id=542099 |
| 9 | |
| 10 | var foo = {}; |
| 11 | var bar = foo; |
| 12 | for (foo.x in {a: 1}) function foo() { return foo; } |
| 13 | assertEquals("object", typeof bar); |
| 14 | assertEquals("a", bar.x); |
| 15 | assertEquals("function", typeof foo); |
| 16 | assertEquals("function", typeof foo()); |
| 17 | assertSame(foo, foo()); |
| 18 | assertEquals(undefined, foo.x); |