mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
1. fix bug in Object::nextIndex*
2. implement ::generateCodeBlockTreeFromASTWalkerPostProcess Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
2057250e48
commit
c970d99552
7 changed files with 21 additions and 15 deletions
|
|
@ -98,10 +98,6 @@ CodeBlock* ScriptParser::generateCodeBlockTreeFromASTWalker(Context* ctx, String
|
|||
codeBlock->appendChildBlock(generateCodeBlockTreeFromASTWalker(ctx, source, script, scopeCtx->m_childScopes[i], codeBlock));
|
||||
}
|
||||
|
||||
if (parentCodeBlock) {
|
||||
codeBlock->computeVariables();
|
||||
}
|
||||
|
||||
return codeBlock;
|
||||
}
|
||||
|
||||
|
|
@ -111,6 +107,14 @@ CodeBlock* ScriptParser::generateCodeBlockTreeFromAST(Context* ctx, StringView s
|
|||
return generateCodeBlockTreeFromASTWalker(ctx, source, script, program->scopeContext(), nullptr);
|
||||
}
|
||||
|
||||
void ScriptParser::generateCodeBlockTreeFromASTWalkerPostProcess(CodeBlock* cb)
|
||||
{
|
||||
for (size_t i = 0; i < cb->m_childBlocks.size(); i++) {
|
||||
generateCodeBlockTreeFromASTWalkerPostProcess(cb->m_childBlocks[i]);
|
||||
}
|
||||
cb->computeVariables();
|
||||
}
|
||||
|
||||
ScriptParser::ScriptParserResult ScriptParser::parse(StringView scriptSource, String* fileName, CodeBlock* parentCodeBlock, bool strictFromOutside)
|
||||
{
|
||||
Script* script = nullptr;
|
||||
|
|
@ -129,6 +133,9 @@ ScriptParser::ScriptParserResult ScriptParser::parse(StringView scriptSource, St
|
|||
} else {
|
||||
topCodeBlock = generateCodeBlockTreeFromAST(m_context, scriptSource, script, program);
|
||||
}
|
||||
|
||||
generateCodeBlockTreeFromASTWalkerPostProcess(topCodeBlock);
|
||||
|
||||
topCodeBlock->m_cachedASTNode = program;
|
||||
script->m_topCodeBlock = topCodeBlock;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue