mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Fix a bug : ignore null or undefined value for spread element in object destructing
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
parent
875b1aa056
commit
b852fa1079
4 changed files with 23 additions and 43 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -10,9 +10,6 @@ output.js
|
|||
*.d
|
||||
*.js
|
||||
*.swp
|
||||
!test/es2015/*.js
|
||||
!test/regression-tests/*.js
|
||||
!test/regression-tests/xfail/*.js
|
||||
*.pyc
|
||||
tags
|
||||
cscope.out
|
||||
|
|
@ -26,7 +23,6 @@ build.ninja
|
|||
rules.ninja
|
||||
.ninja_deps
|
||||
.ninja_log
|
||||
#test/test262/test/config/excludelist.xml
|
||||
android/obj
|
||||
android/libs
|
||||
tools/vendortest/chakracore/chakracorelog.verbose.txt
|
||||
|
|
|
|||
|
|
@ -112,6 +112,26 @@ public:
|
|||
|
||||
element->generateExpressionByteCode(codeBlock, context, elementIndex);
|
||||
|
||||
|
||||
size_t cmpIndex = context->getRegister();
|
||||
LiteralNode* undefinedNode = new (alloca(sizeof(LiteralNode))) LiteralNode(Value());
|
||||
size_t undefinedIndex = undefinedNode->getRegister(codeBlock, context);
|
||||
undefinedNode->generateExpressionByteCode(codeBlock, context, undefinedIndex);
|
||||
codeBlock->pushCode(BinaryEqual(ByteCodeLOC(m_loc.index), elementIndex, undefinedIndex, cmpIndex), context, this);
|
||||
codeBlock->pushCode<JumpIfTrue>(JumpIfTrue(ByteCodeLOC(m_loc.index), cmpIndex), context, this);
|
||||
size_t pos1 = codeBlock->lastCodePosition<JumpIfTrue>();
|
||||
context->giveUpRegister(); // for drop undefinedIndex
|
||||
|
||||
LiteralNode* nullNode = new (alloca(sizeof(LiteralNode))) LiteralNode(Value(Value::Null));
|
||||
size_t nullIndex = nullNode->getRegister(codeBlock, context);
|
||||
nullNode->generateExpressionByteCode(codeBlock, context, nullIndex);
|
||||
codeBlock->pushCode(BinaryEqual(ByteCodeLOC(m_loc.index), elementIndex, nullIndex, cmpIndex), context, this);
|
||||
codeBlock->pushCode<JumpIfTrue>(JumpIfTrue(ByteCodeLOC(m_loc.index), cmpIndex), context, this);
|
||||
size_t pos2 = codeBlock->lastCodePosition<JumpIfFalse>();
|
||||
context->giveUpRegister(); // for drop nullIndex
|
||||
context->giveUpRegister(); // for drop cmpIndex
|
||||
|
||||
|
||||
codeBlock->pushCode(CreateEnumerateObject(ByteCodeLOC(m_loc.index), elementIndex, dataIndex, true), context, this);
|
||||
|
||||
size_t checkPos = codeBlock->currentCodeSize();
|
||||
|
|
@ -131,6 +151,9 @@ public:
|
|||
context->giveUpRegister();
|
||||
context->giveUpRegister();
|
||||
context->giveUpRegister();
|
||||
|
||||
codeBlock->peekCode<JumpIfTrue>(pos1)->m_jumpPosition = codeBlock->currentCodeSize();
|
||||
codeBlock->peekCode<JumpIfTrue>(pos2)->m_jumpPosition = codeBlock->currentCodeSize();
|
||||
}
|
||||
|
||||
codeBlock->m_shouldClearStack = true;
|
||||
|
|
|
|||
|
|
@ -1449,12 +1449,7 @@ public:
|
|||
{
|
||||
MetaNode node = this->createNode();
|
||||
this->expect(PunctuatorKind::PeriodPeriodPeriod);
|
||||
|
||||
ASTNode arg = this->inheritCoverGrammar(builder, &Parser::parseAssignmentExpression<ASTBuilder, checkLeftHasRestrictedWord>);
|
||||
if (arg->isAssignmentOperation()) {
|
||||
this->throwError(Messages::DefaultRestParameter);
|
||||
}
|
||||
|
||||
return this->finalize(node, builder.createSpreadElementNode(arg));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1623,11 +1623,7 @@
|
|||
<test id="built-ins/Promise/prototype/finally/this-value-then-poisoned"><reason>TODO</reason></test>
|
||||
<test id="built-ins/Promise/prototype/finally/this-value-then-throws"><reason>TODO</reason></test>
|
||||
<test id="built-ins/Promise/prototype/no-promise-state"><reason>TODO</reason></test>
|
||||
<test id="built-ins/Promise/prototype/then/capability-executor-called-twice in non-strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/Promise/prototype/then/capability-executor-called-twice in strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/Promise/prototype/then/capability-executor-called-twice"><reason>TODO</reason></test>
|
||||
<test id="built-ins/Promise/prototype/then/deferred-is-resolved-value in non-strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/Promise/prototype/then/deferred-is-resolved-value in strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/Promise/prototype/then/deferred-is-resolved-value"><reason>TODO</reason></test>
|
||||
<test id="built-ins/Promise/race/invoke-resolve-get-error-close"><reason>TODO</reason></test>
|
||||
<test id="built-ins/Promise/race/invoke-resolve-get-once-multiple-calls"><reason>TODO</reason></test>
|
||||
|
|
@ -2246,45 +2242,21 @@
|
|||
<test id="built-ins/RegExp/prototype/Symbol.split/get-flags-err"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/last-index-exceeds-str-size"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/length"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/limit-0-bail in non-strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/limit-0-bail in strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/limit-0-bail"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/species-ctor"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/species-ctor-y"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/splitter-proto-from-ctor-realm"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-coerce-lastindex-err in non-strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-coerce-lastindex-err in strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-coerce-lastindex-err"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-coerce-lastindex"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-empty-match-err in non-strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-empty-match-err in strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-empty-match-err"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-get-lastindex-err in non-strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-get-lastindex-err in strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-get-lastindex-err"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-match-err in non-strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-match-err in strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-match-err"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-result-coerce-length-err in non-strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-result-coerce-length-err in strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-result-coerce-length-err"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-result-coerce-length in non-strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-result-coerce-length in strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-result-coerce-length"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-result-get-capture-err in non-strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-result-get-capture-err in strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-result-get-capture-err"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-result-get-length-err in non-strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-result-get-length-err in strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-result-get-length-err"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-set-lastindex-err in non-strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-set-lastindex-err in strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-set-lastindex-err"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-set-lastindex-match in non-strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-set-lastindex-match in strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-set-lastindex-match"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-set-lastindex-no-match in non-strict mode"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-set-lastindex-no-match in strict mode "><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/str-set-lastindex-no-match"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/this-val-non-obj"><reason>TODO</reason></test>
|
||||
<test id="built-ins/RegExp/prototype/Symbol.split/u-lastindex-adv-thru-match"><reason>TODO</reason></test>
|
||||
|
|
@ -4257,12 +4229,6 @@
|
|||
<test id="language/expressions/addition/bigint-toprimitive"><reason>TODO</reason></test>
|
||||
<test id="language/expressions/addition/bigint-wrapped-values"><reason>TODO</reason></test>
|
||||
<test id="language/expressions/addition/coerce-bigint-to-string"><reason>TODO</reason></test>
|
||||
<test id="language/expressions/array/spread-mult-expr"><reason>TODO</reason></test>
|
||||
<test id="language/expressions/array/spread-mult-obj-null"><reason>TODO</reason></test>
|
||||
<test id="language/expressions/array/spread-mult-obj-undefined"><reason>TODO</reason></test>
|
||||
<test id="language/expressions/array/spread-obj-null"><reason>TODO</reason></test>
|
||||
<test id="language/expressions/array/spread-obj-undefined"><reason>TODO</reason></test>
|
||||
<test id="language/expressions/array/spread-sngl-expr"><reason>TODO</reason></test>
|
||||
<test id="language/expressions/arrow-function/dflt-params-ref-later"><reason>TODO</reason></test>
|
||||
<test id="language/expressions/arrow-function/dflt-params-ref-self"><reason>TODO</reason></test>
|
||||
<test id="language/expressions/arrow-function/dstr/ary-init-iter-close"><reason>TODO</reason></test>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue