implement declare var, Function Decl, Function Expression

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
seonghyun kim 2016-11-30 19:01:37 +09:00
commit a545adebf5
28 changed files with 549 additions and 90 deletions

View file

@ -5,6 +5,9 @@
#include "interpreter/ByteCodeInterpreter.h"
#include "parser/ast/Node.h"
#include "runtime/Context.h"
#include "runtime/Environment.h"
#include "runtime/EnvironmentRecord.h"
namespace Escargot {
@ -18,7 +21,10 @@ Script::ScriptExecuteResult Script::execute(Context* ctx)
ByteCodeGenerator g;
g.generateByteCode(ctx, m_topCodeBlock, programNode);
ExecutionContext ec(ctx, ctx->globalEnvironment());
ExecutionState stateForInit(ctx);
LexicalEnvironment* globalEnvironment = new LexicalEnvironment(new GlobalEnvironmentRecord(stateForInit, m_topCodeBlock, ctx->globalObject()), nullptr);
ExecutionContext ec(ctx, globalEnvironment);
Value resultValue;
ExecutionState state(ctx, &ec, &resultValue);
ByteCodeIntrepreter::interpret(state, m_topCodeBlock);