mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Unlink circular dependency between runtime and parser source codes
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
parent
4ae794b901
commit
9f93022d78
106 changed files with 1111 additions and 1105 deletions
|
|
@ -19,11 +19,11 @@
|
|||
|
||||
#include "Escargot.h"
|
||||
#include "ScriptParser.h"
|
||||
#include "Script.h"
|
||||
#include "runtime/Context.h"
|
||||
#include "runtime/VMInstance.h"
|
||||
#include "interpreter/ByteCode.h"
|
||||
#include "parser/esprima_cpp/esprima.h"
|
||||
#include "parser/ScriptParser.h"
|
||||
#include "parser/ast/AST.h"
|
||||
#include "parser/CodeBlock.h"
|
||||
#include "runtime/Environment.h"
|
||||
|
|
@ -43,6 +43,21 @@ ScriptParser::ScriptParser(Context* c)
|
|||
{
|
||||
}
|
||||
|
||||
ScriptParser::InitializeScriptResult::InitializeScriptResult()
|
||||
: parseErrorCode(ErrorCode::None)
|
||||
, parseErrorMessage(String::emptyString)
|
||||
{
|
||||
}
|
||||
|
||||
Script* ScriptParser::InitializeScriptResult::scriptThrowsExceptionIfParseError(ExecutionState& state)
|
||||
{
|
||||
if (!script) {
|
||||
ErrorObject::throwBuiltinError(state, parseErrorCode, parseErrorMessage->toUTF8StringData().data());
|
||||
}
|
||||
|
||||
return script.value();
|
||||
}
|
||||
|
||||
InterpretedCodeBlock* ScriptParser::generateCodeBlockTreeFromASTWalker(Context* ctx, StringView source, Script* script, ASTScopeContext* scopeCtx, InterpretedCodeBlock* parentCodeBlock, bool isEvalCode, bool isEvalCodeInFunction)
|
||||
{
|
||||
InterpretedCodeBlock* codeBlock;
|
||||
|
|
@ -256,7 +271,7 @@ void ScriptParser::generateCodeBlockTreeFromASTWalkerPostProcess(InterpretedCode
|
|||
cb->computeVariables();
|
||||
if (cb->m_identifierOnStackCount > VARIABLE_LIMIT || cb->m_identifierOnHeapCount > VARIABLE_LIMIT || cb->m_lexicalBlockStackAllocatedIdentifierMaximumDepth > VARIABLE_LIMIT) {
|
||||
auto err = new esprima::Error(new ASCIIString("variable limit exceeded"));
|
||||
err->errorCode = ErrorObject::SyntaxError;
|
||||
err->errorCode = ErrorCode::SyntaxError;
|
||||
err->lineNumber = cb->m_functionStart.line;
|
||||
err->column = cb->m_functionStart.column;
|
||||
err->index = cb->m_functionStart.index;
|
||||
|
|
@ -458,7 +473,7 @@ void ScriptParser::generateFunctionByteCode(ExecutionState& state, InterpretedCo
|
|||
|
||||
auto str = orgError->message->toUTF8StringData();
|
||||
delete orgError;
|
||||
ErrorObject::throwBuiltinError(state, ErrorObject::SyntaxError, str.data());
|
||||
ErrorObject::throwBuiltinError(state, ErrorCode::SyntaxError, str.data());
|
||||
RELEASE_ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue