mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Fix a case in which parameter value is referenced before initialization to throw a reference error
* add ThrowStaticErrorOperation bytecode for each pre-accessed parameter value Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
parent
3c6032f8c9
commit
eb1bbd0c3f
8 changed files with 69 additions and 30 deletions
|
|
@ -82,7 +82,7 @@ InterpretedCodeBlock* ScriptParser::generateCodeBlockTreeFromASTWalker(Context*
|
|||
AtomicString uname = scopeCtx->m_childBlockScopes[i]->m_usingNames[j];
|
||||
auto blockIndex = scopeCtx->m_childBlockScopes[i]->m_blockIndex;
|
||||
if (uname == arguments) {
|
||||
if (UNLIKELY(codeBlock->isOnParameterName(arguments))) {
|
||||
if (UNLIKELY(codeBlock->hasParameterName(arguments))) {
|
||||
continue;
|
||||
} else {
|
||||
bool hasKindOfArgumentsHolderOnAncestors = false;
|
||||
|
|
@ -96,11 +96,11 @@ InterpretedCodeBlock* ScriptParser::generateCodeBlockTreeFromASTWalker(Context*
|
|||
argumentsObjectHolder = argumentsObjectHolder->parentCodeBlock();
|
||||
}
|
||||
|
||||
if (hasKindOfArgumentsHolderOnAncestors && !argumentsObjectHolder->isOnParameterName(arguments)) {
|
||||
if (hasKindOfArgumentsHolderOnAncestors && !argumentsObjectHolder->hasParameterName(arguments)) {
|
||||
InterpretedCodeBlock* argumentsVariableHolder = nullptr;
|
||||
InterpretedCodeBlock* c = codeBlock->parentCodeBlock();
|
||||
while (c && !c->isGlobalScopeCodeBlock()) {
|
||||
if (c->isOnParameterName(arguments)) {
|
||||
if (c->hasParameterName(arguments)) {
|
||||
argumentsVariableHolder = c;
|
||||
break;
|
||||
} else if (!c->isArrowFunctionExpression()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue