Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index d31ef5405cfaf5c0fb7bbd419b73c50b715ca3a9..b5f67e99113fbbd1600f404610496043be10a313 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -100,6 +100,7 @@ class Function; |
class Date; |
class ImplementationUtilities; |
class Signature; |
+class AccessorSignature; |
template <class T> class Handle; |
template <class T> class Local; |
template <class T> class Persistent; |
@@ -2289,7 +2290,8 @@ class V8EXPORT FunctionTemplate : public Template { |
AccessorSetter setter, |
Handle<Value> data, |
AccessControl settings, |
- PropertyAttribute attributes); |
+ PropertyAttribute attributes, |
+ Handle<AccessorSignature> signature); |
void SetNamedInstancePropertyHandler(NamedPropertyGetter getter, |
NamedPropertySetter setter, |
NamedPropertyQuery query, |
@@ -2347,13 +2349,20 @@ class V8EXPORT ObjectTemplate : public Template { |
* cross-context access. |
* \param attribute The attributes of the property for which an accessor |
* is added. |
+ * \param signature The signature describes valid receivers for the accessor |
+ * and is used to perform implicit instance checks against. If the receiver |
danno
2012/06/06 09:32:31
nit: against them.
Michael Starzinger
2012/06/08 07:40:44
Done.
|
+ * is incompatible (i.e. is not an instance of the constructor as defined |
+ * by FunctionTemplate::HasInstance()), an implicit TypeError is thrown and |
+ * no callback is invoked. |
*/ |
void SetAccessor(Handle<String> name, |
AccessorGetter getter, |
AccessorSetter setter = 0, |
Handle<Value> data = Handle<Value>(), |
AccessControl settings = DEFAULT, |
- PropertyAttribute attribute = None); |
+ PropertyAttribute attribute = None, |
+ Handle<AccessorSignature> signature = |
+ Handle<AccessorSignature>()); |
/** |
* Sets a named property handler on the object template. |
@@ -2472,6 +2481,19 @@ class V8EXPORT Signature : public Data { |
/** |
+ * An AccessorSignature specifies which receivers an accessor callback |
+ * can legally be called with. |
danno
2012/06/06 09:32:31
how about: "An AccessorSignature specifies which r
Michael Starzinger
2012/06/08 07:40:44
Done. Also applied to "Signature" a few lines abov
|
+ */ |
+class V8EXPORT AccessorSignature : public Data { |
+ public: |
+ static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver = |
+ Handle<FunctionTemplate>()); |
+ private: |
+ AccessorSignature(); |
+}; |
+ |
+ |
+/** |
* A utility for determining the type of objects based on the template |
* they were constructed from. |
*/ |