forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompileJS.h
More file actions
35 lines (28 loc) · 944 Bytes
/
CompileJS.h
File metadata and controls
35 lines (28 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#ifndef HERMES_COMPILEJS_H
#define HERMES_COMPILEJS_H
#include <string>
namespace hermes {
/// Compiles JS source \p str and if compilation is successful, returns true
/// and outputs to \p bytecode otherwise returns false.
/// \param sourceURL this will be used as the "file name" of the buffer for
/// errors, stack traces, etc.
/// NOTE: Doesn't throw any exceptions. It's up to the caller to report failure.
///
/// TODO(30388684): Return opaque object that can be run or serialized.
bool compileJS(
const std::string &str,
const std::string &sourceURL,
std::string &bytecode,
bool optimize = true);
bool compileJS(
const std::string &str,
std::string &bytecode,
bool optimize = true);
} // namespace hermes
#endif