summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/parser/ParserError.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/parser/ParserError.h')
-rw-r--r--Source/JavaScriptCore/parser/ParserError.h62
1 files changed, 24 insertions, 38 deletions
diff --git a/Source/JavaScriptCore/parser/ParserError.h b/Source/JavaScriptCore/parser/ParserError.h
index 89a05ab42..baa4465d0 100644
--- a/Source/JavaScriptCore/parser/ParserError.h
+++ b/Source/JavaScriptCore/parser/ParserError.h
@@ -27,15 +27,13 @@
#define ParserError_h
#include "Error.h"
-#include "ErrorHandlingScope.h"
#include "ExceptionHelpers.h"
#include "ParserTokens.h"
#include <wtf/text/WTFString.h>
namespace JSC {
-class ParserError {
-public:
+struct ParserError {
enum SyntaxErrorType {
SyntaxErrorNone,
SyntaxErrorIrrecoverable,
@@ -51,72 +49,60 @@ public:
SyntaxError
};
+ ErrorType m_type;
+ SyntaxErrorType m_syntaxErrorType;
+ JSToken m_token;
+ String m_message;
+ int m_line;
ParserError()
: m_type(ErrorNone)
, m_syntaxErrorType(SyntaxErrorNone)
+ , m_line(-1)
{
}
explicit ParserError(ErrorType type)
: m_type(type)
, m_syntaxErrorType(SyntaxErrorNone)
+ , m_line(-1)
{
}
ParserError(ErrorType type, SyntaxErrorType syntaxError, JSToken token)
- : m_token(token)
- , m_type(type)
+ : m_type(type)
, m_syntaxErrorType(syntaxError)
+ , m_token(token)
+ , m_line(-1)
{
}
- ParserError(ErrorType type, SyntaxErrorType syntaxError, JSToken token, const String& msg, int line)
- : m_token(token)
+ ParserError(ErrorType type, SyntaxErrorType syntaxError, JSToken token, String msg, int line)
+ : m_type(type)
+ , m_syntaxErrorType(syntaxError)
+ , m_token(token)
, m_message(msg)
, m_line(line)
- , m_type(type)
- , m_syntaxErrorType(syntaxError)
{
}
- bool isValid() const { return m_type != ErrorNone; }
- SyntaxErrorType syntaxErrorType() const { return m_syntaxErrorType; }
- const JSToken& token() const { return m_token; }
- const String& message() const { return m_message; }
- int line() const { return m_line; }
-
- JSObject* toErrorObject(
- JSGlobalObject* globalObject, const SourceCode& source,
- int overrideLineNumber = -1)
+ JSObject* toErrorObject(JSGlobalObject* globalObject, const SourceCode& source)
{
- ExecState* exec = globalObject->globalExec();
switch (m_type) {
case ErrorNone:
- return nullptr;
+ return 0;
case SyntaxError:
- return addErrorInfo(
- exec,
- createSyntaxError(exec, m_message),
- overrideLineNumber == -1 ? m_line : overrideLineNumber, source);
+ return addErrorInfo(globalObject->globalExec(), createSyntaxError(globalObject, m_message), m_line, source);
case EvalError:
- return createSyntaxError(exec, m_message);
- case StackOverflow: {
- ErrorHandlingScope errorScope(globalObject->vm());
- return createStackOverflowError(exec);
- }
+ return createSyntaxError(globalObject, m_message);
+ case StackOverflow:
+ return createStackOverflowError(globalObject);
case OutOfMemory:
- return createOutOfMemoryError(exec);
+ return createOutOfMemoryError(globalObject);
}
CRASH();
- return nullptr;
+ return createOutOfMemoryError(globalObject); // Appease Qt bot
}
-
-private:
- JSToken m_token;
- String m_message;
- int m_line { -1 };
- ErrorType m_type;
- SyntaxErrorType m_syntaxErrorType;
+#undef GET_ERROR_CODE
};
} // namespace JSC