1. not every binding is mutable in strict mode

- add m_isExplicitlyDeclaredOrParameterName into name info in ASTScopeContext
  - add m_isMutable into IdentifierRecord struct
  - add ThrowStaticExcpetion opcode in indexed-mode
  - add throw exception code in storeByName operation
2. when evaluate delete operation on member variable, must evaluate toString operation once for name even if exception throws
3. in strict mode, Decimals with leading zero literals are not allowed

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
seonghyun kim 2017-03-22 22:33:22 +09:00
commit 35ceec9680
17 changed files with 172 additions and 105 deletions

View file

@ -129,9 +129,11 @@ Value Script::executeLocal(ExecutionState& state, Value thisValue, CodeBlock* pa
delete programNode;
EnvironmentRecord* record;
bool inStrict = false;
if (UNLIKELY(needNewRecord)) {
// NOTE: ES5 10.4.2.1 eval in strict mode
record = new DeclarativeEnvironmentRecordNotIndexed(state, m_topCodeBlock->identifierInfos());
inStrict = true;
record = new DeclarativeEnvironmentRecordNotIndexed();
} else {
record = state.executionContext()->lexicalEnvironment()->record();
}
@ -140,12 +142,12 @@ Value Script::executeLocal(ExecutionState& state, Value thisValue, CodeBlock* pa
size_t len = vec.size();
EnvironmentRecord* recordToAddVariable = record;
LexicalEnvironment* e = state.executionContext()->lexicalEnvironment();
while (recordToAddVariable->isObjectEnvironmentRecord()) {
while (!recordToAddVariable->isEvalTarget()) {
e = e->outerEnvironment();
recordToAddVariable = e->record();
}
for (size_t i = 0; i < len; i++) {
recordToAddVariable->createMutableBinding(state, vec[i].m_name, true);
recordToAddVariable->createBinding(state, vec[i].m_name, inStrict ? false : true, true);
}
LexicalEnvironment* newEnvironment = new LexicalEnvironment(record, state.executionContext()->lexicalEnvironment());