From 59645c6a193da9f0215cc656b2e18bb22ce296c2 Mon Sep 17 00:00:00 2001 From: "antonm@chromium.org" Date: Tue, 10 Aug 2010 09:53:56 +0000 Subject: [PATCH] Add v8::Value::IsRegExp method. Patch by Vlad Burlik. Review URL: http://codereview.chromium.org/3064051 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5227 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- AUTHORS | 1 + include/v8.h | 5 +++++ src/api.cc | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/AUTHORS b/AUTHORS index 4d87db3be0..65b8965f1a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -29,4 +29,5 @@ Rodolph Perfetta Ryan Dahl Subrato K De Burcu Dogan +Vlad Burlik diff --git a/include/v8.h b/include/v8.h index 3ac10ab917..b22e3d1f4b 100644 --- a/include/v8.h +++ b/include/v8.h @@ -919,6 +919,11 @@ class Value : public Data { */ V8EXPORT bool IsDate() const; + /** + * Returns true if this value is a RegExp. + */ + V8EXPORT bool IsRegExp() const; + V8EXPORT Local ToBoolean() const; V8EXPORT Local ToNumber() const; V8EXPORT Local ToString() const; diff --git a/src/api.cc b/src/api.cc index adeced54b5..4bd5699c00 100644 --- a/src/api.cc +++ b/src/api.cc @@ -1792,6 +1792,13 @@ bool Value::IsDate() const { } +bool Value::IsRegExp() const { + if (IsDeadCheck("v8::Value::IsRegExp()")) return false; + i::Handle obj = Utils::OpenHandle(this); + return obj->IsJSRegExp(); +} + + Local Value::ToString() const { if (IsDeadCheck("v8::Value::ToString()")) return Local(); LOG_API("ToString");