function_definition.cpp 572 B

1234567891011121314151617181920
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #include "executable_semantics/ast/function_definition.h"
  5. namespace Carbon {
  6. void FunctionDefinition::PrintDepth(int depth, llvm::raw_ostream& out) const {
  7. out << "fn " << name << " " << *param_pattern << " -> " << *return_type;
  8. if (body) {
  9. out << " {\n";
  10. body->PrintDepth(depth, out);
  11. out << "\n}\n";
  12. } else {
  13. out << ";\n";
  14. }
  15. }
  16. } // namespace Carbon