[es6] new.target should not be shadowable in a with scope
authoradamk <adamk@chromium.org>
Tue, 4 Aug 2015 17:14:48 +0000 (10:14 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 4 Aug 2015 17:15:40 +0000 (17:15 +0000)
BUG=v8:3887
LOG=n

Review URL: https://codereview.chromium.org/1259183005

Cr-Commit-Position: refs/heads/master@{#30010}

src/ast-value-factory.h
src/ast.h
test/mjsunit/harmony/new-target.js

index 2fee0396fd487b02ac8d4020de783abcb989c810..ca36ac8ea19995b785a4802c56e412bbe91c27cc 100644 (file)
@@ -267,7 +267,7 @@ class AstValue : public ZoneObject {
   F(make_syntax_error, "MakeSyntaxError")                                  \
   F(make_type_error, "MakeTypeError")                                      \
   F(native, "native")                                                      \
-  F(new_target, "new.target")                                              \
+  F(new_target, ".new.target")                                             \
   F(next, "next")                                                          \
   F(proto, "__proto__")                                                    \
   F(prototype, "prototype")                                                \
index 0e419c564dd4a2047925c49774b9b100e1901a2a..f9d7af1e0d70d624d2f88372b75facba3e6f27ee 100644 (file)
--- a/src/ast.h
+++ b/src/ast.h
@@ -2827,7 +2827,7 @@ class SuperCallReference final : public Expression {
         new_target_var_(new_target_var),
         this_function_var_(this_function_var) {
     DCHECK(this_var->is_this());
-    DCHECK(new_target_var->raw_name()->IsOneByteEqualTo("new.target"));
+    DCHECK(new_target_var->raw_name()->IsOneByteEqualTo(".new.target"));
     DCHECK(this_function_var->raw_name()->IsOneByteEqualTo(".this_function"));
   }
 
index 9498099f50d13d9b26a8db8aa06710957201ee35..fa5b37282018d2615a83dc05cfff0f4738aefa38 100644 (file)
   assertSame(f4, new f4);
   function f5() { 'use strict'; { let x; return new.target } }
   assertSame(f5, new f5);
+  function f6() { with ({'new.target': 42}) return new.target }
+  assertSame(f6, new f6);
 })();