Commit 3558fadb
3558fadb6de1Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · +2 added · ~1 modified
Description
Merge pull request #953 from ryanseys/rs-interp-array-container
feat(codegen): string interpolation renders array containers, not pointers
Details
- Commit
- 3558fadb6de1
- Parent
- 1f51cab5ae21
- Merge parent
- 89aeabded473
spinel_codegen.rbmodifiedView file
@@ -14685,6 +14685,41 @@
1468514685
# a long long.1468614686
fmt = fmt + "%s"1468714687
arg_exprs.push("sp_exc_message(" + compile_expr(inner) + ")")14688+
elsif it == "nil"14689+
# CRuby: `"#{nil}"` -> `""`. Without an arm,14690+
# the default int path emitted `"0"`.14691+
fmt = fmt + "%s"14692+
arg_exprs.push("\"\"")14693+
elsif it == "int_array"14694+
fmt = fmt + "%s"14695+
arg_exprs.push("sp_IntArray_inspect(" + compile_expr(inner) + ")")14696+
elsif it == "float_array"14697+
fmt = fmt + "%s"14698+
arg_exprs.push("sp_FloatArray_inspect(" + compile_expr(inner) + ")")14699+
elsif it == "str_array"14700+
fmt = fmt + "%s"14701+
arg_exprs.push("sp_StrArray_inspect(" + compile_expr(inner) + ")")14702+
elsif it == "sym_array"14703+
# sym_array stores ids in an sp_IntArray14704+
# backing; sp_SymArray_inspect renders each14705+
# element as `:name` via sp_sym_to_s.14706+
fmt = fmt + "%s"14707+
arg_exprs.push("sp_SymArray_inspect(" + compile_expr(inner) + ")")14708+
elsif it == "poly_array"14709+
fmt = fmt + "%s"14710+
arg_exprs.push("sp_PolyArray_inspect(" + compile_expr(inner) + ")")14711+
elsif it == "int_array_ptr_array"14712+
fmt = fmt + "%s"14713+
arg_exprs.push("sp_IntArrayPtrArray_inspect(" + compile_expr(inner) + ")")14714+
elsif it == "float_array_ptr_array"14715+
fmt = fmt + "%s"14716+
arg_exprs.push("sp_FloatArrayPtrArray_inspect(" + compile_expr(inner) + ")")14717+
elsif it == "str_array_ptr_array"14718+
fmt = fmt + "%s"14719+
arg_exprs.push("sp_StrArrayPtrArray_inspect(" + compile_expr(inner) + ")")14720+
elsif it == "sym_array_ptr_array"14721+
fmt = fmt + "%s"14722+
arg_exprs.push("sp_SymArrayPtrArray_inspect(" + compile_expr(inner) + ")")1468814723
else1468914724
fmt = fmt + "%lld"1469014725
arg_exprs.push("(long long)" + compile_expr(inner))test/interp_array_container.rbaddedView file
Loading diff…
test/interp_array_container.rb.expectedaddedView file
Loading diff…