mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Implement ES6 Symbol.hasInstance, iterator, toStringTag, toPrimitive and built-ins (#46)
* Implement Array.from * Disable part of ES6-shim due to wrong implementation Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
a363289951
commit
e66f512b32
61 changed files with 1407 additions and 419 deletions
|
|
@ -17,6 +17,7 @@
|
|||
#include "Escargot.h"
|
||||
#include "GlobalObject.h"
|
||||
#include "Context.h"
|
||||
#include "VMInstance.h"
|
||||
#include "WeakMapObject.h"
|
||||
#include "IteratorObject.h"
|
||||
#include "ToStringRecursionPreventer.h"
|
||||
|
|
@ -39,7 +40,7 @@ Value builtinWeakMapConstructor(ExecutionState& state, Value thisValue, size_t a
|
|||
}
|
||||
// If iterable is either undefined or null, let iter be undefined.
|
||||
Value adder;
|
||||
IteratorObject* iter = nullptr;
|
||||
Object* iter = nullptr;
|
||||
if (iterable.isUndefinedOrNull()) {
|
||||
iterable = Value();
|
||||
} else {
|
||||
|
|
@ -65,7 +66,7 @@ Value builtinWeakMapConstructor(ExecutionState& state, Value thisValue, size_t a
|
|||
// Repeat
|
||||
while (true) {
|
||||
// Let next be ? IteratorStep(iter).
|
||||
auto next = iter->advance(state);
|
||||
auto next = iter->iteratorNext(state);
|
||||
// If next is false(done is true), return map.
|
||||
if (next.second) {
|
||||
return map;
|
||||
|
|
@ -167,6 +168,9 @@ void GlobalObject::installWeakMap(ExecutionState& state)
|
|||
m_weakMapPrototype->defineOwnPropertyThrowsException(state, ObjectPropertyName(state.context()->staticStrings().set),
|
||||
ObjectPropertyDescriptor(new FunctionObject(state, NativeFunctionInfo(state.context()->staticStrings().set, builtinWeakMapSet, 2, nullptr, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent)));
|
||||
|
||||
m_weakMapPrototype->defineOwnPropertyThrowsException(state, ObjectPropertyName(state, Value(state.context()->vmInstance()->globalSymbols().toStringTag)),
|
||||
ObjectPropertyDescriptor(Value(state.context()->staticStrings().WeakMap.string()), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::ConfigurablePresent)));
|
||||
|
||||
m_weakMap->setFunctionPrototype(state, m_weakMapPrototype);
|
||||
defineOwnProperty(state, ObjectPropertyName(state.context()->staticStrings().WeakMap),
|
||||
ObjectPropertyDescriptor(m_weakMap, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue