Ideally, we want to support both "foo".substr and ("foo" : Dynamic).substr. There are several options for the first one, but the second one is a bit harder.
An idea would be to collect all these methods at compile-time and create a map from the accessed field to the implementation field. Something along the lines of:
The dynamic lookup can then (either eagerly or on failure) index into that map with the type and field name, and rewrite the field accordingly.
This could be done explicitly through some @:jvm.reroute("StringExt", "substr") metadata on the field, or we do it implicitly for all extern fields that have expressions.
Ideally, we want to support both
"foo".substr
and("foo" : Dynamic).substr
. There are several options for the first one, but the second one is a bit harder.An idea would be to collect all these methods at compile-time and create a map from the accessed field to the implementation field. Something along the lines of:
The dynamic lookup can then (either eagerly or on failure) index into that map with the type and field name, and rewrite the field accordingly.
This could be done explicitly through some
@:jvm.reroute("StringExt", "substr")
metadata on the field, or we do it implicitly for allextern
fields that have expressions.