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

Unified Diff: test/cctest/interpreter/test-interpreter.cc

Issue 1419273008: [Interpreter] Add support for new.target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_thisfunc
Patch Set: 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 | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/interpreter/test-interpreter.cc
diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc
index a7370a86489dd655a12dbba23cc0fb2366c0d370..d9810983428df541b94718b6867a1b6e5ab8d242 100644
--- a/test/cctest/interpreter/test-interpreter.cc
+++ b/test/cctest/interpreter/test-interpreter.cc
@@ -2899,6 +2899,24 @@ TEST(InterpreterThisFunction) {
CHECK(return_value->SameValue(*factory->NewStringFromStaticChars("f")));
}
+
+TEST(InterpreterNewTarget) {
+ HandleAndZoneScope handles;
+ i::Isolate* isolate = handles.main_isolate();
+ i::Factory* factory = isolate->factory();
+
+ // TODO(rmcilroy): Add tests that we get the original constructor for
+ // superclass constructors once we have class support.
+ InterpreterTester tester(handles.main_isolate(),
+ "function f() { this.a = new.target; }");
+ auto callable = tester.GetCallable<>();
+ callable().ToHandleChecked();
+
+ Handle<Object> new_target_name = v8::Utils::OpenHandle(
+ *CompileRun("(function() { return (new f()).a.name; })();"));
+ CHECK(new_target_name->SameValue(*factory->NewStringFromStaticChars("f")));
+}
+
} // namespace interpreter
} // namespace internal
} // namespace v8
« no previous file with comments | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698