blob: 70fb5dc1473546797dd8ffcd2d47be24280e36a6 [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// 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
5// Flags: --harmony-sloppy --harmony-sloppy-function
Ben Murdochda12d292016-06-02 14:46:10 +01006// Flags: --no-harmony-restrictive-declarations
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00007
8(function() {
9 var x = {a: 1}
10 assertEquals("undefined", typeof f);
11 with (x)
12 function f() { return a; }
13 assertEquals("function", typeof f);
14 assertEquals(1, f());
15 x.a = 2;
16 assertEquals(2, f());
17})();
18
19var y = {b: 1}
20assertEquals("undefined", typeof g);
21with (y)
22 function g() { return b; }
23assertEquals("function", typeof g);
24assertEquals(1, g());
25y.b = 2;
26assertEquals(2, g());