function_definition.h 937 B

1234567891011121314151617181920212223242526272829
  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. const Expression* param_pattern;
  13. const Expression* return_type;
  14. const Statement* body;
  15. };
  16. auto MakeFunDef(int line_num, std::string name, const Expression* ret_type,
  17. const Expression* param, const Statement* body)
  18. -> FunctionDefinition*;
  19. void PrintFunDef(const FunctionDefinition*);
  20. void PrintFunDefDepth(const FunctionDefinition*, int);
  21. } // namespace Carbon
  22. #endif // EXECUTABLE_SEMANTICS_AST_FUNCTION_DEFINITION_H_