handle_call_expr.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  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 "toolchain/check/call.h"
  5. #include "toolchain/check/context.h"
  6. #include "toolchain/check/handle.h"
  7. #include "toolchain/check/inst.h"
  8. #include "toolchain/sem_ir/expr_info.h"
  9. #include "toolchain/sem_ir/inst.h"
  10. namespace Carbon::Check {
  11. auto HandleParseNode(Context& context, Parse::CallExprStartId node_id) -> bool {
  12. auto name_id = context.node_stack().PopExpr();
  13. context.node_stack().Push(node_id, name_id);
  14. context.param_and_arg_refs_stack().Push();
  15. return true;
  16. }
  17. auto HandleParseNode(Context& context, Parse::CallExprId node_id) -> bool {
  18. // Process the final explicit call argument now, but leave the arguments
  19. // block on the stack until the end of this function.
  20. context.param_and_arg_refs_stack().EndNoPop(Parse::NodeKind::CallExprStart);
  21. auto callee_id = context.node_stack().Pop<Parse::NodeKind::CallExprStart>();
  22. auto call_id = PerformCall(
  23. context, node_id, callee_id,
  24. context.param_and_arg_refs_stack().PeekCurrentBlockContents());
  25. context.param_and_arg_refs_stack().PopAndDiscard();
  26. context.node_stack().Push(node_id, call_id);
  27. return true;
  28. }
  29. } // namespace Carbon::Check