mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Implement additional ECMAScript Features for Web Browsers
* Implement VariableStatement in catch rules * Implement Function Declation rules Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
a656f7e4dd
commit
5a284d486b
6 changed files with 75 additions and 98 deletions
|
|
@ -532,8 +532,7 @@ Value Script::execute(ExecutionState& state, bool isExecuteOnEvalFunction, bool
|
|||
InterpretedCodeBlock* child = m_topCodeBlock->firstChild();
|
||||
while (child) {
|
||||
if (child->isFunctionDeclaration()) {
|
||||
if (!state.context()->globalObject()->defineOwnProperty(state, child->functionName(),
|
||||
ObjectPropertyDescriptor(Value(), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectStructurePropertyDescriptor::EnumerablePresent)))) {
|
||||
if (child->lexicalBlockIndexFunctionLocatedIn() == 0 && !state.context()->globalObject()->defineOwnProperty(state, child->functionName(), ObjectPropertyDescriptor(Value(), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectStructurePropertyDescriptor::EnumerablePresent)))) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::Code::SyntaxError, "Identifier '%s' has already been declared", child->functionName());
|
||||
}
|
||||
}
|
||||
|
|
@ -597,6 +596,14 @@ Value Script::executeLocal(ExecutionState& state, Value thisValue, InterpretedCo
|
|||
break;
|
||||
}
|
||||
|
||||
// https://www.ecma-international.org/ecma-262/10.0/#sec-variablestatements-in-catch-blocks
|
||||
if (e->record()->isDeclarativeEnvironmentRecord() && e->record()->asDeclarativeEnvironmentRecord()->isDeclarativeEnvironmentRecordNotIndexed()) {
|
||||
if (e->record()->asDeclarativeEnvironmentRecord()->asDeclarativeEnvironmentRecordNotIndexed()->isCatchClause()) {
|
||||
e = e->outerEnvironment();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < vecLen; i++) {
|
||||
if (vec[i].m_isVarDeclaration) {
|
||||
auto slot = e->record()->hasBinding(state, vec[i].m_name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue