## Problem `compileParam()` in `lib/Compiler.php` asserts: ```php assert(null === $param->defaultBlock); ``` Most real PHP functions use defaults: `function greet(string $name = 'Guest')`. ## Goal Support default values for function parameters in VM and JIT. ## Tasks - [ ] Compile `defaultBlock` expressions when parameter omitted at call site - [ ] `TYPE_ARG_RECV` path: if missing arg, evaluate default block - [ ] JIT: emit branch or init from constant defaults where possible - [ ] PHPT: optional args, skipped middle params (after **#168** named args) - [ ] Interaction with `strict_types` (**#156**) ## Acceptance criteria ```php function f($a = 1, $b = 2) { return $a + $b; } echo f(), f(10), f(10, 20); // 3, 12, 30 ``` ## Dependencies - **#55** non-void returns in JIT - **#168** named arguments (later) ## Files - `lib/Compiler.php`, `lib/VM.php`, `lib/JIT.php`
Problem
compileParam()inlib/Compiler.phpasserts:Most real PHP functions use defaults:
function greet(string $name = 'Guest').Goal
Support default values for function parameters in VM and JIT.
Tasks
defaultBlockexpressions when parameter omitted at call siteTYPE_ARG_RECVpath: if missing arg, evaluate default blockstrict_types(Language: declare(strict_types=1) enforcement in VM #156)Acceptance criteria
Dependencies
Files
lib/Compiler.php,lib/VM.php,lib/JIT.php