Skip to content

Language: Generator::send() and Iterator API on VM (#167) - #3831

Merged
PurHur merged 2 commits into
masterfrom
agent/issue-167-generator-send
May 30, 2026
Merged

Language: Generator::send() and Iterator API on VM (#167)#3831
PurHur merged 2 commits into
masterfrom
agent/issue-167-generator-send

Conversation

@PurHur

@PurHur PurHur commented May 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implements VM Generator::{send,rewind,current,key,valid,next} and injects send() values into the yield-expression result slot (Compiler + VM::resumeGenerator).
  • Adds compliance test generator_send.phpt (rewind → current → send → getReturn).
  • Fixes LintCompiler::compileClassBody signature regression from sealed classes (Language: sealed classes — parse + VM inheritance guard (#3322) #3335) that broke MINIWEBAPP_LINT_ZERO_GATE.

php-src reference

  • Zend/zend_generators.czim_Generator_send, generator resume / yield value receive

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/compliance/VMTest.php --filter generator'
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php script/check-miniwebapp-lint-zero.php'

Part of umbrella #167 (VM send/Iterator surface). JIT/AOT generators remain in #3074 / #3115 — do not close #167 until those land.

Wire yield expression result slots from the compiler, inject send values
on resume, and register Generator::{send,rewind,current,key,valid,next}.
Fix LintCompiler::compileClassBody signature after sealed-class (#3335).

php-src: Zend/zend_generators.c (zim_Generator_send, generator resume).
Co-authored-by: Cursor <cursoragent@cursor.com>
Register Generator::throw(), dispatch exceptions into generator try/catch
with generatorState preserved on catch frames, and propagate uncaught
throws to the caller via executeInternalHandler (Zend zend_generators.c).

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 5363192 into master May 30, 2026
@PurHur
PurHur deleted the agent/issue-167-generator-send branch May 30, 2026 15:23
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.

Language: Generators (yield and yield from)

1 participant