Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1209)

Unified Diff: test/mjsunit/es6/new-target.js

Issue 1432493003: [turbofan] Fix new.target when a function is inlined to a constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@reland
Patch Set: Test added Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-function.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/new-target.js
diff --git a/test/mjsunit/es6/new-target.js b/test/mjsunit/es6/new-target.js
index db816036962d650f00aa6a9ac296de803af6084a..9ecff815faf3e39c9853a80af54e21fa45a44450 100644
--- a/test/mjsunit/es6/new-target.js
+++ b/test/mjsunit/es6/new-target.js
@@ -385,6 +385,23 @@
})();
+// Has to be top-level to be inlined.
+function get_new_target() { return new.target; }
+(function TestInlining() {
+ "use strict";
+ new function() { assertEquals(undefined, get_new_target()); }
+ new function() { assertEquals(get_new_target, new get_new_target()); }
+
+ class A extends get_new_target {
+ constructor() {
+ var new_target = super();
+ this.new_target = new_target;
+ }
+ }
+ assertEquals(A, new A().new_target);
+})();
+
+
(function TestEarlyErrors() {
assertThrows(function() { Function("new.target = 42"); }, ReferenceError);
assertThrows(function() { Function("var foo = 1; new.target = foo = 42"); }, ReferenceError);
« no previous file with comments | « src/runtime/runtime-function.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698