summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/regress/regress-3138.js
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2014-03-13 20:45:44 +0400
committerFedor Indutny <fedor.indutny@gmail.com>2014-03-13 20:56:54 +0400
commit1c7bf245dc2d520c005e01bcb56ecb3275971395 (patch)
tree34d8160c98bd8dd33757252d87a0f6586fea8213 /deps/v8/test/mjsunit/regress/regress-3138.js
parent93c3674ff7115fb2a3dbb5b4ffd22f4d5ed9a472 (diff)
downloadnode-new-1c7bf245dc2d520c005e01bcb56ecb3275971395.tar.gz
deps: update v8 to 3.24.40
Diffstat (limited to 'deps/v8/test/mjsunit/regress/regress-3138.js')
-rw-r--r--deps/v8/test/mjsunit/regress/regress-3138.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/regress/regress-3138.js b/deps/v8/test/mjsunit/regress/regress-3138.js
new file mode 100644
index 0000000000..acb121d2bd
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-3138.js
@@ -0,0 +1,40 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function f(){
+ assertEquals("function", typeof f);
+})();
+
+(function f(){
+ var f; // Variable shadows function name.
+ assertEquals("undefined", typeof f);
+})();
+
+(function f(){
+ var f;
+ assertEquals("undefined", typeof f);
+ with ({}); // Force context allocation of both variable and function name.
+})();
+
+assertEquals("undefined", typeof f);
+
+// var initialization is intercepted by with scope.
+(function() {
+ var o = { a: 1 };
+ with (o) {
+ var a = 2;
+ }
+ assertEquals("undefined", typeof a);
+ assertEquals(2, o.a);
+})();
+
+// const initialization is not intercepted by with scope.
+(function() {
+ var o = { a: 1 };
+ with (o) {
+ const a = 2;
+ }
+ assertEquals(2, a);
+ assertEquals(1, o.a);
+})();