Do not get the object property descriptor`s value if it is not present (#45)

Fixes #28

Signed-off-by: Robert Sipka <rsipka.uszeged@partner.samsung.com>
This commit is contained in:
Robert Sipka 2019-01-10 06:01:42 +01:00 committed by yichoi
commit aca603a7eb

View file

@ -526,7 +526,8 @@ 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 propertys [[Configurable]] and [[Enumerable]] attributes
// and set the rest of the propertys attributes to their default values.
newDesc = ObjectPropertyDescriptor(desc.value(), (ObjectPropertyDescriptor::PresentAttribute)f);
newDesc = desc.isValuePresent() ? ObjectPropertyDescriptor(desc.value(), (ObjectPropertyDescriptor::PresentAttribute)f)
: ObjectPropertyDescriptor((ObjectPropertyDescriptor::PresentAttribute)f);
}
}
// Else, if IsDataDescriptor(current) and IsDataDescriptor(Desc) are both true, then