Implement the lexical scoping (#285)

This patch introduces the let and const keyword and all the related lexical scoping rules.

Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik 2019-07-05 06:38:11 +02:00 committed by Hyukwoo Park
commit ef59096112
32 changed files with 1026 additions and 94 deletions

View file

@ -107,7 +107,9 @@ Value Script::executeLocal(ExecutionState& state, Value thisValue, InterpretedCo
recordToAddVariable = e->record();
}
for (size_t i = 0; i < len; i++) {
recordToAddVariable->createBinding(state, vec[i].m_name, inStrict ? false : true, true);
if (vec[i].m_isVarDeclaration) {
recordToAddVariable->createBinding(state, vec[i].m_name, inStrict ? false : true, true);
}
}
LexicalEnvironment* newEnvironment = new LexicalEnvironment(record, state.lexicalEnvironment());