5 #ifndef V8_PROPERTY_DESCRIPTOR_H_ 6 #define V8_PROPERTY_DESCRIPTOR_H_ 9 #include "src/handles.h" 10 #include "src/property-details.h" 18 class PropertyDescriptorObject;
24 has_enumerable_(
false),
26 has_configurable_(
false),
28 has_writable_(
false) {}
32 return desc->has_get() || desc->has_set();
37 return desc->has_value() || desc->has_writable();
42 return !IsAccessorDescriptor(desc) && !IsDataDescriptor(desc);
55 static void CompletePropertyDescriptor(
Isolate* isolate,
58 bool is_empty()
const {
59 return !has_enumerable() && !has_configurable() && !has_writable() &&
60 !has_value() && !has_get() && !has_set();
63 bool IsRegularAccessorProperty()
const {
64 return has_configurable() && has_enumerable() && !has_value() &&
65 !has_writable() && has_get() && has_set();
68 bool IsRegularDataProperty()
const {
69 return has_configurable() && has_enumerable() && has_value() &&
70 has_writable() && !has_get() && !has_set();
73 bool enumerable()
const {
return enumerable_; }
74 void set_enumerable(
bool enumerable) {
75 enumerable_ = enumerable;
76 has_enumerable_ =
true;
78 bool has_enumerable()
const {
return has_enumerable_; }
80 bool configurable()
const {
return configurable_; }
81 void set_configurable(
bool configurable) {
82 configurable_ = configurable;
83 has_configurable_ =
true;
85 bool has_configurable()
const {
return has_configurable_; }
89 bool has_value()
const {
return !value_.is_null(); }
91 bool writable()
const {
return writable_; }
92 void set_writable(
bool writable) {
96 bool has_writable()
const {
return has_writable_; }
100 bool has_get()
const {
return !get_.is_null(); }
104 bool has_set()
const {
return !set_.is_null(); }
109 PropertyAttributes ToAttributes() {
110 return static_cast<PropertyAttributes
>(
111 (has_enumerable() && !enumerable() ? DONT_ENUM : NONE) |
112 (has_configurable() && !configurable() ? DONT_DELETE : NONE) |
113 (has_writable() && !writable() ? READ_ONLY : NONE));
117 bool enumerable_ : 1;
118 bool has_enumerable_ : 1;
119 bool configurable_ : 1;
120 bool has_configurable_ : 1;
122 bool has_writable_ : 1;
136 #endif // V8_PROPERTY_DESCRIPTOR_H_