1. fix bug in Object::nextIndex*

2. implement ::generateCodeBlockTreeFromASTWalkerPostProcess

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
seonghyun kim 2017-01-04 15:18:26 +09:00
commit c970d99552
7 changed files with 21 additions and 15 deletions

View file

@ -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;