Skip to content

Surface coroutine statement API on CoroutineBodyStmt/CoreturnStmt#811

Merged
tannergooding merged 1 commit into
dotnet:mainfrom
tannergooding:tannergooding-v22-coroutine-stmts
Jul 17, 2026
Merged

Surface coroutine statement API on CoroutineBodyStmt/CoreturnStmt#811
tannergooding merged 1 commit into
dotnet:mainfrom
tannergooding:tannergooding-v22-coroutine-stmts

Conversation

@tannergooding

Copy link
Copy Markdown
Member

Surfaces the coroutine statement API now reachable through the v22 raw-interop regen. The CoroutineBodyStmt and CoreturnStmt managed classes were empty validation shells; this wires them up over the mid-layer CXCursor coroutine accessors (also added here) so the high-level layer mirrors the clang C++ AST.

  • CoroutineBodyStmt: Body, PromiseDecl, InitSuspendStmt, FinalSuspendStmt, ExceptionHandler, FallthroughHandler, Allocate, Deallocate, ResultDecl, ReturnValueInit, ReturnValue, ReturnStmt, ReturnStmtOnAllocFailure, and HasDependentPromiseType.
  • CoreturnStmt: Operand, PromiseCall, IsImplicit.

CoroutineSuspendExpr/CoawaitExpr/CoyieldExpr are intentionally left unsurfaced -- there are no dedicated native bridges for their common/ready/suspend/resume sub-expressions, so a clean surface would need new native shims (a separate follow-up).

Sub-statement children are cached via ValueLazy, matching the existing single-cursor accessors. Test: added CoroutineBodyStmtTest to StmtTest (minimal C++20 coroutine shim) covering the body/promise/suspend surface and the nested co_return. Build 0 warnings; interop suite green (84 pass).

Note

Authored with Copilot.

Wires the coroutine-body and co_return cursor bridges through the mid-layer CXCursor accessors and fills the previously-empty CoroutineBodyStmt/CoreturnStmt shells with the promise/suspend/allocate/return sub-statement surface, matching the clang C++ AST.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@tannergooding
tannergooding force-pushed the tannergooding-v22-coroutine-stmts branch from 07bf7cd to da00cd7 Compare July 17, 2026 04:22
@tannergooding
tannergooding merged commit 1fc56b6 into dotnet:main Jul 17, 2026
12 checks passed
@tannergooding
tannergooding deleted the tannergooding-v22-coroutine-stmts branch July 17, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant