Line data Source code
1 : // Copyright 2017 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 : #include "src/torque/file-visitor.h"
6 :
7 : #include "src/torque/declarable.h"
8 :
9 : namespace v8 {
10 : namespace internal {
11 : namespace torque {
12 :
13 3074 : Signature FileVisitor::MakeSignature(const CallableNodeSignature* signature) {
14 : LabelDeclarationVector definition_vector;
15 6770 : for (const auto& label : signature->labels) {
16 622 : LabelDeclaration def = {label.name, GetTypeVector(label.types)};
17 622 : definition_vector.push_back(def);
18 622 : }
19 3074 : base::Optional<std::string> arguments_variable;
20 3074 : if (signature->parameters.has_varargs)
21 43 : arguments_variable = signature->parameters.arguments_variable;
22 : Signature result{signature->parameters.names,
23 : arguments_variable,
24 : {GetTypeVector(signature->parameters.types),
25 : signature->parameters.has_varargs},
26 : signature->parameters.implicit_count,
27 : Declarations::GetType(signature->return_type),
28 12296 : definition_vector};
29 3074 : return result;
30 : }
31 :
32 : } // namespace torque
33 : } // namespace internal
34 9078 : } // namespace v8
|