Fix finding has_catch in Global Code block. Modify binding methods of Global enviroment.

This commit is contained in:
Junyoung Cho 2016-12-22 13:36:58 +09:00
commit 4964d66df8
6 changed files with 43 additions and 8 deletions

View file

@ -18,7 +18,11 @@ CodeBlock* ScriptParser::generateCodeBlockTreeFromASTWalker(Context* ctx, String
CodeBlock* codeBlock;
if (parentCodeBlock == nullptr) {
// globalBlock
codeBlock = new CodeBlock(ctx, script, source, scopeCtx->m_isStrict, scopeCtx->m_locStart, scopeCtx->m_names);
codeBlock = new CodeBlock(ctx, script, source, scopeCtx->m_isStrict, scopeCtx->m_locStart, scopeCtx->m_names,
(CodeBlock::CodeBlockInitFlag)((scopeCtx->m_hasEval ? CodeBlock::CodeBlockHasEval : 0)
| (scopeCtx->m_hasWith ? CodeBlock::CodeBlockHasWith : 0)
| (scopeCtx->m_hasCatch ? CodeBlock::CodeBlockHasCatch : 0)
| (scopeCtx->m_hasYield ? CodeBlock::CodeBlockHasYield : 0)));
} else {
codeBlock = new CodeBlock(ctx, script, StringView(source, scopeCtx->m_locStart.index, scopeCtx->m_locEnd.index),
scopeCtx->m_locStart,