mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
4cf75fb035
fixed a bug where tab completion on complex expressions like "d.new(1).a" would corrupt local variables, causing them to become nil. the root cause was that evaluating complex receiver expressions during tab completion ran mrb_vm_run() without proper stack management (stack_keep) and environment adjustment that mirb's main REPL loop performs. this corrupted the local variable storage. the fix restricts tab completion to only evaluate simple receiver expressions (variable/constant names without operators or method calls). complex expressions are skipped for completion. this means: - works: d.<tab> completes methods of variable d - works: String.<tab> completes methods of constant String - skipped: d.new(1).<tab> provides no completion this is a reasonable trade-off that prevents the corruption bug while still supporting the most common completion scenarios. also updated mirb_eval_receiver() to use the compiler context for proper local variable resolution, with argument order matching mrb_parse_string. Co-authored-by: Claude <noreply@anthropic.com>