HaxeFoundation / HaxeFoundation/haxe
Accessing argument metadata from tclass_field
Nobody has claimed this yet.
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
Currently there doesn't seem to be a way to access argument metadata on an extern function.
extern class Foo {
extern function bar(@:cpp.Marshal(c_string) s:String):Void;
}
In the above case there is no way to access the @:cpp.Marshal metadata from a tclass_field. In non extern functions you can inspect the cf_expr TFunction but for externs there is no expression.
I think I've found the place in typeloadFields which types functions but I'm not sure what a good approach is, append the arguments meta to cf_meta and key it by argument name somehow? Add a new cf_argument_meta field?
End goal of this to to have the compiler generate glue code for converting to and from common haxe and c++ types by annotating arguments, it would greatly simplify things being able to look at all extern classes up front as opposed to accumulating a list of all found functions while iterating over the ast.
Contributor guide
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 in typeloadFields, where extern functions are typed, and inspect how tclass_field stores cf_meta, cf_expr, and TFunction data for non-extern functions. Compare the available representations and define a way for argument metadata such as @:cpp.Marshal to remain accessible from extern fields; done means compiler code can inspect that metadata while processing extern classes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100