Commit 87bb556c
87bb556ca4b0Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
Add ivar/global/const write nodes to tail-statement no-value list
InstanceVariableOperatorWriteNode (and other write node types) were missing from emit_stmt_tail_inner's list of "no usable tail value" statements. When such a node appeared as the last statement in a method body, the compiler tried to emit it as a value expression, which hit the unsupported() fallback in emit_expr.
Adds InstanceVariableWriteNode, InstanceVariableOperatorWriteNode, InstanceVariableOrWriteNode, InstanceVariableAndWriteNode, GlobalVariableWriteNode, ConstantWriteNode, LocalVariableOrWriteNode, and LocalVariableAndWriteNode to the non-tail-value list so they are emitted as plain statements at tail position (the method's trailing default return covers the return value).
Fixes 12 previously-ERR tests including module_ivar_op_write, poly_local_is_a_string_narrow, recursive_block_forward_value, etc.
Co-Authored-By: Claude Sonnet 4.6 [email protected]
Details
- Commit
- 87bb556ca4b0
- Parent
- 86aadadc63a8
src/codegen.cmodifiedView file
the trailing default return covers the method's value. */ if (!strcmp(ty, "LocalVariableWriteNode") || !strcmp(ty, "LocalVariableOperatorWriteNode") || !strcmp(ty, "LocalVariableOrWriteNode") || !strcmp(ty, "LocalVariableAndWriteNode") || !strcmp(ty, "InstanceVariableWriteNode") || !strcmp(ty, "InstanceVariableOperatorWriteNode") || !strcmp(ty, "InstanceVariableOrWriteNode") || !strcmp(ty, "InstanceVariableAndWriteNode") || !strcmp(ty, "GlobalVariableWriteNode") || !strcmp(ty, "ConstantWriteNode") || !strcmp(ty, "WhileNode") || !strcmp(ty, "UntilNode") || (!strcmp(ty, "CallNode") && nt_ref(nt, id, "receiver") < 0 && emit_output_call(c, id, b, indent))) {