diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/parser/ParserError.h | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/parser/ParserError.h')
-rw-r--r-- | Source/JavaScriptCore/parser/ParserError.h | 62 |
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 |