Line data Source code
1 : // Copyright 2019 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_TORQUE_TORQUE_COMPILER_H_
6 : #define V8_TORQUE_TORQUE_COMPILER_H_
7 :
8 : #include "src/torque/ast.h"
9 : #include "src/torque/contextual.h"
10 : #include "src/torque/server-data.h"
11 : #include "src/torque/source-positions.h"
12 : #include "src/torque/utils.h"
13 :
14 : namespace v8 {
15 : namespace internal {
16 : namespace torque {
17 :
18 15 : struct TorqueCompilerOptions {
19 : std::string output_directory;
20 : bool verbose;
21 : bool collect_language_server_data;
22 : bool abort_on_lint_errors;
23 : };
24 :
25 6 : struct TorqueCompilerResult {
26 : // Map translating SourceIds to filenames. This field is
27 : // set on errors, so the SourcePosition of the error can be
28 : // resolved.
29 : SourceFileMap source_file_map;
30 :
31 : // Eagerly collected data needed for the LanguageServer.
32 : // Set the corresponding options flag to enable.
33 : LanguageServerData language_server_data;
34 :
35 : // If any error occurred during either parsing or compilation,
36 : // this field will be set.
37 : base::Optional<TorqueError> error;
38 : };
39 :
40 : V8_EXPORT_PRIVATE TorqueCompilerResult
41 : CompileTorque(const std::string& source, TorqueCompilerOptions options);
42 : TorqueCompilerResult CompileTorque(std::vector<std::string> files,
43 : TorqueCompilerOptions options);
44 :
45 : } // namespace torque
46 : } // namespace internal
47 : } // namespace v8
48 :
49 : #endif // V8_TORQUE_TORQUE_COMPILER_H_
|