mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-25 12:30:10 +01:00
26 lines
667 B
C++
26 lines
667 B
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#include "executable_semantics/ast/function_definition.h"
|
|
|
|
#include <iostream>
|
|
|
|
namespace Carbon {
|
|
|
|
void FunctionDefinition::PrintDepth(int depth) const {
|
|
std::cout << "fn " << name << " ";
|
|
PrintExp(param_pattern);
|
|
std::cout << " -> ";
|
|
PrintExp(return_type);
|
|
if (body) {
|
|
std::cout << " {" << std::endl;
|
|
PrintStatement(body, depth);
|
|
std::cout << std::endl << "}" << std::endl;
|
|
} else {
|
|
std::cout << ";" << std::endl;
|
|
}
|
|
}
|
|
|
|
} // namespace Carbon
|