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

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

Side-by-side diff isn't available for this file because of its large size.
Issue 2365833002: Add method on Value::IsAsyncFunction to detect async functions (Closed)
Patch Set: format Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 8e88e65d517662db30a24af0b8b2a4b984acc1b8..1575559d38261ea41d1125377b18ee13f89c1353 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -1581,6 +1581,26 @@ THREADED_TEST(IsGeneratorFunctionOrObject) {
CHECK(!func->IsGeneratorObject());
}
+THREADED_TEST(IsAsyncFunction) {
+ i::FLAG_harmony_async_await = true;
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope scope(isolate);
+
+ CompileRun("async function foo() {}");
+ v8::Local<Value> foo = CompileRun("foo");
+
+ CHECK(foo->IsAsyncFunction());
+ CHECK(foo->IsFunction());
+ CHECK(!foo->IsGeneratorFunction());
+ CHECK(!foo->IsGeneratorObject());
+
+ CompileRun("function bar() {}");
+ v8::Local<Value> bar = CompileRun("bar");
+
+ CHECK(!bar->IsAsyncFunction());
+ CHECK(bar->IsFunction());
+}
THREADED_TEST(ArgumentsObject) {
LocalContext env;
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698