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/runtime/ErrorInstance.h | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/runtime/ErrorInstance.h')
-rw-r--r-- | Source/JavaScriptCore/runtime/ErrorInstance.h | 67 |
1 files changed, 27 insertions, 40 deletions
diff --git a/Source/JavaScriptCore/runtime/ErrorInstance.h b/Source/JavaScriptCore/runtime/ErrorInstance.h index 3f584a99f..91dd7ef0a 100644 --- a/Source/JavaScriptCore/runtime/ErrorInstance.h +++ b/Source/JavaScriptCore/runtime/ErrorInstance.h @@ -22,58 +22,45 @@ #define ErrorInstance_h #include "Interpreter.h" -#include "RuntimeType.h" +#include "JSObject.h" #include "SourceProvider.h" -#include <wtf/Vector.h> namespace JSC { -class ErrorInstance : public JSNonFinalObject { -public: - typedef JSNonFinalObject Base; + class ErrorInstance : public JSNonFinalObject { + public: + typedef JSNonFinalObject Base; - enum SourceTextWhereErrorOccurred { FoundExactSource, FoundApproximateSource }; - typedef String (*SourceAppender) (const String& originalMessage, const String& sourceText, RuntimeType, SourceTextWhereErrorOccurred); + DECLARE_INFO; - DECLARE_INFO; + static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) + { + return Structure::create(vm, globalObject, prototype, TypeInfo(ErrorInstanceType, StructureFlags), info()); + } - static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) - { - return Structure::create(vm, globalObject, prototype, TypeInfo(ErrorInstanceType, StructureFlags), info()); - } + static ErrorInstance* create(VM& vm, Structure* structure, const String& message, Vector<StackFrame> stackTrace = Vector<StackFrame>()) + { + ErrorInstance* instance = new (NotNull, allocateCell<ErrorInstance>(vm.heap)) ErrorInstance(vm, structure); + instance->finishCreation(vm, message, stackTrace); + return instance; + } - static ErrorInstance* create(ExecState* exec, VM& vm, Structure* structure, const String& message, SourceAppender appender = nullptr, RuntimeType type = TypeNothing, bool useCurrentFrame = true) - { - ErrorInstance* instance = new (NotNull, allocateCell<ErrorInstance>(vm.heap)) ErrorInstance(vm, structure); - instance->m_sourceAppender = appender; - instance->m_runtimeTypeForCause = type; - instance->finishCreation(exec, vm, message, useCurrentFrame); - return instance; - } + static ErrorInstance* create(ExecState* exec, Structure* structure, JSValue message, Vector<StackFrame> stackTrace = Vector<StackFrame>()) + { + return create(exec->vm(), structure, message.isUndefined() ? String() : message.toString(exec)->value(exec), stackTrace); + } - static ErrorInstance* create(ExecState* exec, Structure* structure, JSValue message, SourceAppender appender = nullptr, RuntimeType type = TypeNothing, bool useCurrentFrame = true) - { - return create(exec, exec->vm(), structure, message.isUndefined() ? String() : message.toString(exec)->value(exec), appender, type, useCurrentFrame); - } + bool appendSourceToMessage() { return m_appendSourceToMessage; } + void setAppendSourceToMessage() { m_appendSourceToMessage = true; } + void clearAppendSourceToMessage() { m_appendSourceToMessage = false; } - static void addErrorInfo(ExecState*, VM&, JSObject*, bool = true); + protected: + explicit ErrorInstance(VM&, Structure*); - bool hasSourceAppender() const { return !!m_sourceAppender; } - SourceAppender sourceAppender() const { return m_sourceAppender; } - void setSourceAppender(SourceAppender appender) { m_sourceAppender = appender; } - void clearSourceAppender() { m_sourceAppender = nullptr; } - void setRuntimeTypeForCause(RuntimeType type) { m_runtimeTypeForCause = type; } - RuntimeType runtimeTypeForCause() const { return m_runtimeTypeForCause; } - void clearRuntimeTypeForCause() { m_runtimeTypeForCause = TypeNothing; } + void finishCreation(VM&, const String&, Vector<StackFrame> = Vector<StackFrame>()); -protected: - explicit ErrorInstance(VM&, Structure*); - - void finishCreation(ExecState*, VM&, const String&, bool useCurrentFrame = true); - - SourceAppender m_sourceAppender { nullptr }; - RuntimeType m_runtimeTypeForCause { TypeNothing }; -}; + bool m_appendSourceToMessage; + }; } // namespace JSC |