Open roaminro opened 1 year ago
Very interesting! I didn't know AssemblyScript had this feature. So, it seems a good improvement for the precompiler. Right now I can not work on it because of the amount of changes required. But it's definitely something worth to check and implement.
The AssemblyScript compiler allows for passing a
transform
script as a parameter to theasc
cli (see https://www.assemblyscript.org/compiler.html#transforms). Thistransform
scripts allows you to access the "parsed" AS files to do "whatever" you want. I used this option in the very first version of the AS SDK to allow for describingentry points
directly in the A code usingdecorators
(see https://github.com/koinos/koinos-sdk-as/blob/3eabc0453a7650a6a973664c5286f6212c8479e6/tools/koinos-contract-transform.ts), for example:I believe it would be a less
hacky
way to parse the AS code and generate the ABIs than usingcomments
.Also,
decorators
can take arguments too, so you could have@entry_point(...args)
What do you think?