Commit 5de924a3

5de924a369e4Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 2 files · ~2 modified

Description

feat: add send/&:symbol/require rewrite to C parser

spinel_parse.c now performs the same source-level rewrites as spinel_parse.rb: send(:symbol), &:symbol, and plain require.

Also fix c_type/type_is_pointer to avoid recursive calls that break return type inference during bootstrap.

Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]

Details

Commit
5de924a369e4
Parent
bc6da2583b7b

spinel_codegen.rbmodifiedView file

@@ -2012,7 +2012,7 @@
20122012
20132013 def type_is_pointer(t)
20142014 if is_nullable_type(t) == 1
2015- return type_is_pointer(base_type(t))
2015+ t = base_type(t)
20162016 end
20172017 if t == "int_array"
20182018 return 1
@@ -2095,7 +2095,7 @@
20952095 # ---- C type mapping ----
20962096 def c_type(t)
20972097 if is_nullable_type(t) == 1
2098- return c_type(base_type(t))
2098+ t = base_type(t)
20992099 end
21002100 if t == "range"
21012101 return "sp_Range"
@@ -2166,6 +2166,7 @@
21662166 if is_nullable_type(t) == 1
21672167 return "NULL"
21682168 end
2169+ # NOTE: nullable returns above, so rest handles base types only
21692170 if t == "range"
21702171 return "((sp_Range){0,0})"
21712172 end