Commit cc56bd44
cc56bd446ad2Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 2 files · +1 added · ~1 modified
Description
Merge pull request #164 from mame/pr/const-init-block-param-scan
fix(codegen): scan const-init expressions for block-param locals
Details
- Commit
- cc56bd446ad2
- Parent
- 8ec719212393
- Merge parent
- 991d5fe0dc3e
spinel_codegen.rbmodifiedView file
@@ -13557,6 +13557,18 @@
1355713557
end1355813558
end1355913559
}13560+
# Constant initializer expressions get compiled into main() right13561+
# before the user statements run, but the block params they13562+
# introduce (e.g. \`FRAME = [...].map { |n| ... }\`) need13563+
# declarations in the same scope. Scan each const's RHS so the13564+
# block param names land in lnames alongside the user-stmt locals.13565+
ci_lc = 013566+
while ci_lc < @const_expr_ids.length13567+
if @const_expr_ids[ci_lc] >= 013568+
scan_locals(@const_expr_ids[ci_lc], lnames, ltypes, empty_params)13569+
end13570+
ci_lc = ci_lc + 113571+
end1356013572
1356113573
# Declare vars for second pass to resolve dependent types1356213574
j = 0test/const_init_block_param_scan.rbaddedView file
Loading diff…