mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Update coding style guide (#296)
* reformat all single logical expression based on the new rule Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
parent
4e6dd80542
commit
2b145ef54c
27 changed files with 163 additions and 153 deletions
|
|
@ -22,9 +22,13 @@ inclusion of header files. The format of the identifier name should be
|
|||
```
|
||||
|
||||
### Use `#include` only in `.cpp` files
|
||||
To prevent possible loops in header file inclusion, include header files only
|
||||
To prevent possible loops in header file inclusion, try to include header files only
|
||||
in `.cpp` files. In this case, the order of header file inclusion is important.
|
||||
|
||||
'including headers in a header' is allowed for the followings. otherwise, try to use forward declarations.
|
||||
* Class Inheritance
|
||||
* Class member as an instance
|
||||
|
||||
## Formatting
|
||||
### Indentation
|
||||
Use spaces only, and use 4 spaces at a time. Tabs should not be used.
|
||||
|
|
@ -235,8 +239,10 @@ Do not use try-catch statements except throwing an Exception.
|
|||
## Assertions and nullptr
|
||||
### Basic principle
|
||||
* When using a pointer type variable, be sure to add the Assertions statement if you do not want to consider the situation where the value is nullptr, if you do not want to add assertions, be sure to write your defense code.
|
||||
* In our strategy, Escargot will be terminated along with an error message when a memory allocation attempt fails.
|
||||
* When not using GC allocators, write an assertion after memory allocation.
|
||||
* In our strategy, Escargot will be terminated along with an error message when GC memory allocation fails.
|
||||
* If you use c-style allocator like malloc/free, you should check allocation fail.
|
||||
* While you don't use GC allocator, check before dereferencing with ASSERT or if, depends on the expected behavior what you want to achieve.
|
||||
|
||||
### Add an assertion in the following situations.
|
||||
* If the function argument is a pointer type
|
||||
```cpp
|
||||
|
|
@ -346,12 +352,16 @@ Make sure your code is obvious and readable with the following conventions.
|
|||
- if (verbose && strlen(verbose))
|
||||
+ if ((verbose != nullptr) && (strlen(verbose) > 0))
|
||||
|
||||
// Avoiding conditions with logical operators such as (`!`) is preferred.
|
||||
// By just using `(!any) or (any)` it's not explicit what you want.
|
||||
// Rely on the condition itself than variable names like `ptr`.
|
||||
- if (!any) // The counter of `any` could be read as `nullptr`, `false`, etc.
|
||||
+ if (any == nullptr)
|
||||
// Regarding readability, The primary rule is to use explicit expression consists of left and right operand
|
||||
// and not to use single operand logical operator such as (`!`).
|
||||
// You can use single operand logical expression only if the operand has boolean type.
|
||||
// Other cases are not recommended to omit the right operand.
|
||||
|
||||
- if (!o.isLoaded() && ptr == nullptr)
|
||||
+ if ((o.isLoaded() == false) && ptr == nullptr)
|
||||
bool isLoaded();
|
||||
bool sunnyToday();
|
||||
int howMuchLoaded();
|
||||
|
||||
- if (!isLoaded() && howMuchLoaded() && ptr)
|
||||
+ if (!isLoaded() && howMuchLoaded() != 0 && ptr != nullptr)
|
||||
+ if (sunnyToday())
|
||||
```
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ ByteCodeBlock* ByteCodeGenerator::generateByteCode(Context* c, InterpretedCodeBl
|
|||
block->pushCode(ReturnFunctionWithValue(ByteCodeLOC(SIZE_MAX), idx), &ctx, nullptr);
|
||||
ctx.giveUpRegister();
|
||||
} else {
|
||||
if (codeBlock->isGenerator() == true) {
|
||||
if (codeBlock->isGenerator()) {
|
||||
block->pushCode(GeneratorComplete(ByteCodeLOC(SIZE_MAX)), &ctx, nullptr);
|
||||
}
|
||||
block->pushCode(ReturnFunction(ByteCodeLOC(SIZE_MAX)), &ctx, nullptr);
|
||||
|
|
|
|||
|
|
@ -1139,7 +1139,7 @@ Value ByteCodeInterpreter::interpret(ExecutionState& state, ByteCodeBlock* byteC
|
|||
IteratorStep* code = (IteratorStep*)programCounter;
|
||||
Value nextResult = iteratorStep(state, registerFile[code->m_iterRegisterIndex]);
|
||||
|
||||
if (nextResult.isFalse() == true) {
|
||||
if (nextResult.isFalse()) {
|
||||
if (code->m_forOfEndPosition == SIZE_MAX) {
|
||||
registerFile[code->m_registerIndex] = Value();
|
||||
ADD_PROGRAM_COUNTER(IteratorStep);
|
||||
|
|
@ -1336,7 +1336,7 @@ Value ByteCodeInterpreter::interpret(ExecutionState& state, ByteCodeBlock* byteC
|
|||
{
|
||||
Value result = yieldDelegateOperation(state, registerFile, programCounter, codeBuffer);
|
||||
|
||||
if (result.isEmpty() == true) {
|
||||
if (result.isEmpty()) {
|
||||
NEXT_INSTRUCTION();
|
||||
}
|
||||
|
||||
|
|
@ -1497,7 +1497,7 @@ NEVER_INLINE Value ByteCodeInterpreter::modOperation(ExecutionState& state, cons
|
|||
|
||||
NEVER_INLINE Object* ByteCodeInterpreter::newOperation(ExecutionState& state, const Value& callee, size_t argc, NULLABLE Value* argv)
|
||||
{
|
||||
if (callee.isConstructor() == false) {
|
||||
if (!callee.isConstructor()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, errorMessage_Not_Constructor);
|
||||
}
|
||||
return Object::construct(state, callee, argc, argv);
|
||||
|
|
@ -2106,7 +2106,7 @@ NEVER_INLINE size_t ByteCodeInterpreter::tryOperation(ExecutionState& state, Try
|
|||
#endif
|
||||
|
||||
state.context()->m_sandBoxStack.back()->m_stackTraceData.clear();
|
||||
if (code->m_hasCatch == false) {
|
||||
if (!code->m_hasCatch) {
|
||||
state.rareData()->m_controlFlowRecord->back() = new ControlFlowRecord(ControlFlowRecord::NeedsThrow, val);
|
||||
programCounter = jumpTo(codeBuffer, code->m_tryCatchEndPosition);
|
||||
} else {
|
||||
|
|
@ -2252,10 +2252,10 @@ NEVER_INLINE void ByteCodeInterpreter::classOperation(ExecutionState& state, Cre
|
|||
if (superClass.isNull()) {
|
||||
protoParent = Value(Value::Null);
|
||||
constructorParent = state.context()->globalObject()->functionPrototype();
|
||||
} else if (superClass.isConstructor() == false) {
|
||||
} else if (!superClass.isConstructor()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, errorMessage_Class_Extends_Value_Is_Not_Object_Nor_Null);
|
||||
} else {
|
||||
if (superClass.isObject() == true && superClass.asObject()->isGeneratorObject() == true) {
|
||||
if (superClass.isObject() && superClass.asObject()->isGeneratorObject()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, errorMessage_Class_Prototype_Is_Not_Object_Nor_Null);
|
||||
}
|
||||
|
||||
|
|
@ -2440,7 +2440,7 @@ Value ByteCodeInterpreter::yieldDelegateOperation(ExecutionState& state, Value*
|
|||
Value nextValue;
|
||||
try {
|
||||
nextResult = iteratorNext(state, iterator);
|
||||
if (iterator.asObject()->isGeneratorObject() == true) {
|
||||
if (iterator.asObject()->isGeneratorObject()) {
|
||||
resultState = iterator.asObject()->asGeneratorObject()->state();
|
||||
}
|
||||
} catch (const Value& v) {
|
||||
|
|
@ -2454,13 +2454,13 @@ Value ByteCodeInterpreter::yieldDelegateOperation(ExecutionState& state, Value*
|
|||
|
||||
nextValue = iteratorValue(state, nextResult);
|
||||
|
||||
if (ret.isUndefined() == true) {
|
||||
if (ret.isUndefined()) {
|
||||
return nextValue;
|
||||
}
|
||||
|
||||
Value innerResult = Object::call(state, ret, iterator, 1, &nextValue);
|
||||
|
||||
if (innerResult.isObject() == false) {
|
||||
if (!innerResult.isObject()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, "IteratorResult is not an object");
|
||||
}
|
||||
|
||||
|
|
@ -2477,10 +2477,10 @@ Value ByteCodeInterpreter::yieldDelegateOperation(ExecutionState& state, Value*
|
|||
ASSERT(resultState == GeneratorState::CompletedThrow);
|
||||
Value throwMethod = iterator.asObject()->get(state, ObjectPropertyName(state.context()->staticStrings().stringThrow)).value(state, iterator);
|
||||
|
||||
if (throwMethod.isUndefined() == false) {
|
||||
if (!throwMethod.isUndefined()) {
|
||||
Value innerResult;
|
||||
innerResult = Object::call(state, throwMethod, iterator, 1, &nextValue);
|
||||
if (innerResult.isObject() == false) {
|
||||
if (!innerResult.isObject()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, "IteratorResult is not an object");
|
||||
}
|
||||
nextValue = iteratorValue(state, innerResult);
|
||||
|
|
@ -2494,7 +2494,7 @@ Value ByteCodeInterpreter::yieldDelegateOperation(ExecutionState& state, Value*
|
|||
|
||||
// yield
|
||||
registerFile[code->m_dstIdx] = nextValue;
|
||||
if (done == true) {
|
||||
if (done) {
|
||||
programCounter = jumpTo(codeBuffer, code->m_endPosition);
|
||||
return Value(Value::EmptyValue);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public:
|
|||
ASSERT(codeBlock != nullptr);
|
||||
ASSERT(context != nullptr);
|
||||
|
||||
if (codeBlock->m_codeBlock->isGenerator() == true) {
|
||||
if (codeBlock->m_codeBlock->isGenerator()) {
|
||||
codeBlock->pushCode(GeneratorComplete(ByteCodeLOC(SIZE_MAX)), context, this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public:
|
|||
ASSERT(codeBlock != nullptr);
|
||||
ASSERT(context != nullptr);
|
||||
|
||||
if (codeBlock->m_codeBlock->isGenerator() == true) {
|
||||
if (codeBlock->m_codeBlock->isGenerator()) {
|
||||
codeBlock->pushCode(GeneratorComplete(ByteCodeLOC(SIZE_MAX), true), context, this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public:
|
|||
size_t argIdx = m_argument->getRegister(codeBlock, context);
|
||||
m_argument->generateExpressionByteCode(codeBlock, context, argIdx);
|
||||
|
||||
if (m_isDelegate == true) {
|
||||
if (m_isDelegate) {
|
||||
size_t iteratorIdx = context->getRegister();
|
||||
codeBlock->pushCode(GetIterator(ByteCodeLOC(m_loc.index), argIdx, iteratorIdx), context, this);
|
||||
size_t loopStart = codeBlock->currentCodeSize();
|
||||
|
|
|
|||
|
|
@ -813,7 +813,7 @@ public:
|
|||
{
|
||||
ASSERT(grammarContext != nullptr);
|
||||
|
||||
if (UNLIKELY(this->context->firstCoverInitializedNameError.type != InvalidToken)) {
|
||||
if (UNLIKELY(this->context->firstCoverInitializedNameError)) {
|
||||
this->throwUnexpectedToken(&this->context->firstCoverInitializedNameError);
|
||||
}
|
||||
|
||||
|
|
@ -828,7 +828,7 @@ public:
|
|||
|
||||
this->context->isBindingElement = this->context->isBindingElement && grammarContext->previousIsBindingElement;
|
||||
this->context->isAssignmentTarget = this->context->isAssignmentTarget && grammarContext->previousIsAssignmentTarget;
|
||||
if (UNLIKELY(grammarContext->previousFirstCoverInitializedNameError.type != InvalidToken)) {
|
||||
if (UNLIKELY(grammarContext->previousFirstCoverInitializedNameError)) {
|
||||
this->context->firstCoverInitializedNameError = grammarContext->previousFirstCoverInitializedNameError;
|
||||
}
|
||||
}
|
||||
|
|
@ -3458,8 +3458,8 @@ public:
|
|||
RefPtr<Node> exprNode;
|
||||
ScanExpressionResult expr;
|
||||
|
||||
if (this->context->allowYield == false && this->matchKeyword(YieldKeyword) == true) {
|
||||
if (isParse == true) {
|
||||
if (!this->context->allowYield && this->matchKeyword(YieldKeyword)) {
|
||||
if (isParse) {
|
||||
exprNode = this->yieldExpression<ParseAs(YieldExpressionNode)>();
|
||||
} else {
|
||||
expr = this->yieldExpression<Scan>();
|
||||
|
|
@ -3547,8 +3547,8 @@ public:
|
|||
this->expect(Arrow);
|
||||
RefPtr<Node> body = this->match(LeftBrace) ? this->parseFunctionSourceElements() : this->isolateCoverGrammar(&Parser::assignmentExpression<Parse>);
|
||||
bool isExpression = body->type() != BlockStatement;
|
||||
if (isExpression == true) {
|
||||
if (this->config.parseSingleFunction == true) {
|
||||
if (isExpression) {
|
||||
if (this->config.parseSingleFunction) {
|
||||
ASSERT(this->config.parseSingleFunctionChildIndex > 0);
|
||||
this->config.parseSingleFunctionChildIndex++;
|
||||
}
|
||||
|
|
@ -5711,21 +5711,21 @@ public:
|
|||
RefPtr<Node> exprNode;
|
||||
bool delegate = false;
|
||||
|
||||
if (this->hasLineTerminator == false) {
|
||||
if (!this->hasLineTerminator) {
|
||||
const bool previousAllowYield = this->context->allowYield;
|
||||
this->context->allowYield = false;
|
||||
delegate = this->match(Multiply);
|
||||
|
||||
if (delegate == true) {
|
||||
if (delegate) {
|
||||
this->nextToken();
|
||||
if (isParse == true) {
|
||||
if (isParse) {
|
||||
exprNode = this->assignmentExpression<Parse>();
|
||||
} else {
|
||||
this->assignmentExpression<Scan>();
|
||||
}
|
||||
} else {
|
||||
if (this->match(SemiColon) == false && this->match(RightBrace) == false && this->match(RightParenthesis) == false && this->lookahead.type != Token::EOFToken) {
|
||||
if (isParse == true) {
|
||||
if (!this->match(SemiColon) && !this->match(RightBrace) && !this->match(RightParenthesis) && this->lookahead.type != Token::EOFToken) {
|
||||
if (isParse) {
|
||||
exprNode = this->assignmentExpression<Parse>();
|
||||
} else {
|
||||
this->assignmentExpression<Scan>();
|
||||
|
|
@ -5735,7 +5735,7 @@ public:
|
|||
this->context->allowYield = previousAllowYield;
|
||||
}
|
||||
|
||||
if (isParse == true) {
|
||||
if (isParse) {
|
||||
return this->finalize(node, new YieldExpressionNode(exprNode, delegate));
|
||||
}
|
||||
|
||||
|
|
@ -5788,7 +5788,7 @@ public:
|
|||
key = this->parseObjectPropertyKey();
|
||||
value = this->parseSetterMethod();
|
||||
}
|
||||
} else if (lookaheadPropertyKey == true && token->type == Token::PunctuatorToken && token->valuePunctuatorKind == Multiply) {
|
||||
} else if (lookaheadPropertyKey && token->type == Token::PunctuatorToken && token->valuePunctuatorKind == Multiply) {
|
||||
kind = ClassElementNode::Kind::Method;
|
||||
computed = this->match(LeftSquareBracket);
|
||||
key = this->parseObjectPropertyKey();
|
||||
|
|
@ -6160,7 +6160,7 @@ std::tuple<RefPtr<Node>, ASTScopeContext*> parseSingleFunction(::Escargot::Conte
|
|||
parser.config.reparseArguments = codeBlock->shouldReparseArguments();
|
||||
auto sc = new ASTScopeContext(codeBlock->isStrict());
|
||||
parser.pushScopeContext(sc);
|
||||
parser.context->allowYield = codeBlock->isGenerator() == false;
|
||||
parser.context->allowYield = !codeBlock->isGenerator();
|
||||
RefPtr<Node> nd;
|
||||
if (codeBlock->isArrowFunctionExpression()) {
|
||||
nd = parser.parseArrowFunctionSourceElements();
|
||||
|
|
|
|||
|
|
@ -391,19 +391,19 @@ ObjectGetResult ArrayObject::getIndexedProperty(ExecutionState& state, const Val
|
|||
bool ArrayObject::setIndexedProperty(ExecutionState& state, const Value& property, const Value& value)
|
||||
{
|
||||
// checking isUint32 to prevent invoke toString on property more than once while calling setIndexedProperty
|
||||
if (LIKELY(isFastModeArray() == true && property.isUInt32() == true)) {
|
||||
if (LIKELY(isFastModeArray() && property.isUInt32())) {
|
||||
uint32_t idx = property.tryToUseAsArrayIndex(state);
|
||||
if (LIKELY(idx != Value::InvalidArrayIndexValue)) {
|
||||
uint32_t len = getArrayLength(state);
|
||||
if (UNLIKELY(len <= idx)) {
|
||||
if (UNLIKELY(isExtensible(state) == false)) {
|
||||
if (UNLIKELY(!isExtensible(state))) {
|
||||
return false;
|
||||
}
|
||||
if (UNLIKELY(setArrayLength(state, idx + 1) == false) || UNLIKELY(isFastModeArray() == false)) {
|
||||
if (UNLIKELY(!setArrayLength(state, idx + 1)) || UNLIKELY(!isFastModeArray())) {
|
||||
return set(state, ObjectPropertyName(state, property), value, this);
|
||||
}
|
||||
// fast, non-fast mode can be changed while changing length
|
||||
if (LIKELY(isFastModeArray() == true)) {
|
||||
if (LIKELY(isFastModeArray())) {
|
||||
m_fastModeData[idx] = value;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ BoundFunctionObject::BoundFunctionObject(ExecutionState& state, Value& targetFun
|
|||
, m_boundTargetFunction(targetFunction)
|
||||
, m_boundThis(boundThis)
|
||||
{
|
||||
ASSERT(targetFunction.isObject() == true);
|
||||
ASSERT(targetFunction.isObject());
|
||||
m_structure = state.context()->defaultStructureForBoundFunctionObject();
|
||||
m_values[ESCARGOT_OBJECT_BUILTIN_PROPERTY_NUMBER + 0] = length;
|
||||
m_values[ESCARGOT_OBJECT_BUILTIN_PROPERTY_NUMBER + 1] = name;
|
||||
|
|
@ -79,7 +79,7 @@ Value BoundFunctionObject::call(ExecutionState& state, const Value& thisValue, c
|
|||
// https://www.ecma-international.org/ecma-262/6.0/#sec-bound-function-exotic-objects-construct-argumentslist-newtarget
|
||||
Object* BoundFunctionObject::construct(ExecutionState& state, const size_t calledArgc, Value* calledArgv, const Value& newTarget)
|
||||
{
|
||||
ASSERT(isConstructor() == true);
|
||||
ASSERT(isConstructor());
|
||||
// Let args be a new list containing the same values as the list boundArgs in the same order followed by the same values as the list argumentsList in the same order.
|
||||
size_t boundArgc = m_boundArguments.size();
|
||||
size_t mergedArgc = boundArgc + calledArgc;
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ FunctionEnvironmentRecordNotIndexed::FunctionEnvironmentRecordNotIndexed(Functio
|
|||
|
||||
void DeclarativeEnvironmentRecordNotIndexed::createBinding(ExecutionState& state, const AtomicString& name, bool canDelete, bool isMutable)
|
||||
{
|
||||
ASSERT(canDelete == false);
|
||||
ASSERT(!canDelete);
|
||||
ASSERT(hasBinding(state, name).m_index == SIZE_MAX);
|
||||
IdentifierRecord record;
|
||||
record.m_name = name;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ Value ExecutionState::getSuperConstructor(ExecutionState& state)
|
|||
|
||||
Value superConstructor = activeFunction.asObject()->getPrototype(state);
|
||||
|
||||
if (superConstructor.isConstructor() == false) {
|
||||
if (!superConstructor.isConstructor()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::Code::TypeError, errorMessage_No_Super_Binding);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public:
|
|||
|
||||
void setLexicalEnvironment(LexicalEnvironment* lexicalEnvironment, bool inStrictMode)
|
||||
{
|
||||
ASSERT(m_lexicalEnvironment == nullptr && m_inStrictMode == false);
|
||||
ASSERT(m_lexicalEnvironment == nullptr && !m_inStrictMode);
|
||||
ASSERT(lexicalEnvironment != nullptr);
|
||||
|
||||
m_lexicalEnvironment = lexicalEnvironment;
|
||||
|
|
@ -127,13 +127,13 @@ public:
|
|||
|
||||
ExecutionStateRareData* rareData()
|
||||
{
|
||||
ASSERT(hasRareData() == true);
|
||||
ASSERT(hasRareData());
|
||||
return m_rareData;
|
||||
}
|
||||
|
||||
ExecutionState* parent()
|
||||
{
|
||||
if (hasRareData() == false) {
|
||||
if (!hasRareData()) {
|
||||
return (ExecutionState*)(m_parent - 1);
|
||||
}
|
||||
return rareData()->m_parent;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ void FunctionObject::initFunctionObject(ExecutionState& state)
|
|||
|
||||
m_constructorKind = ConstructorKind::Base;
|
||||
|
||||
if (isConstructor() == true) {
|
||||
if (isConstructor()) {
|
||||
m_structure = isClassConstructor() ? state.context()->defaultStructureForClassFunctionObject() : state.context()->defaultStructureForFunctionObject();
|
||||
m_values[ESCARGOT_OBJECT_BUILTIN_PROPERTY_NUMBER + 0] = (Value(Object::createFunctionPrototypeObject(state, this)));
|
||||
m_values[ESCARGOT_OBJECT_BUILTIN_PROPERTY_NUMBER + 1] = (Value(m_codeBlock->functionName().string()));
|
||||
|
|
@ -232,13 +232,13 @@ Object* FunctionObject::construct(ExecutionState& state, const size_t argc, NULL
|
|||
FunctionObject* constructor = this;
|
||||
|
||||
// Assert: Type(newTarget) is Object.
|
||||
ASSERT(newTarget.isObject() == true);
|
||||
ASSERT(newTarget.isConstructor() == true);
|
||||
ASSERT(newTarget.isObject());
|
||||
ASSERT(newTarget.isConstructor());
|
||||
// Let kind be F’s [[ConstructorKind]] internal slot.
|
||||
ConstructorKind kind = constructorKind();
|
||||
Object* thisArgument;
|
||||
|
||||
if (cb->hasCallNativeFunctionCode() == true) {
|
||||
if (cb->hasCallNativeFunctionCode()) {
|
||||
thisArgument = cb->nativeFunctionData()->m_ctorFn(state, cb, argc, argv);
|
||||
// FIXME: If kind is "base", then
|
||||
} else {
|
||||
|
|
@ -246,14 +246,14 @@ Object* FunctionObject::construct(ExecutionState& state, const size_t argc, NULL
|
|||
thisArgument = new Object(state);
|
||||
}
|
||||
|
||||
if (constructor->getFunctionPrototype(state).isObject() == true) {
|
||||
if (constructor->getFunctionPrototype(state).isObject()) {
|
||||
thisArgument->setPrototype(state, constructor->getFunctionPrototype(state));
|
||||
} else {
|
||||
thisArgument->setPrototype(state, new Object(state));
|
||||
}
|
||||
|
||||
Value result = processCall(state, thisArgument, argc, argv, true);
|
||||
if (result.isObject() == true) {
|
||||
if (result.isObject()) {
|
||||
return result.asObject();
|
||||
}
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ Value FunctionObject::processCall(ExecutionState& state, const Value& receiverSr
|
|||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, "Class constructor cannot be invoked without 'new'");
|
||||
}
|
||||
|
||||
if (UNLIKELY(isSuperCall == true && isBuiltin() == true && isNewExpression == false)) {
|
||||
if (UNLIKELY(isSuperCall && isBuiltin() && !isNewExpression)) {
|
||||
Value returnValue = Object::construct(state, this, argc, argv);
|
||||
returnValue.asObject()->setPrototype(state, receiverSrc.toObject(state)->getPrototype(state));
|
||||
return returnValue;
|
||||
|
|
@ -377,8 +377,8 @@ Value FunctionObject::processCall(ExecutionState& state, const Value& receiverSr
|
|||
|
||||
Value* registerFile;
|
||||
|
||||
if (UNLIKELY(m_codeBlock->isGenerator() == true)) {
|
||||
if (isNewExpression == true) {
|
||||
if (UNLIKELY(m_codeBlock->isGenerator())) {
|
||||
if (isNewExpression) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, "Generator cannot be invoked with 'new'");
|
||||
}
|
||||
registerFile = (Value*)GC_MALLOC((registerSize + stackStorageSize + literalStorageSize) * sizeof(Value));
|
||||
|
|
@ -521,10 +521,10 @@ Value FunctionObject::processCall(ExecutionState& state, const Value& receiverSr
|
|||
}
|
||||
}
|
||||
|
||||
if (UNLIKELY(m_codeBlock->isGenerator() == true)) {
|
||||
if (UNLIKELY(m_codeBlock->isGenerator())) {
|
||||
ExecutionState* newState = new ExecutionState(ctx, &state, lexEnv, isStrict, registerFile);
|
||||
|
||||
if (UNLIKELY(m_codeBlock->usesArgumentsObject() == true)) {
|
||||
if (UNLIKELY(m_codeBlock->usesArgumentsObject())) {
|
||||
generateArgumentsObject(*newState, record, stackStorage);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,9 +154,9 @@ public:
|
|||
|
||||
FunctionKind functionKind()
|
||||
{
|
||||
if (isClassConstructor() == true) {
|
||||
if (isClassConstructor()) {
|
||||
return FunctionKind::ClassConstructor;
|
||||
} else if (isGenerator() == true) {
|
||||
} else if (isGenerator()) {
|
||||
return FunctionKind::Generator;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ void* GeneratorObject::operator new(size_t size)
|
|||
{
|
||||
static bool typeInited = false;
|
||||
static GC_descr descr;
|
||||
if (typeInited == false) {
|
||||
if (!typeInited) {
|
||||
GC_word obj_bitmap[GC_BITMAP_SIZE(GeneratorObject)] = { 0 };
|
||||
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(GeneratorObject, m_executionState));
|
||||
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(GeneratorObject, m_blk));
|
||||
|
|
@ -64,11 +64,11 @@ void* GeneratorObject::operator new(size_t size)
|
|||
// https://www.ecma-international.org/ecma-262/6.0/#sec-generatorvalidate
|
||||
GeneratorObject* generatorValidate(ExecutionState& state, const Value& generator)
|
||||
{
|
||||
if (generator.isObject() == false) {
|
||||
if (!generator.isObject()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, errorMessage_GlobalObject_ThisNotObject);
|
||||
}
|
||||
|
||||
if (generator.asObject()->isGeneratorObject() == false) {
|
||||
if (!generator.asObject()->isGeneratorObject()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, state.context()->staticStrings().Generator.string(), true, state.context()->staticStrings().next.string(), errorMessage_GlobalObject_CalledOnIncompatibleReceiver);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,13 +92,13 @@ static Value arraySpeciesCreate(ExecutionState& state, Object* originalArray, co
|
|||
Value C;
|
||||
// Let isArray be IsArray(originalArray).
|
||||
// If isArray is true, then
|
||||
if (originalArray->isArrayObject() == true) {
|
||||
if (originalArray->isArrayObject()) {
|
||||
// Let C be Get(originalArray, "constructor").
|
||||
C = originalArrayConstructor;
|
||||
|
||||
// TODO 9.4.2.3. 6.c. (after Realm is implemented)
|
||||
// If Type(C) is Object, then
|
||||
if (C.isObject() == true) {
|
||||
if (C.isObject()) {
|
||||
// Let C be Get(C, @@species).
|
||||
C = C.asObject()->get(state, ObjectPropertyName(state, state.context()->vmInstance()->globalSymbols().species)).value(state, C);
|
||||
}
|
||||
|
|
@ -106,11 +106,11 @@ static Value arraySpeciesCreate(ExecutionState& state, Object* originalArray, co
|
|||
|
||||
// If C is null, let C be undefined.
|
||||
// If C is undefined, return ArrayCreate(length).
|
||||
if (C.isUndefinedOrNull() == true) {
|
||||
if (C.isUndefinedOrNull()) {
|
||||
return new ArrayObject(state, static_cast<double>(length));
|
||||
}
|
||||
// If IsConstructor(C) is false, throw a TypeError exception.
|
||||
if (C.isConstructor() == false) {
|
||||
if (!C.isConstructor()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, state.context()->staticStrings().Array.string(), false, String::emptyString, errorMessage_GlobalObject_ThisNotConstructor);
|
||||
}
|
||||
// Return Construct(C, <<length>>).
|
||||
|
|
@ -164,7 +164,7 @@ static Value builtinArrayFrom(ExecutionState& state, Value thisValue, size_t arg
|
|||
if (!usingIterator.isUndefined()) {
|
||||
Object* A;
|
||||
// If IsConstructor(C) is true, then
|
||||
if (C.isConstructor() == true) {
|
||||
if (C.isConstructor()) {
|
||||
// Let A be ? Construct(C).
|
||||
A = Object::construct(state, C, 0, nullptr);
|
||||
} else {
|
||||
|
|
@ -220,7 +220,7 @@ static Value builtinArrayFrom(ExecutionState& state, Value thisValue, size_t arg
|
|||
auto len = arrayLike->lengthES6(state);
|
||||
// If IsConstructor(C) is true, then
|
||||
Object* A;
|
||||
if (C.isConstructor() == true) {
|
||||
if (C.isConstructor()) {
|
||||
// Let A be ? Construct(C, « len »).
|
||||
Value vlen(len);
|
||||
A = Object::construct(state, C, 1, &vlen);
|
||||
|
|
@ -266,7 +266,7 @@ static Value builtinArrayOf(ExecutionState& state, Value thisValue, size_t argc,
|
|||
Value C = thisValue;
|
||||
|
||||
Object* A;
|
||||
if (C.isConstructor() == true) {
|
||||
if (C.isConstructor()) {
|
||||
Value arg[1] = { Value(len) };
|
||||
A = Object::construct(state, C, 1, arg);
|
||||
} else {
|
||||
|
|
@ -481,8 +481,8 @@ static Value builtinArraySplice(ExecutionState& state, Value thisValue, size_t a
|
|||
CHECK_ARRAY_LENGTH(len + insertCount - actualDeleteCount, (1LL << 53));
|
||||
// Let A be ArraySpeciesCreate(O, actualDeleteCount).
|
||||
Value val = arraySpeciesCreate(state, O, actualDeleteCount);
|
||||
ASSERT(val.isObject() == true);
|
||||
ASSERT(val.asObject()->isArrayObject() == true);
|
||||
ASSERT(val.isObject());
|
||||
ASSERT(val.asObject()->isArrayObject());
|
||||
ArrayObject* A = val.asObject()->asArrayObject();
|
||||
#else
|
||||
// Let actualDeleteCount be min(max(ToInteger(deleteCount),0), len – actualStart).
|
||||
|
|
@ -701,8 +701,8 @@ static Value builtinArraySlice(ExecutionState& state, Value thisValue, size_t ar
|
|||
// Let count be max(final - k, 0).
|
||||
// Let A be ArraySpeciesCreate(O, count).
|
||||
Value val = arraySpeciesCreate(state, thisObject, std::max(finalEnd - k, (int64_t)0));
|
||||
ASSERT(val.isObject() == true);
|
||||
ASSERT(val.asObject()->isArrayObject() == true);
|
||||
ASSERT(val.isObject());
|
||||
ASSERT(val.asObject()->isArrayObject());
|
||||
ArrayObject* array = val.asObject()->asArrayObject();
|
||||
#else
|
||||
ArrayObject* array = new ArrayObject(state);
|
||||
|
|
@ -1001,8 +1001,8 @@ static Value builtinArrayFilter(ExecutionState& state, Value thisValue, size_t a
|
|||
#ifdef ESCARGOT_ENABLE_ES2015
|
||||
// Let A be ArraySpeciesCreate(O, 0).
|
||||
Value val = arraySpeciesCreate(state, O, 0);
|
||||
ASSERT(val.isObject() == true);
|
||||
ASSERT(val.asObject()->isArrayObject() == true);
|
||||
ASSERT(val.isObject());
|
||||
ASSERT(val.asObject()->isArrayObject());
|
||||
ArrayObject* A = val.asObject()->asArrayObject();
|
||||
#else
|
||||
// Let A be a new array created as if by the expression new Array() where Array is the standard built-in constructor with that name.
|
||||
|
|
@ -1072,8 +1072,8 @@ static Value builtinArrayMap(ExecutionState& state, Value thisValue, size_t argc
|
|||
#ifdef ESCARGOT_ENABLE_ES2015
|
||||
// Let A be ArraySpeciesCreate(O, len).
|
||||
Value val = arraySpeciesCreate(state, O, len);
|
||||
ASSERT(val.isObject() == true);
|
||||
ASSERT(val.asObject()->isArrayObject() == true);
|
||||
ASSERT(val.isObject());
|
||||
ASSERT(val.asObject()->isArrayObject());
|
||||
ArrayObject* A = val.asObject()->asArrayObject();
|
||||
#else
|
||||
// Let A be a new array created as if by the expression new Array(len) where Array is the standard built-in constructor with that name and len is the value of len.
|
||||
|
|
@ -1321,14 +1321,14 @@ static Value builtinArrayReduce(ExecutionState& state, Value thisValue, size_t a
|
|||
accumulator = initialValue;
|
||||
} else { // 8
|
||||
bool kPresent = false; // 8.a
|
||||
while (kPresent == false && k < len) { // 8.b
|
||||
while (!kPresent && k < len) { // 8.b
|
||||
Value Pk = Value(k); // 8.b.i
|
||||
kPresent = O->hasProperty(state, ObjectPropertyName(state, Pk)); // 8.b.ii
|
||||
if (kPresent)
|
||||
accumulator = O->get(state, ObjectPropertyName(state, Pk)).value(state, O); // 8.b.iii.1
|
||||
k++; // 8.b.iv
|
||||
}
|
||||
if (kPresent == false)
|
||||
if (!kPresent)
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, state.context()->staticStrings().Array.string(), true, state.context()->staticStrings().reduce.string(), errorMessage_GlobalObject_ReduceError);
|
||||
}
|
||||
while (k < len) { // 9
|
||||
|
|
@ -1384,7 +1384,7 @@ static Value builtinArrayReduceRight(ExecutionState& state, Value thisValue, siz
|
|||
bool kPresent = false;
|
||||
|
||||
// Repeat, while kPresent is false and k ≥ 0
|
||||
while ((kPresent == false) && k >= 0) {
|
||||
while (!kPresent && k >= 0) {
|
||||
// Let Pk be ToString(k).
|
||||
ObjectPropertyName Pk(state, Value(k));
|
||||
// Let kPresent be the result of calling the [[HasProperty]] internal method of O with argument Pk.
|
||||
|
|
@ -1403,7 +1403,7 @@ static Value builtinArrayReduceRight(ExecutionState& state, Value thisValue, siz
|
|||
k = result;
|
||||
}
|
||||
// If kPresent is false, throw a TypeError exception.
|
||||
if (kPresent == false) {
|
||||
if (!kPresent) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, state.context()->staticStrings().Array.string(), true, state.context()->staticStrings().reduceRight.string(), errorMessage_GlobalObject_ReduceError);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,14 +123,14 @@ static Value builtinFunctionConstructor(ExecutionState& state, Value thisValue,
|
|||
static Value builtinFunctionToString(ExecutionState& state, Value thisValue, size_t argc, Value* argv, bool isNewExpression)
|
||||
{
|
||||
// FIXME: If Type(func) is Object and is either a built-in function object or has an [[ECMAScriptCode]] internal slot, then
|
||||
if (thisValue.isFunction() == true) {
|
||||
if (thisValue.isFunction()) {
|
||||
FunctionObject* fn = thisValue.asFunction();
|
||||
StringBuilder builder;
|
||||
builder.appendString("function ");
|
||||
builder.appendString(fn->codeBlock()->functionName().string());
|
||||
builder.appendString("(");
|
||||
|
||||
if (fn->codeBlock()->isInterpretedCodeBlock() == true) {
|
||||
if (fn->codeBlock()->isInterpretedCodeBlock()) {
|
||||
for (size_t i = 0; i < fn->codeBlock()->asInterpretedCodeBlock()->parametersInfomation().size(); i++) {
|
||||
builder.appendString(fn->codeBlock()->asInterpretedCodeBlock()->parametersInfomation()[i].m_name.string());
|
||||
if (i < (fn->codeBlock()->asInterpretedCodeBlock()->parametersInfomation().size() - 1)) {
|
||||
|
|
@ -140,7 +140,7 @@ static Value builtinFunctionToString(ExecutionState& state, Value thisValue, siz
|
|||
}
|
||||
|
||||
builder.appendString(") ");
|
||||
if (fn->codeBlock()->isInterpretedCodeBlock() == true && fn->codeBlock()->asInterpretedCodeBlock()->script() != nullptr) {
|
||||
if (fn->codeBlock()->isInterpretedCodeBlock() && fn->codeBlock()->asInterpretedCodeBlock()->script() != nullptr) {
|
||||
StringView src = fn->codeBlock()->asInterpretedCodeBlock()->src();
|
||||
while (src[src.length() - 1] != '}') {
|
||||
src = StringView(src, 0, src.length() - 1);
|
||||
|
|
@ -153,7 +153,7 @@ static Value builtinFunctionToString(ExecutionState& state, Value thisValue, siz
|
|||
return builder.finalize(&state);
|
||||
}
|
||||
|
||||
if (thisValue.isObject() == true && thisValue.asObject()->isBoundFunctionObject() == true) {
|
||||
if (thisValue.isObject() && thisValue.asObject()->isBoundFunctionObject()) {
|
||||
StringBuilder builder;
|
||||
builder.appendString("function () { [native code] }");
|
||||
return builder.finalize(&state);
|
||||
|
|
@ -165,7 +165,7 @@ static Value builtinFunctionToString(ExecutionState& state, Value thisValue, siz
|
|||
|
||||
static Value builtinFunctionApply(ExecutionState& state, Value thisValue, size_t argc, Value* argv, bool isNewExpression)
|
||||
{
|
||||
if (thisValue.isCallable() == false) {
|
||||
if (!thisValue.isCallable()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, state.context()->staticStrings().Function.string(), true, state.context()->staticStrings().apply.string(), errorMessage_GlobalObject_ThisNotFunctionObject);
|
||||
}
|
||||
Value thisArg = argv[0];
|
||||
|
|
@ -195,7 +195,7 @@ static Value builtinFunctionApply(ExecutionState& state, Value thisValue, size_t
|
|||
|
||||
static Value builtinFunctionCall(ExecutionState& state, Value thisValue, size_t argc, Value* argv, bool isNewExpression)
|
||||
{
|
||||
if (thisValue.isCallable() == false) {
|
||||
if (!thisValue.isCallable()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, state.context()->staticStrings().Function.string(), true, state.context()->staticStrings().apply.string(), errorMessage_GlobalObject_ThisNotFunctionObject);
|
||||
}
|
||||
Value thisArg = argv[0];
|
||||
|
|
@ -212,7 +212,7 @@ static Value builtinFunctionCall(ExecutionState& state, Value thisValue, size_t
|
|||
static Value builtinFunctionBind(ExecutionState& state, Value thisValue, size_t argc, Value* argv, bool isNewExpression)
|
||||
{
|
||||
// If IsCallable(Target) is false, throw a TypeError exception.
|
||||
if (thisValue.isCallable() == false) {
|
||||
if (!thisValue.isCallable()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, state.context()->staticStrings().Function.string(), true, state.context()->staticStrings().bind.string(), errorMessage_GlobalObject_ThisNotFunctionObject);
|
||||
}
|
||||
|
||||
|
|
@ -229,13 +229,13 @@ static Value builtinFunctionBind(ExecutionState& state, Value thisValue, size_t
|
|||
bool targetHasLength = target->hasOwnProperty(state, ObjectPropertyName(state.context()->staticStrings().length));
|
||||
double length = 0;
|
||||
// If targetHasLength is true, then
|
||||
if (targetHasLength == true) {
|
||||
if (targetHasLength) {
|
||||
// Let targetLen be Get(Target, "length").
|
||||
Value targetLen = target->get(state, ObjectPropertyName(state.context()->staticStrings().length)).value(state, target);
|
||||
// If Type(targetLen) is not Number, let L be 0.
|
||||
// Else Let targetLen be ToInteger(targetLen).
|
||||
// Let L be the larger of 0 and the result of targetLen minus the number of elements of args.
|
||||
if (targetLen.isNumber() == true) {
|
||||
if (targetLen.isNumber()) {
|
||||
length = std::max(0.0, targetLen.toInteger(state) - boundArgc);
|
||||
}
|
||||
}
|
||||
|
|
@ -246,7 +246,7 @@ static Value builtinFunctionBind(ExecutionState& state, Value thisValue, size_t
|
|||
// Let targetName be Get(Target, "name").
|
||||
Value targetName = target->get(state, ObjectPropertyName(state.context()->staticStrings().name)).value(state, target);
|
||||
// If Type(targetName) is not String, let targetName be the empty string.
|
||||
if (targetName.isString() != true) {
|
||||
if (!targetName.isString()) {
|
||||
targetName = String::emptyString;
|
||||
}
|
||||
|
||||
|
|
@ -266,7 +266,7 @@ static Value builtinFunctionBind(ExecutionState& state, Value thisValue, size_t
|
|||
static Value builtinFunctionHasInstanceOf(ExecutionState& state, Value thisValue, size_t argc, Value* argv, bool isNewExpression)
|
||||
{
|
||||
#ifndef ESCARGOT_ENABLE_ES2015
|
||||
if (thisValue.isFunction() == false) {
|
||||
if (!thisValue.isFunction()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, errorMessage_InstanceOf_NotFunction);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ static Value builtinJSONParse(ExecutionState& state, Value thisValue, size_t arg
|
|||
|
||||
// 4
|
||||
Value reviver = argv[1];
|
||||
if (reviver.isCallable() == true) {
|
||||
if (reviver.isCallable()) {
|
||||
Object* root = new Object(state);
|
||||
root->defineOwnProperty(state, ObjectPropertyName(state, String::emptyString), ObjectPropertyDescriptor(unfiltered, ObjectPropertyDescriptor::AllPresent));
|
||||
std::function<Value(Value, const ObjectPropertyName&)> Walk;
|
||||
|
|
@ -292,8 +292,8 @@ static Value builtinJSONStringify(ExecutionState& state, Value thisValue, size_t
|
|||
|
||||
// 4
|
||||
Value replacerFunc;
|
||||
if (replacer.isObject() == true) {
|
||||
if (replacer.isCallable() == true) {
|
||||
if (replacer.isObject()) {
|
||||
if (replacer.isCallable()) {
|
||||
replacerFunc = replacer;
|
||||
} else if (replacer.asObject()->isArrayObject()) {
|
||||
propertyListTouched = true;
|
||||
|
|
@ -382,7 +382,7 @@ static Value builtinJSONStringify(ExecutionState& state, Value thisValue, size_t
|
|||
}
|
||||
}
|
||||
|
||||
if (replacerFunc.isUndefined() == false) {
|
||||
if (!replacerFunc.isUndefined()) {
|
||||
Value arguments[] = { key.toPlainValue(state), value };
|
||||
value = Object::call(state, replacerFunc, holder, 2, arguments);
|
||||
}
|
||||
|
|
@ -412,7 +412,7 @@ static Value builtinJSONStringify(ExecutionState& state, Value thisValue, size_t
|
|||
}
|
||||
return strings->null.string();
|
||||
}
|
||||
if (value.isObject() == true && value.isCallable() == false) {
|
||||
if (value.isObject() && !value.isCallable()) {
|
||||
if (value.asObject()->isArrayObject()) {
|
||||
return JA(value.asObject()->asArrayObject());
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ static Value builtinRegExpConstructor(ExecutionState& state, Value thisValue, si
|
|||
#else
|
||||
}
|
||||
// If Type(pattern) is Object and pattern has a [[RegExpMatcher]] internal slot, then
|
||||
if (pattern.isObject() == true && pattern.asObject()->isRegExpObject(state) == true) {
|
||||
if (pattern.isObject() && pattern.asObject()->isRegExpObject(state)) {
|
||||
RegExpObject* patternRegExp = pattern.asObject()->asRegExpObject(state);
|
||||
// Let P be the value of pattern’s [[OriginalSource]] internal slot.
|
||||
source = patternRegExp->source();
|
||||
|
|
@ -62,7 +62,7 @@ static Value builtinRegExpConstructor(ExecutionState& state, Value thisValue, si
|
|||
#endif /* !ESCARGOT_ENABLE_ES2015 */
|
||||
|
||||
RegExpObject* regexp;
|
||||
if (isNewExpression && thisValue.isObject() == true && thisValue.asObject()->isRegExpObject(state) == true) {
|
||||
if (isNewExpression && thisValue.isObject() && thisValue.asObject()->isRegExpObject(state)) {
|
||||
regexp = thisValue.asPointerValue()->asObject()->asRegExpObject(state);
|
||||
} else {
|
||||
regexp = new RegExpObject(state);
|
||||
|
|
@ -76,7 +76,7 @@ static Value builtinRegExpConstructor(ExecutionState& state, Value thisValue, si
|
|||
static Value builtinRegExpExec(ExecutionState& state, Value thisValue, size_t argc, Value* argv, bool isNewExpression)
|
||||
{
|
||||
RESOLVE_THIS_BINDING_TO_OBJECT(thisObject, RegExp, exec);
|
||||
if (thisObject->isRegExpObject(state) == false) {
|
||||
if (!thisObject->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, state.context()->staticStrings().RegExp.string(), true, state.context()->staticStrings().exec.string(), errorMessage_GlobalObject_ThisNotRegExpObject);
|
||||
}
|
||||
RegExpObject* regexp = thisObject->asRegExpObject(state);
|
||||
|
|
@ -124,7 +124,7 @@ static Value builtinRegExpExec(ExecutionState& state, Value thisValue, size_t ar
|
|||
static Value builtinRegExpTest(ExecutionState& state, Value thisValue, size_t argc, Value* argv, bool isNewExpression)
|
||||
{
|
||||
RESOLVE_THIS_BINDING_TO_OBJECT(thisObject, RegExp, test);
|
||||
if (thisObject->isRegExpObject(state) == false) {
|
||||
if (!thisObject->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, state.context()->staticStrings().RegExp.string(), true, state.context()->staticStrings().test.string(), errorMessage_GlobalObject_ThisNotRegExpObject);
|
||||
}
|
||||
RegExpObject* regexp = thisObject->asRegExpObject(state);
|
||||
|
|
@ -170,12 +170,12 @@ static Value builtinRegExpToString(ExecutionState& state, Value thisValue, size_
|
|||
|
||||
static Value builtinRegExpCompile(ExecutionState& state, Value thisValue, size_t argc, Value* argv, bool isNewExpression)
|
||||
{
|
||||
if (thisValue.isPointerValue() == false || thisValue.asPointerValue()->isObject() == false || thisValue.asPointerValue()->asObject()->isRegExpObject(state) == false) {
|
||||
if (!thisValue.isPointerValue() || !thisValue.asPointerValue()->isObject() || !thisValue.asPointerValue()->asObject()->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, "'This' is not a RegExp object");
|
||||
}
|
||||
|
||||
if (argv[0].isObject() == true && argv[0].asObject()->isRegExpObject(state) == true) {
|
||||
if (argv[1].isUndefined() == false) {
|
||||
if (argv[0].isObject() && argv[0].asObject()->isRegExpObject(state)) {
|
||||
if (!argv[1].isUndefined()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, "Cannot supply flags when constructing one RegExp from another");
|
||||
} else {
|
||||
RegExpObject* retVal = thisValue.asPointerValue()->asObject()->asRegExpObject(state);
|
||||
|
|
@ -363,7 +363,7 @@ GlobalRegExpFunctionObject::GlobalRegExpFunctionObject(ExecutionState& state)
|
|||
|
||||
static Value builtinRegExpOptionGetterHelper(ExecutionState& state, Value thisValue, unsigned int option)
|
||||
{
|
||||
if (thisValue.isObject() == false || thisValue.asObject()->isRegExpObject(state) == false) {
|
||||
if (!thisValue.isObject() || !thisValue.asObject()->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::Code::TypeError, "getter called on non-RegExp object");
|
||||
}
|
||||
|
||||
|
|
@ -377,7 +377,7 @@ static Value builtinRegExpOptionGetterHelper(ExecutionState& state, Value thisVa
|
|||
|
||||
static Value builtinRegExpFlagsGetter(ExecutionState& state, Value thisValue, size_t argc, Value* argv, bool isNewExpression)
|
||||
{
|
||||
if (thisValue.isObject() == false) {
|
||||
if (!thisValue.isObject()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::Code::TypeError, "getter called on non-object");
|
||||
}
|
||||
|
||||
|
|
@ -401,7 +401,7 @@ static Value builtinRegExpMultiLineGetter(ExecutionState& state, Value thisValue
|
|||
|
||||
static Value builtinRegExpSourceGetter(ExecutionState& state, Value thisValue, size_t argc, Value* argv, bool isNewExpression)
|
||||
{
|
||||
if (thisValue.isObject() == false || thisValue.asObject()->isRegExpObject(state) == false) {
|
||||
if (!thisValue.isObject() || !thisValue.asObject()->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::Code::TypeError, "getter called on non-RegExp object");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ static Value builtinStringMatch(ExecutionState& state, Value thisValue, size_t a
|
|||
RESOLVE_THIS_BINDING_TO_STRING(str, String, match);
|
||||
Value argument = argv[0];
|
||||
RegExpObject* regexp;
|
||||
if (argument.isPointerValue() == true && argument.asPointerValue()->isRegExpObject(state) == true) {
|
||||
if (argument.isPointerValue() && argument.asPointerValue()->isRegExpObject(state)) {
|
||||
regexp = argument.asPointerValue()->asRegExpObject(state);
|
||||
} else {
|
||||
regexp = new RegExpObject(state, argument.isUndefined() ? String::emptyString : argument.toString(state), String::emptyString);
|
||||
|
|
@ -314,7 +314,7 @@ static Value builtinStringReplace(ExecutionState& state, Value thisValue, size_t
|
|||
bool replaceValueIsFunction = replaceValue.isCallable();
|
||||
RegexMatchResult result;
|
||||
|
||||
if (searchValue.isPointerValue() == true && searchValue.asPointerValue()->isRegExpObject(state) == true) {
|
||||
if (searchValue.isPointerValue() && searchValue.asPointerValue()->isRegExpObject(state)) {
|
||||
RegExpObject* regexp = searchValue.asPointerValue()->asRegExpObject(state);
|
||||
bool isGlobal = regexp->option() & RegExpObject::Option::Global;
|
||||
|
||||
|
|
@ -493,7 +493,7 @@ static Value builtinStringSearch(ExecutionState& state, Value thisValue, size_t
|
|||
Value parameter[1] = { Value(string) };
|
||||
return Object::call(state, func, rx, 1, parameter);
|
||||
#else
|
||||
if (regexp.isPointerValue() == true && regexp.asPointerValue()->isRegExpObject(state) == true) {
|
||||
if (regexp.isPointerValue() && regexp.asPointerValue()->isRegExpObject(state)) {
|
||||
// If Type(regexp) is Object and the value of the [[Class]] internal property of regexp is "RegExp", then let rx be regexp;
|
||||
rx = regexp.asPointerValue()->asRegExpObject(state);
|
||||
} else {
|
||||
|
|
@ -542,7 +542,7 @@ static Value builtinStringSplit(ExecutionState& state, Value thisValue, size_t a
|
|||
// If limit is undefined, let lim = 2^32 – 1; else let lim = ToUint32(limit).
|
||||
lim = limit.isUndefined() ? Value::InvalidIndexValue - 1 : limit.toUint32(state);
|
||||
// If separator is a RegExp object (its [[Class]] is "RegExp"), let R = separator; otherwise let R = ToString(separator).
|
||||
if (separator.isPointerValue() == true && separator.asPointerValue()->isRegExpObject(state) == true) {
|
||||
if (separator.isPointerValue() && separator.asPointerValue()->isRegExpObject(state)) {
|
||||
P = separator.asPointerValue()->asRegExpObject(state);
|
||||
} else {
|
||||
P = separator.toString(state);
|
||||
|
|
@ -579,7 +579,7 @@ static Value builtinStringSplit(ExecutionState& state, Value thisValue, size_t a
|
|||
};
|
||||
if (s == 0) {
|
||||
bool ret = true;
|
||||
if (P->isRegExpObject(state) == true) {
|
||||
if (P->isRegExpObject(state)) {
|
||||
RegexMatchResult result;
|
||||
ret = P->asRegExpObject(state)->matchNonGlobally(state, S, result, false, 0);
|
||||
} else {
|
||||
|
|
@ -597,7 +597,7 @@ static Value builtinStringSplit(ExecutionState& state, Value thisValue, size_t a
|
|||
size_t q = p;
|
||||
|
||||
// 13
|
||||
if (P->isRegExpObject(state) == true) {
|
||||
if (P->isRegExpObject(state)) {
|
||||
RegExpObject* R = P->asRegExpObject(state);
|
||||
while (q != s) {
|
||||
RegexMatchResult result;
|
||||
|
|
@ -885,7 +885,7 @@ static Value builtinStringStartsWith(ExecutionState& state, Value thisValue, siz
|
|||
Value searchString = argv[0];
|
||||
// Let isRegExp be ? IsRegExp(searchString).
|
||||
// If isRegExp is true, throw a TypeError exception.
|
||||
if (searchString.isObject() == true && searchString.asObject()->isRegExpObject(state) == true) {
|
||||
if (searchString.isObject() && searchString.asObject()->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, "can't use RegExp with startsWith");
|
||||
}
|
||||
// Let searchStr be ? ToString(searchString).
|
||||
|
|
@ -928,7 +928,7 @@ static Value builtinStringEndsWith(ExecutionState& state, Value thisValue, size_
|
|||
Value searchString = argv[0];
|
||||
// Let isRegExp be ? IsRegExp(searchString).
|
||||
// If isRegExp is true, throw a TypeError exception.
|
||||
if (searchString.isObject() == true && searchString.asObject()->isRegExpObject(state) == true) {
|
||||
if (searchString.isObject() && searchString.asObject()->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, "can't use RegExp with endsWith");
|
||||
}
|
||||
// Let len be the number of elements in S.
|
||||
|
|
@ -1032,7 +1032,7 @@ static Value builtinStringIncludes(ExecutionState& state, Value thisValue, size_
|
|||
// Let isRegExp be ? IsRegExp(searchString).
|
||||
// If isRegExp is true, throw a TypeError exception.
|
||||
Value searchString = argv[0];
|
||||
if (searchString.isObject() == true && searchString.asObject()->isRegExpObject(state) == true) {
|
||||
if (searchString.isObject() && searchString.asObject()->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, "can't use RegExp with includes");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ void MapObject::set(ExecutionState& state, const Value& key, const Value& value)
|
|||
}
|
||||
|
||||
// If key is -0, let key be +0.
|
||||
if (key.isNumber() && key.asNumber() == 0 && std::signbit(key.asNumber()) == true) {
|
||||
if (key.isNumber() && key.asNumber() == 0 && std::signbit(key.asNumber())) {
|
||||
m_storage.pushBack(std::make_pair(Value(0), value));
|
||||
} else {
|
||||
m_storage.pushBack(std::make_pair(key, value));
|
||||
|
|
|
|||
|
|
@ -849,7 +849,7 @@ Value Object::getMethod(ExecutionState& state, const Value& object, const Object
|
|||
Value Object::call(ExecutionState& state, const Value& callee, const Value& thisValue, const size_t argc, NULLABLE Value* argv)
|
||||
{
|
||||
// If IsCallable(F) is false, throw a TypeError exception.
|
||||
if (callee.isCallable() == false) {
|
||||
if (!callee.isCallable()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, errorMessage_NOT_Callable);
|
||||
}
|
||||
// Return F.[[Call]](V, argumentsList).
|
||||
|
|
@ -860,13 +860,13 @@ Value Object::call(ExecutionState& state, const Value& callee, const Value& this
|
|||
Object* Object::construct(ExecutionState& state, const Value& constructor, const size_t argc, NULLABLE Value* argv, Value newTarget)
|
||||
{
|
||||
// If newTarget was not passed, let newTarget be F.
|
||||
if (newTarget.isEmpty() == true) {
|
||||
if (newTarget.isEmpty()) {
|
||||
newTarget = constructor;
|
||||
}
|
||||
// Assert: IsConstructor (F) is true.
|
||||
ASSERT(constructor.isConstructor() == true);
|
||||
ASSERT(constructor.isConstructor());
|
||||
// Assert: IsConstructor (newTarget) is true.
|
||||
ASSERT(newTarget.isConstructor() == true);
|
||||
ASSERT(newTarget.isConstructor());
|
||||
// Return F.[[Construct]](argumentsList, newTarget).
|
||||
return constructor.asObject()->construct(state, argc, argv, newTarget);
|
||||
}
|
||||
|
|
@ -875,31 +875,31 @@ Object* Object::construct(ExecutionState& state, const Value& constructor, const
|
|||
bool Object::hasInstance(ExecutionState& state, const Value& C, Value O)
|
||||
{
|
||||
// If IsCallable(C) is false, return false.
|
||||
if (C.isCallable() == false) {
|
||||
if (!C.isCallable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If C has a [[BoundTargetFunction]] internal slot, then
|
||||
if (UNLIKELY(C.isObject() == true && C.asObject()->isBoundFunctionObject() == true)) {
|
||||
if (UNLIKELY(C.isObject() && C.asObject()->isBoundFunctionObject())) {
|
||||
// Let BC be the value of C’s [[BoundTargetFunction]] internal slot.
|
||||
Value BC = C.asObject()->asBoundFunctionObject()->targetFunction();
|
||||
// Return InstanceofOperator(O,BC) (see 12.9.4).
|
||||
return ByteCodeInterpreter::instanceOfOperation(state, O, BC).toBoolean(state);
|
||||
}
|
||||
// If Type(O) is not Object, return false.
|
||||
if (O.isObject() == false) {
|
||||
if (!O.isObject()) {
|
||||
return false;
|
||||
}
|
||||
// Let P be Get(C, "prototype").
|
||||
ASSERT(C.isFunction() == true);
|
||||
ASSERT(C.isFunction());
|
||||
Value P = C.asFunction()->getFunctionPrototype(state);
|
||||
// If Type(P) is not Object, throw a TypeError exception.
|
||||
if (P.isObject() == false) {
|
||||
if (!P.isObject()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, errorMessage_InstanceOf_InvalidPrototypeProperty);
|
||||
}
|
||||
// Repeat
|
||||
O = O.asObject()->getPrototype(state);
|
||||
while (O.isNull() == false) {
|
||||
while (!O.isNull()) {
|
||||
// If O is null, return false.
|
||||
// If SameValue(P, O) is true, return true.
|
||||
if (P == O) {
|
||||
|
|
@ -1195,23 +1195,23 @@ String* Object::optionString(ExecutionState& state)
|
|||
char flags[6] = { 0 };
|
||||
int flags_idx = 0;
|
||||
|
||||
if (this->get(state, ObjectPropertyName(state, state.context()->staticStrings().global)).value(state, this).toBoolean(state) == true) {
|
||||
if (this->get(state, ObjectPropertyName(state, state.context()->staticStrings().global)).value(state, this).toBoolean(state)) {
|
||||
flags[flags_idx++] = 'g';
|
||||
}
|
||||
|
||||
if (this->get(state, ObjectPropertyName(state, state.context()->staticStrings().ignoreCase)).value(state, this).toBoolean(state) == true) {
|
||||
if (this->get(state, ObjectPropertyName(state, state.context()->staticStrings().ignoreCase)).value(state, this).toBoolean(state)) {
|
||||
flags[flags_idx++] = 'i';
|
||||
}
|
||||
|
||||
if (this->get(state, ObjectPropertyName(state, state.context()->staticStrings().multiline)).value(state, this).toBoolean(state) == true) {
|
||||
if (this->get(state, ObjectPropertyName(state, state.context()->staticStrings().multiline)).value(state, this).toBoolean(state)) {
|
||||
flags[flags_idx++] = 'm';
|
||||
}
|
||||
|
||||
if (this->get(state, ObjectPropertyName(state, state.context()->staticStrings().unicode)).value(state, this).toBoolean(state) == true) {
|
||||
if (this->get(state, ObjectPropertyName(state, state.context()->staticStrings().unicode)).value(state, this).toBoolean(state)) {
|
||||
flags[flags_idx++] = 'u';
|
||||
}
|
||||
|
||||
if (this->get(state, ObjectPropertyName(state, state.context()->staticStrings().sticky)).value(state, this).toBoolean(state) == true) {
|
||||
if (this->get(state, ObjectPropertyName(state, state.context()->staticStrings().sticky)).value(state, this).toBoolean(state)) {
|
||||
flags[flags_idx++] = 'y';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ public:
|
|||
|
||||
RegExpObject* asRegExpObject(ExecutionState& state)
|
||||
{
|
||||
ASSERT(isRegExpObject(state) == true);
|
||||
ASSERT(isRegExpObject(state));
|
||||
return (RegExpObject*)this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ public:
|
|||
|
||||
RegExpObject* asRegExpObject(ExecutionState& state)
|
||||
{
|
||||
ASSERT(isRegExpObject(state) == true);
|
||||
ASSERT(isRegExpObject(state));
|
||||
return (RegExpObject*)this;
|
||||
}
|
||||
|
||||
|
|
@ -338,7 +338,7 @@ public:
|
|||
|
||||
BoundFunctionObject* asBoundFunctionObject()
|
||||
{
|
||||
ASSERT(isBoundFunctionObject() == true);
|
||||
ASSERT(isBoundFunctionObject());
|
||||
return (BoundFunctionObject*)this;
|
||||
}
|
||||
|
||||
|
|
@ -420,7 +420,7 @@ public:
|
|||
|
||||
GeneratorObject* asGeneratorObject()
|
||||
{
|
||||
ASSERT(isGeneratorObject() == true);
|
||||
ASSERT(isGeneratorObject());
|
||||
return (GeneratorObject*)this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -839,8 +839,8 @@ Object* ProxyObject::construct(ExecutionState& state, const size_t argc, NULLABL
|
|||
// 7. If trap is undefined, then
|
||||
// a. Assert: target has a [[Construct]] internal method.
|
||||
// b. Return Construct(target, argumentsList, newTarget).
|
||||
if (trap.isUndefined() == true) {
|
||||
ASSERT(target.isConstructor() == true);
|
||||
if (trap.isUndefined()) {
|
||||
ASSERT(target.isConstructor());
|
||||
return Object::construct(state, target, argc, argv, newTarget);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ void SetObject::add(ExecutionState& state, const Value& key)
|
|||
}
|
||||
|
||||
// If key is -0, let key be +0.
|
||||
if (key.isNumber() && key.asNumber() == 0 && std::signbit(key.asNumber()) == true) {
|
||||
if (key.isNumber() && key.asNumber() == 0 && std::signbit(key.asNumber())) {
|
||||
m_storage.pushBack(Value(0));
|
||||
} else {
|
||||
m_storage.pushBack(key);
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ static ObjectPropertyNativeGetterSetterData stringLengthGetterSetterData(
|
|||
#ifndef ESCARGOT_ENABLE_ES2015
|
||||
Value VMInstance::regexpSourceNativeGetter(ExecutionState& state, Object* self, const SmallValue& privateDataFromObjectPrivateArea)
|
||||
{
|
||||
if (self->isRegExpObject(state) == false) {
|
||||
if (!self->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::Code::TypeError, "getter called on non-RegExp object");
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ static ObjectPropertyNativeGetterSetterData regexpSourceGetterData(
|
|||
|
||||
Value VMInstance::regexpFlagsNativeGetter(ExecutionState& state, Object* self, const SmallValue& privateDataFromObjectPrivateArea)
|
||||
{
|
||||
if (self->isRegExpObject(state) == false) {
|
||||
if (!self->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::Code::TypeError, "getter called on non-RegExp object");
|
||||
}
|
||||
return Value(self->asRegExpObject(state)->optionString(state));
|
||||
|
|
@ -131,7 +131,7 @@ static ObjectPropertyNativeGetterSetterData regexpFlagsGetterData(
|
|||
|
||||
Value VMInstance::regexpGlobalNativeGetter(ExecutionState& state, Object* self, const SmallValue& privateDataFromObjectPrivateArea)
|
||||
{
|
||||
if (self->isRegExpObject(state) == false) {
|
||||
if (!self->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::Code::TypeError, "getter called on non-RegExp object");
|
||||
}
|
||||
return Value((bool)(self->asRegExpObject(state)->option() & RegExpObject::Option::Global));
|
||||
|
|
@ -142,7 +142,7 @@ static ObjectPropertyNativeGetterSetterData regexpGlobalGetterData(
|
|||
|
||||
Value VMInstance::regexpIgnoreCaseNativeGetter(ExecutionState& state, Object* self, const SmallValue& privateDataFromObjectPrivateArea)
|
||||
{
|
||||
if (self->isRegExpObject(state) == false) {
|
||||
if (!self->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::Code::TypeError, "getter called on non-RegExp object");
|
||||
}
|
||||
return Value((bool)(self->asRegExpObject(state)->option() & RegExpObject::Option::IgnoreCase));
|
||||
|
|
@ -153,7 +153,7 @@ static ObjectPropertyNativeGetterSetterData regexpIgnoreCaseGetterData(
|
|||
|
||||
Value VMInstance::regexpMultilineNativeGetter(ExecutionState& state, Object* self, const SmallValue& privateDataFromObjectPrivateArea)
|
||||
{
|
||||
if (self->isRegExpObject(state) == false) {
|
||||
if (!self->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::Code::TypeError, "getter called on non-RegExp object");
|
||||
}
|
||||
return Value((bool)(self->asRegExpObject(state)->option() & RegExpObject::Option::MultiLine));
|
||||
|
|
@ -164,7 +164,7 @@ static ObjectPropertyNativeGetterSetterData regexpMultilineGetterData(
|
|||
|
||||
Value VMInstance::regexpStickyNativeGetter(ExecutionState& state, Object* self, const SmallValue& privateDataFromObjectPrivateArea)
|
||||
{
|
||||
if (self->isRegExpObject(state) == false) {
|
||||
if (!self->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::Code::TypeError, "getter called on non-RegExp object");
|
||||
}
|
||||
return Value((bool)(self->asRegExpObject(state)->option() & RegExpObject::Option::Sticky));
|
||||
|
|
@ -175,7 +175,7 @@ static ObjectPropertyNativeGetterSetterData regexpStickyGetterData(
|
|||
|
||||
Value VMInstance::regexpUnicodeNativeGetter(ExecutionState& state, Object* self, const SmallValue& privateDataFromObjectPrivateArea)
|
||||
{
|
||||
if (self->isRegExpObject(state) == false) {
|
||||
if (!self->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::Code::TypeError, "getter called on non-RegExp object");
|
||||
}
|
||||
return Value((bool)(self->asRegExpObject(state)->option() & RegExpObject::Option::Unicode));
|
||||
|
|
@ -187,7 +187,7 @@ static ObjectPropertyNativeGetterSetterData regexpUnicodeGetterData(
|
|||
|
||||
Value VMInstance::regexpLastIndexNativeGetter(ExecutionState& state, Object* self, const SmallValue& privateDataFromObjectPrivateArea)
|
||||
{
|
||||
if (self->isRegExpObject(state) == false) {
|
||||
if (!self->isRegExpObject(state)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::Code::TypeError, "getter called on non-RegExp object");
|
||||
}
|
||||
return self->asRegExpObject(state)->lastIndex();
|
||||
|
|
@ -195,7 +195,7 @@ Value VMInstance::regexpLastIndexNativeGetter(ExecutionState& state, Object* sel
|
|||
|
||||
bool VMInstance::regexpLastIndexNativeSetter(ExecutionState& state, Object* self, SmallValue& privateDataFromObjectPrivateArea, const Value& setterInputData)
|
||||
{
|
||||
ASSERT(self->isRegExpObject(state) == true);
|
||||
ASSERT(self->isRegExpObject(state));
|
||||
self->asRegExpObject(state)->setLastIndex(state, setterInputData);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue