blob: 4f607ed6d23f019cf4e2f46fec34b7039d10a7cc [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// Copyright 2014 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 Murdochb8a8cc12014-11-26 15:28:44 +00005(function f(){
6 assertEquals("function", typeof f);
7})();
8
9(function f(){
10 var f; // Variable shadows function name.
11 assertEquals("undefined", typeof f);
12})();
13
14(function f(){
15 var f;
16 assertEquals("undefined", typeof f);
17 with ({}); // Force context allocation of both variable and function name.
18})();
19
20assertEquals("undefined", typeof f);
21
22// var initialization is intercepted by with scope.
23(function() {
24 var o = { a: 1 };
25 with (o) {
26 var a = 2;
27 }
28 assertEquals("undefined", typeof a);
29 assertEquals(2, o.a);
30})();