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

Unified Diff: src/api.cc

Issue 608503002: Add IsGeneratorFunction and IsGeneratorObject checks to v8::Value. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index f1d81ddd5fefa38f3704d11a6c1c7478f97e46c5..b2432cf895a02499ee677c4c5026e50e12b948f3 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2568,6 +2568,19 @@ bool Value::IsRegExp() const {
}
+bool Value::IsGeneratorFunction() const {
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
+ if (!obj->IsJSFunction()) return false;
+ i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast(obj);
+ return func->shared()->is_generator();
+}
+
+
+bool Value::IsGeneratorObject() const {
+ return Utils::OpenHandle(this)->IsJSGeneratorObject();
+}
+
+
Local<String> Value::ToString() const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> str;
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698