mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-29 10:02:14 +00:00
1. re-implement Object::defineOwnProperty
2. implement String.prototype.match, replace Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
fbbd91bead
commit
64a56ae946
22 changed files with 677 additions and 256 deletions
|
|
@ -16,10 +16,10 @@ StringObject::StringObject(ExecutionState& state, String* value)
|
|||
void StringObject::setStringData(ExecutionState& state, String* data)
|
||||
{
|
||||
m_primitiveValue = data;
|
||||
defineOwnProperty(state, ObjectPropertyName(state.context()->staticStrings().length), ObjectPropertyDescriptorForDefineOwnProperty(Value(data->length()), ObjectPropertyDescriptor::NotPresent));
|
||||
defineOwnProperty(state, ObjectPropertyName(state.context()->staticStrings().length), ObjectPropertyDescriptorForDefineOwnProperty(Value(data->length()), ObjectPropertyDescriptorForDefineOwnProperty::NotPresent));
|
||||
}
|
||||
|
||||
Object::ObjectGetResult StringObject::getOwnProperty(ExecutionState& state, const ObjectPropertyName& P) ESCARGOT_OBJECT_SUBCLASS_MUST_REDEFINE
|
||||
ObjectGetResult StringObject::getOwnProperty(ExecutionState& state, const ObjectPropertyName& P) ESCARGOT_OBJECT_SUBCLASS_MUST_REDEFINE
|
||||
{
|
||||
Value::ValueIndex idx;
|
||||
if (LIKELY(P.isUIntType())) {
|
||||
|
|
@ -30,7 +30,7 @@ Object::ObjectGetResult StringObject::getOwnProperty(ExecutionState& state, cons
|
|||
if (LIKELY(idx != Value::InvalidIndexValue)) {
|
||||
size_t strLen = m_primitiveValue->length();
|
||||
if (LIKELY(idx < strLen)) {
|
||||
return Object::ObjectGetResult(Value(String::fromCharCode(m_primitiveValue->charAt(idx))), false, true, false);
|
||||
return ObjectGetResult(Value(String::fromCharCode(m_primitiveValue->charAt(idx))), false, true, false);
|
||||
}
|
||||
}
|
||||
return Object::getOwnProperty(state, P);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue