Reviewers: rossberg,

Description:
[es6] new.target should not be shadowable in a with scope

BUG=v8:3887
LOG=n

Please review this at https://codereview.chromium.org/1259183005/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+4, -2 lines):
  M src/ast.h
  M src/ast-value-factory.h
  M test/mjsunit/harmony/new-target.js


Index: src/ast-value-factory.h
diff --git a/src/ast-value-factory.h b/src/ast-value-factory.h
index 2fee0396fd487b02ac8d4020de783abcb989c810..ca36ac8ea19995b785a4802c56e412bbe91c27cc 100644
--- a/src/ast-value-factory.h
+++ b/src/ast-value-factory.h
@@ -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: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index 0e419c564dd4a2047925c49774b9b100e1901a2a..f9d7af1e0d70d624d2f88372b75facba3e6f27ee 100644
--- 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: test/mjsunit/harmony/new-target.js
diff --git a/test/mjsunit/harmony/new-target.js b/test/mjsunit/harmony/new-target.js index 9498099f50d13d9b26a8db8aa06710957201ee35..fa5b37282018d2615a83dc05cfff0f4738aefa38 100644
--- a/test/mjsunit/harmony/new-target.js
+++ b/test/mjsunit/harmony/new-target.js
@@ -381,4 +381,6 @@
   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);
 })();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to