Fix errors (#467)

* Fix BDWGC compile option
* Fix build error on ndk
* Global declared function declaration should always create binding

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
Patrick Kim 2019-10-17 18:28:00 +09:00 committed by Hyukwoo Park
commit 355c7eff53
11 changed files with 41 additions and 25 deletions

View file

@ -486,6 +486,17 @@ Value Script::execute(ExecutionState& state, bool isExecuteOnEvalFunction, bool
}
if (!isExecuteOnEvalFunction) {
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)))) {
ErrorObject::throwBuiltinError(state, ErrorObject::Code::SyntaxError, "Identifier '%s' has already been declared", child->functionName());
}
}
child = child->nextSibling();
}
const auto& globalLexicalVector = m_topCodeBlock->blockInfo(0)->m_identifiers;
size_t len = globalLexicalVector.size();
for (size_t i = 0; i < len; i++) {