1/*
2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
3 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
4 * Copyright (C) 2003, 2007 Apple Inc. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef Completion_h
24#define Completion_h
25
26#include "CallData.h"
27#include "JSCJSValue.h"
28#include <wtf/NakedPtr.h>
29
30namespace JSC {
31
32class Exception;
33class ExecState;
34class JSScope;
35class ParserError;
36class SourceCode;
37class VM;
38class JSInternalPromise;
39
40JS_EXPORT_PRIVATE bool checkSyntax(VM&, const SourceCode&, ParserError&);
41JS_EXPORT_PRIVATE bool checkSyntax(ExecState*, const SourceCode&, JSValue* exception = 0);
42JS_EXPORT_PRIVATE bool checkModuleSyntax(ExecState*, const SourceCode&, ParserError&);
43
44JS_EXPORT_PRIVATE JSValue evaluate(ExecState*, const SourceCode&, JSValue thisValue, NakedPtr<Exception>& returnedException);
45inline JSValue evaluate(ExecState* exec, const SourceCode& sourceCode, JSValue thisValue = JSValue())
46{
47 NakedPtr<Exception> unused;
48 return evaluate(exec, sourceCode, thisValue, unused);
49}
50
51JS_EXPORT_PRIVATE JSValue profiledEvaluate(ExecState*, ProfilingReason, const SourceCode&, JSValue thisValue, NakedPtr<Exception>& returnedException);
52inline JSValue profiledEvaluate(ExecState* exec, ProfilingReason reason, const SourceCode& sourceCode, JSValue thisValue = JSValue())
53{
54 NakedPtr<Exception> unused;
55 return profiledEvaluate(exec, reason, sourceCode, thisValue, unused);
56}
57
58// Load the module source and evaluate it.
59JS_EXPORT_PRIVATE JSInternalPromise* loadAndEvaluateModule(ExecState*, const String& moduleName);
60JS_EXPORT_PRIVATE JSInternalPromise* loadAndEvaluateModule(ExecState*, const SourceCode&);
61
62// Fetch the module source, and instantiate the module record.
63JS_EXPORT_PRIVATE JSInternalPromise* loadModule(ExecState*, const String& moduleName);
64JS_EXPORT_PRIVATE JSInternalPromise* loadModule(ExecState*, const SourceCode&);
65
66// Link and evaluate the already linked module.
67JS_EXPORT_PRIVATE JSInternalPromise* linkAndEvaluateModule(ExecState*, const Identifier& moduleKey);
68
69} // namespace JSC
70
71#endif // Completion_h
72