#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