14e19819
codegen: bracket-quote Lua-keyword field names
The plugin emitted bare-identifier field names in three positions:
the `M.<Type>_fields` table key, the inline encoder's `v = t.<name>`
load, and the inline decoder's `result.<name> = ...` store. When a
proto field name collided with a Lua reserved word the generated
`*_pb.lua` failed to load with `'(' expected near '<keyword>'`.
The real-world hit is pprof's profile.proto, which declares
`repeated Function function = 5` — that breaks all three emit sites.
Route every user-named identifier through new luaTableKey /
luaFieldAccess helpers that bracket-quote reserved words. Covers
field_names + oneof descriptors, oneof presence pre-pass, inline
encode/decode field bodies (including repeated and map paths), and
optional has/clear accessors.
Eugene Blikh <bigbes@gmail.com> — 2026-05-17 04:21:30 UTC
Commit 14e1981920edc18d473b8ae1034c31ee8d4e72a1 —
view raw patch
Parent(s):
00b93fd5
| File | Status | + | − |
|---|---|---|---|
cmd/protoc-gen-tarantool/internal/gen/gen.go
|
M | +6 | -5 |
cmd/protoc-gen-tarantool/internal/gen/inline.go
|
M | +17 | -13 |
cmd/protoc-gen-tarantool/internal/gen/name.go
|
M | +51 | |
test/codegen_lua_keywords_test.lua
|
A | +151 |