X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/f9bf01c6616d5ddcf65b13b33cedf9e387ff7a63..40a37d088818fc2fbeba2ef850dbcaaf294befbf:/runtime/PropertyDescriptor.h diff --git a/runtime/PropertyDescriptor.h b/runtime/PropertyDescriptor.h index ff9f160..df74d9e 100644 --- a/runtime/PropertyDescriptor.h +++ b/runtime/PropertyDescriptor.h @@ -26,9 +26,14 @@ #ifndef PropertyDescriptor_h #define PropertyDescriptor_h -#include "JSValue.h" +#include "JSCJSValue.h" namespace JSC { + class GetterSetter; + + // See ES5.1 9.12 + bool sameValue(ExecState*, JSValue, JSValue); + class PropertyDescriptor { public: PropertyDescriptor() @@ -36,25 +41,37 @@ namespace JSC { , m_seenAttributes(0) { } - bool writable() const; - bool enumerable() const; - bool configurable() const; - bool isDataDescriptor() const; + PropertyDescriptor(JSValue value, unsigned attributes) + : m_value(value) + , m_attributes(attributes) + , m_seenAttributes(EnumerablePresent | ConfigurablePresent | WritablePresent) + { + ASSERT(m_value); + ASSERT(!m_value.isGetterSetter()); + ASSERT(!m_value.isCustomGetterSetter()); + } + JS_EXPORT_PRIVATE bool writable() const; + JS_EXPORT_PRIVATE bool enumerable() const; + JS_EXPORT_PRIVATE bool configurable() const; + JS_EXPORT_PRIVATE bool isDataDescriptor() const; bool isGenericDescriptor() const; - bool isAccessorDescriptor() const; + JS_EXPORT_PRIVATE bool isAccessorDescriptor() const; unsigned attributes() const { return m_attributes; } JSValue value() const { return m_value; } - JSValue getter() const; - JSValue setter() const; - void setUndefined(); - void setDescriptor(JSValue value, unsigned attributes); - void setAccessorDescriptor(JSValue getter, JSValue setter, unsigned attributes); - void setWritable(bool); - void setEnumerable(bool); - void setConfigurable(bool); + JS_EXPORT_PRIVATE JSValue getter() const; + JS_EXPORT_PRIVATE JSValue setter() const; + JSObject* getterObject() const; + JSObject* setterObject() const; + JS_EXPORT_PRIVATE void setUndefined(); + JS_EXPORT_PRIVATE void setDescriptor(JSValue value, unsigned attributes); + JS_EXPORT_PRIVATE void setCustomDescriptor(unsigned attributes); + JS_EXPORT_PRIVATE void setAccessorDescriptor(GetterSetter* accessor, unsigned attributes); + JS_EXPORT_PRIVATE void setWritable(bool); + JS_EXPORT_PRIVATE void setEnumerable(bool); + JS_EXPORT_PRIVATE void setConfigurable(bool); void setValue(JSValue value) { m_value = value; } - void setSetter(JSValue); - void setGetter(JSValue); + JS_EXPORT_PRIVATE void setSetter(JSValue); + JS_EXPORT_PRIVATE void setGetter(JSValue); bool isEmpty() const { return !(m_value || m_getter || m_setter || m_seenAttributes); } bool writablePresent() const { return m_seenAttributes & WritablePresent; } bool enumerablePresent() const { return m_seenAttributes & EnumerablePresent; } @@ -63,9 +80,10 @@ namespace JSC { bool getterPresent() const { return m_getter; } bool equalTo(ExecState* exec, const PropertyDescriptor& other) const; bool attributesEqual(const PropertyDescriptor& other) const; - unsigned attributesWithOverride(const PropertyDescriptor& other) const; + unsigned attributesOverridingCurrent(const PropertyDescriptor& current) const; + private: - static unsigned defaultAttributes; + JS_EXPORTDATA static unsigned defaultAttributes; bool operator==(const PropertyDescriptor&){ return false; } enum { WritablePresent = 1, EnumerablePresent = 2, ConfigurablePresent = 4}; // May be a getter/setter