mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-29 10:02:14 +00:00
Implement missing part of GlobalDeclarationInstantiation and EvalDeclarationInstantiation
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
3916dad5fc
commit
a9a41ff5f0
4 changed files with 64 additions and 37 deletions
|
|
@ -198,10 +198,15 @@ Value ByteCodeInterpreter::interpret(ExecutionState* state, ByteCodeBlock* byteC
|
|||
isCacheWork = true;
|
||||
} else if (slot->m_cachedStructure == nullptr) {
|
||||
isCacheWork = true;
|
||||
if (UNLIKELY(ctx->globalDeclarativeStorage()->at(idx).isEmpty())) {
|
||||
ErrorObject::throwBuiltinError(*state, ErrorObject::ReferenceError, ctx->globalDeclarativeRecord()->at(idx).m_name.string(), false, String::emptyString, ErrorObject::Messages::IsNotInitialized);
|
||||
const auto& record = ctx->globalDeclarativeRecord()->at(idx);
|
||||
auto& storage = ctx->globalDeclarativeStorage()->at(idx);
|
||||
if (UNLIKELY(storage.isEmpty())) {
|
||||
ErrorObject::throwBuiltinError(*state, ErrorObject::ReferenceError, record.m_name.string(), false, String::emptyString, ErrorObject::Messages::IsNotInitialized);
|
||||
}
|
||||
ctx->globalDeclarativeStorage()->at(idx) = registerFile[code->m_registerIndex];
|
||||
if (UNLIKELY(!record.m_isMutable)) {
|
||||
ErrorObject::throwBuiltinError(*state, ErrorObject::TypeError, record.m_name.string(), false, String::emptyString, ErrorObject::Messages::AssignmentToConstantVariable);
|
||||
}
|
||||
storage = registerFile[code->m_registerIndex];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2097,6 +2102,9 @@ NEVER_INLINE void ByteCodeInterpreter::setGlobalVariableSlowCase(ExecutionState&
|
|||
if (UNLIKELY(place.isEmpty())) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::ReferenceError, name.string(), false, String::emptyString, ErrorObject::Messages::IsNotInitialized);
|
||||
}
|
||||
if (UNLIKELY(!records[i].m_isMutable)) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, ErrorObject::Messages::AssignmentToConstantVariable, name);
|
||||
}
|
||||
place = value;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue