function_definition.h 904 B

12345678910111213141516171819202122232425262728
  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. #ifndef EXECUTABLE_SEMANTICS_AST_FUNCTION_DEFINITION_H_
  5. #define EXECUTABLE_SEMANTICS_AST_FUNCTION_DEFINITION_H_
  6. #include "executable_semantics/ast/expression.h"
  7. #include "executable_semantics/ast/statement.h"
  8. namespace Carbon {
  9. struct FunctionDefinition {
  10. int line_num;
  11. std::string name;
  12. Expression param_pattern;
  13. Expression return_type;
  14. const Statement* body;
  15. };
  16. auto MakeFunDef(int line_num, std::string name, Expression ret_type,
  17. Expression param, const Statement* body) -> FunctionDefinition;
  18. void PrintFunDef(const FunctionDefinition&);
  19. void PrintFunDefDepth(const FunctionDefinition&, int);
  20. } // namespace Carbon
  21. #endif // EXECUTABLE_SEMANTICS_AST_FUNCTION_DEFINITION_H_