ProtoDef-io / ProtoDef-io/node-protodef
`anon` compiler regression
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 35
- Forks
- 25
- Avg merge
- 4d 3m
- Merged PRs (30d)
- 2
Description
anon type only works for directly defined containers.
Also it probably should work with other types besides container/bitfield (like ({ a, ...null, b })).
/home/alexander/MEGA/Projects/github:Saiv46/nut-parser/node_modules/.pnpm/protodef@1.15.0/node_modules/protodef/src/datatypes/compiler-structures.js:231
throw new Error('Cannot inline anonymous type: ' + type)
^
Error: Cannot inline anonymous type: closure
at containerInlining (/home/alexander/MEGA/Projects/github:Saiv46/nut-parser/node_modules/.pnpm/protodef@1.15.0/node_modules/protodef/src/datatypes/compiler-structures.js:231:15)
at module.exports.SizeOf.container (/home/alexander/MEGA/Projects/github:Saiv46/nut-parser/node_modules/.pnpm/protodef@1.15.0/node_modules/protodef/src/datatypes/compiler-structures.js:138:16)
at SizeOfCompiler.compileType (/home/alexander/MEGA/Projects/github:Saiv46/nut-parser/node_modules/.pnpm/protodef@1.15.0/node_modules/protodef/src/compiler.js:397:90)
at SizeOfCompiler.generate (/home/alexander/MEGA/Projects/github:Saiv46/nut-parser/node_modules/.pnpm/protodef@1.15.0/node_modules/protodef/src/compiler.js:235:34)
at ProtoDefCompiler.compileProtoDefSync (/home/alexander/MEGA/Projects/github:Saiv46/nut-parser/node_modules/.pnpm/protodef@1.15.0/node_modules/protodef/src/compiler.js:42:44)
at Object.<anonymous> (/home/alexander/MEGA/Projects/github:Saiv46/nut-parser/protodef.js:52:27)
at Module._compile (node:internal/modules/cjs/loader:1434:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1518:10)
at Module.load (node:internal/modules/cjs/loader:1249:32)
at Module._load (node:internal/modules/cjs/loader:1065:12)
Node.js v22.2.0
Protocol definition to reproduce:
{
"types": {
"void": "native",
"container": "native"
},
"sqirrel": {
"types": {
"closure": [
"container",
[
{
"name": "main",
"type": "void"
}
]
],
"script": [
"container",
[
{
"anon": true,
"type": "closure"
}
]
]
}
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the failing protocol definition and the stack-trace entry points in compiler-structures.js, compiler.js, and protodef.js. Reproduce the Cannot inline anonymous type: closure error, then trace how anon handles indirectly defined containers. Done means the reproduced case works and the intended support for other types is clarified or covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100