mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Fix minor issues
* When there is arrow function on class ctor, we should use heap-allocated lex env for class ctor. because we need to compute this variable on run-time * when there is super expression with computed case, we should load this binding first for testing binding Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
8bba87833a
commit
355d7244f1
5 changed files with 36 additions and 4 deletions
|
|
@ -67,6 +67,25 @@ InterpretedCodeBlock* ScriptParser::generateCodeBlockTreeFromASTWalker(Context*
|
|||
}
|
||||
}
|
||||
|
||||
if (scopeCtx->m_hasThisExpression && scopeCtx->m_isArrowFunctionExpression) {
|
||||
// every arrow function should save this value of upper env.
|
||||
// except arrow function is localed on class constructor(class constructor needs test of this binding is valid)
|
||||
InterpretedCodeBlock* c = codeBlock;
|
||||
while (c) {
|
||||
if (c->isKindOfFunction()) {
|
||||
if (c->isArrowFunctionExpression()) {
|
||||
// pass
|
||||
} else if (c->isClassConstructor()) {
|
||||
c->m_canAllocateEnvironmentOnStack = false;
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
c = c->parentCodeBlock();
|
||||
}
|
||||
}
|
||||
|
||||
if (scopeCtx->m_hasSuperOrNewTarget) {
|
||||
InterpretedCodeBlock* c = codeBlock;
|
||||
while (c) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue