]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/Completion.h
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / runtime / Completion.h
index 63b315e18f639dd84f5ebca8a5dea077f432e320..089911e0fd78eb5d1f98a0e23a3eef19a533ad7d 100644 (file)
 #ifndef Completion_h
 #define Completion_h
 
-#include "JSValue.h"
+#include "JSCJSValue.h"
+#include <wtf/NakedPtr.h>
 
 namespace JSC {
 
-    class ExecState;
-    class ScopeChain;
-    class SourceCode;
-
-    enum ComplType { Normal, Break, Continue, ReturnValue, Throw, Interrupted, Terminated };
-
-    /*
-     * Completion objects are used to convey the return status and value
-     * from functions.
-     */
-    class Completion {
-    public:
-        Completion(ComplType type = Normal, JSValue value = JSValue())
-            : m_type(type)
-            , m_value(value)
-        {
-        }
-
-        ComplType complType() const { return m_type; }
-        JSValue value() const { return m_value; }
-        void setValue(JSValue v) { m_value = v; }
-        bool isValueCompletion() const { return m_value; }
-
-    private:
-        ComplType m_type;
-        JSValue m_value;
-    };
-
-    Completion checkSyntax(ExecState*, const SourceCode&);
-    Completion evaluate(ExecState*, ScopeChain&, const SourceCode&, JSValue thisValue = JSValue());
+class Exception;
+class ExecState;
+class JSScope;
+class ParserError;
+class SourceCode;
+class VM;
+
+JS_EXPORT_PRIVATE bool checkSyntax(VM&, const SourceCode&, ParserError&);
+JS_EXPORT_PRIVATE bool checkSyntax(ExecState*, const SourceCode&, JSValue* exception = 0);
+JS_EXPORT_PRIVATE JSValue evaluate(ExecState*, const SourceCode&, JSValue thisValue, NakedPtr<Exception>& returnedException);
+inline JSValue evaluate(ExecState* exec, const SourceCode& sourceCode, JSValue thisValue = JSValue())
+{
+    NakedPtr<Exception> unused;
+    return evaluate(exec, sourceCode, thisValue, unused);
+}
 
 } // namespace JSC