mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
When parsing TemplateLiteral in TaggedTemplateExpression, we should not throw SyntaxError.
* Set value as undefined when there is SyntaxError * Fix memory leak related with throwing esprima::Error Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
4fb663ea0e
commit
39e10484d7
9 changed files with 194 additions and 123 deletions
|
|
@ -285,14 +285,15 @@ ScriptParser::InitializeScriptResult ScriptParser::initializeScript(StringView s
|
|||
result.script = script;
|
||||
return result;
|
||||
|
||||
} catch (esprima::Error& orgError) {
|
||||
} catch (esprima::Error* orgError) {
|
||||
// reset ASTAllocator
|
||||
m_context->astAllocator().reset();
|
||||
GC_enable();
|
||||
|
||||
ScriptParser::InitializeScriptResult result;
|
||||
result.parseErrorCode = orgError.errorCode;
|
||||
result.parseErrorMessage = orgError.message;
|
||||
result.parseErrorCode = orgError->errorCode;
|
||||
result.parseErrorMessage = orgError->message;
|
||||
delete orgError;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -311,12 +312,14 @@ void ScriptParser::generateFunctionByteCode(ExecutionState& state, InterpretedCo
|
|||
// Parsing
|
||||
try {
|
||||
functionNode = esprima::parseSingleFunction(m_context, codeBlock, scopeContext, stackSizeRemain);
|
||||
} catch (esprima::Error& orgError) {
|
||||
} catch (esprima::Error* orgError) {
|
||||
// reset ASTAllocator
|
||||
m_context->astAllocator().reset();
|
||||
GC_enable();
|
||||
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::SyntaxError, orgError.message->toUTF8StringData().data());
|
||||
auto str = orgError->message->toUTF8StringData();
|
||||
delete orgError;
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::SyntaxError, str.data());
|
||||
RELEASE_ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue