mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Pass tests in es5 test262 ch15.2.3.3 (except for URI-related features)
- Add every builtin function templates in es5 - Modification on Makefile target "check" should not trigger rebuild - Add JSON object - Implement some toString functions - Initialize m_value properly in ObjectPropertyDescriptor constructor
This commit is contained in:
parent
3aa287ee25
commit
c8840465d1
17 changed files with 670 additions and 183 deletions
37
src/runtime/GlobalObjectBuiltinJSON.cpp
Normal file
37
src/runtime/GlobalObjectBuiltinJSON.cpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#include "Escargot.h"
|
||||
#include "GlobalObject.h"
|
||||
#include "Context.h"
|
||||
#include "StringObject.h"
|
||||
|
||||
namespace Escargot {
|
||||
|
||||
static Value builtinJSONParse(ExecutionState& state, Value thisValue, size_t argc, Value* argv, bool isNewExpression)
|
||||
{
|
||||
state.throwException(new ASCIIString(errorMessage_NotImplemented));
|
||||
RELEASE_ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
static Value builtinJSONStringify(ExecutionState& state, Value thisValue, size_t argc, Value* argv, bool isNewExpression)
|
||||
{
|
||||
state.throwException(new ASCIIString(errorMessage_NotImplemented));
|
||||
RELEASE_ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
void GlobalObject::installJSON(ExecutionState& state)
|
||||
{
|
||||
m_json = new Object(state);
|
||||
m_json->giveInternalClassProperty("JSON");
|
||||
m_json->markThisObjectDontNeedStructureTransitionTable(state);
|
||||
|
||||
defineOwnProperty(state, ObjectPropertyName(state.context()->staticStrings().JSON),
|
||||
ObjectPropertyDescriptor(m_json, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent)));
|
||||
|
||||
m_json->defineOwnProperty(state, ObjectPropertyName(state.context()->staticStrings().parse),
|
||||
ObjectPropertyDescriptor(new FunctionObject(state, NativeFunctionInfo(state.context()->staticStrings().parse, builtinJSONParse, 1, nullptr, NativeFunctionInfo::Strict)),
|
||||
(ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent)));
|
||||
|
||||
m_json->defineOwnProperty(state, ObjectPropertyName(state.context()->staticStrings().stringify),
|
||||
ObjectPropertyDescriptor(new FunctionObject(state, NativeFunctionInfo(state.context()->staticStrings().stringify, builtinJSONStringify, 1, nullptr, NativeFunctionInfo::Strict)),
|
||||
(ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent)));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue