implement Array.prototype.indexOf, Array.prototype.lastIndexOf

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
seonghyun kim 2017-01-04 14:41:57 +09:00
commit 2057250e48
10 changed files with 196 additions and 28 deletions

View file

@ -83,6 +83,8 @@ ArgumentsObject::ArgumentsObject(ExecutionState& state, FunctionEnvironmentRecor
mappedNames.push_back(name);
// Let g be the result of calling the MakeArgGetter abstract operation with arguments name and env.
// Let p be the result of calling the MakeArgSetter abstract operation with arguments name and env.
// Set the [[ParameterMap]] internal property of obj to map.
// Set the [[Get]], [[GetOwnProperty]], [[DefineOwnProperty]], and [[Delete]] internal methods of obj to the definitions provided below.
auto data = new ArgumentsObjectArgData(record, blk, name);
// Call the [[DefineOwnProperty]] internal method of map passing ToString(indx), the Property Descriptor {[[Set]]: p, [[Get]]: g, [[Configurable]]: true}, and false as arguments.
auto gsData = new ObjectPropertyNativeGetterSetterData(true, true, true, ArgumentsObjectNativeGetter, ArgumentsObjectNativeSetter, true);
@ -94,12 +96,6 @@ ArgumentsObject::ArgumentsObject(ExecutionState& state, FunctionEnvironmentRecor
indx--;
}
// TODO If mappedNames is not empty, then
// if (mappedNames.size()) {
// TODO Set the [[ParameterMap]] internal property of obj to map.
// TODO Set the [[Get]], [[GetOwnProperty]], [[DefineOwnProperty]], and [[Delete]] internal methods of obj to the definitions provided below.
// }
// If strict is false, then
if (!isStrict) {
// Call the [[DefineOwnProperty]] internal method on obj passing "callee", the property descriptor {[[Value]]: func, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true}, and false as arguments.