file-visitor.cc 1.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "src/torque/file-visitor.h"

#include "src/torque/declarable.h"

namespace v8 {
namespace internal {
namespace torque {

13
Signature FileVisitor::MakeSignature(const CallableNodeSignature* signature) {
14
  LabelDeclarationVector definition_vector;
15
  for (const auto& label : signature->labels) {
16
    LabelDeclaration def = {label.name, GetTypeVector(label.types)};
17 18
    definition_vector.push_back(def);
  }
19 20 21
  base::Optional<std::string> arguments_variable;
  if (signature->parameters.has_varargs)
    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
                   definition_vector};
29 30 31
  return result;
}

32 33 34
}  // namespace torque
}  // namespace internal
}  // namespace v8