1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | #ifndef NAN_DEFINE_OWN_PROPERTY_HELPER_H_
|
10 | #define NAN_DEFINE_OWN_PROPERTY_HELPER_H_
|
11 |
|
12 | namespace imp {
|
13 |
|
14 | inline Maybe<bool> DefineOwnPropertyHelper(
|
15 | v8::PropertyAttribute current
|
16 | , v8::Handle<v8::Object> obj
|
17 | , v8::Handle<v8::String> key
|
18 | , v8::Handle<v8::Value> value
|
19 | , v8::PropertyAttribute attribs = v8::None) {
|
20 | return !(current & v8::DontDelete) ||
|
21 | (!(current & v8::ReadOnly) &&
|
22 | !((attribs ^ current) & ~v8::ReadOnly))
|
23 | ? Just<bool>(obj->ForceSet(key, value, attribs))
|
24 | : Nothing<bool>();
|
25 | }
|
26 |
|
27 | }
|
28 |
|
29 | #endif
|