mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
1. implement Object.preventExtensions, Object.getPrototypeOf, Object.prototype.valueOf
2. Fix bug in Object::set 3. Fix bug in Object::defineOwnProperty 4. implement function Number correctly 5. set prototype of String, Number object correctly Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
43103b8542
commit
3d16ed27df
6 changed files with 62 additions and 17 deletions
|
|
@ -363,7 +363,7 @@ bool Object::defineOwnProperty(ExecutionState& state, const ObjectPropertyName&
|
|||
// Convert the property named P of object O from a data property to an accessor property.
|
||||
// Preserve the existing values of the converted property’s [[Configurable]] and [[Enumerable]] attributes
|
||||
// and set the rest of the property’s attributes to their default values.
|
||||
if (current.isWritable()) {
|
||||
if (current.isWritable() || newDesc.isWritable()) {
|
||||
f = f | ObjectPropertyDescriptor::WritablePresent;
|
||||
} else {
|
||||
f = f | ObjectPropertyDescriptor::NonWritablePresent;
|
||||
|
|
@ -465,8 +465,10 @@ bool Object::deleteOwnProperty(ExecutionState& state, const ObjectPropertyName&
|
|||
if (result.hasValue() && result.isConfigurable()) {
|
||||
deleteOwnProperty(state, m_structure->findProperty(state, P.toPropertyName(state)));
|
||||
return true;
|
||||
} else if (result.hasValue() && !result.isConfigurable()) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Object::enumeration(ExecutionState& state, std::function<bool(const ObjectPropertyName&, const ObjectStructurePropertyDescriptor& desc)> fn) ESCARGOT_OBJECT_SUBCLASS_MUST_REDEFINE
|
||||
|
|
@ -539,8 +541,8 @@ bool Object::set(ExecutionState& state, const ObjectPropertyName& propertyName,
|
|||
} else {
|
||||
// Else Receiver does not currently have a property P,
|
||||
// Return CreateDataProperty(Receiver, P, V).
|
||||
ObjectPropertyDescriptor desc(v);
|
||||
return defineOwnProperty(state, propertyName, desc);
|
||||
ObjectPropertyDescriptor newDesc(v, ObjectPropertyDescriptor::AllPresent);
|
||||
return receiver->defineOwnProperty(state, propertyName, newDesc);
|
||||
}
|
||||
} else {
|
||||
// Let setter be ownDesc.[[Set]].
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue