Open Aidan63 opened 1 week ago
Extern functions have been quite annoying in this regard. An adjacent problem is argument default values, which are also part of the expression and required a workaround for externs.
I'd be happy to redesign this, but I'm not sure how. The cleanest approach would probably be to merge cf_kind
and cf_expr
, but that would cause a rather large amount of friction and I don't know if this is worth it for the potential gains.
I don't think something like cf_argument_meta
would be that great because then we have redundant information for non-externs.
ah, right, I remember coming across the @:value
meta for abstract functions with default values, that would be another benefit of any change.
My initial thought was to just re-use or do something very similar to that, but that does just feel like piling on the bodges.
Currently there doesn't seem to be a way to access argument metadata on an extern function.
In the above case there is no way to access the
@:cpp.Marshal
metadata from atclass_field
. In non extern functions you can inspect thecf_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.