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 4278 : Signature FileVisitor::MakeSignature(const CallableNodeSignature* signature) {
14 4278 : LabelDeclarationVector definition_vector;
15 5429 : for (const auto& label : signature->labels) {
16 2302 : LabelDeclaration def = {label.name, GetTypeVector(label.types)};
17 1151 : definition_vector.push_back(def);
18 : }
19 4278 : base::Optional<std::string> arguments_variable;
20 4278 : if (signature->parameters.has_varargs)
21 77 : arguments_variable = signature->parameters.arguments_variable;
22 : Signature result{signature->parameters.names,
23 : arguments_variable,
24 : {GetTypeVector(signature->parameters.types),
25 4278 : signature->parameters.has_varargs},
26 4278 : signature->parameters.implicit_count,
27 4278 : Declarations::GetType(signature->return_type),
28 29946 : definition_vector};
29 4278 : return result;
30 : }
31 :
32 : } // namespace torque
33 : } // namespace internal
34 59456 : } // namespace v8
|