HaxeFoundation / HaxeFoundation/haxe
[flash] Dynamic method closures on standard types is not working
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```haxe
class Main {
static function main() {
var s:Dynamic = "hello";
trace(s[untyped "indexOf"]("hell")); // -1, should be 0
var f:Dynamic = s.indexOf;
trace(f("hell")); // -1, should be 0
f = s[untyped "indexOf"];
trace(f("hell")); // -1, should be 0
trace(f.call(s, "hell")); // works
trace(s.indexOf("hell")); // also works
}
}
```
this is due to dynamic access property opcodes are only specifying public/package namespaces to search, but these methods should actually be queried via `http://adobe.com/AS3/2006/builtin` namespace (like it's done in proper access), so I assume it ends up getting an unbound function from the prototype instead.
i checked what the Adobe's AS3 compiler does on dynamic access and that one generates a huge multiname list, including `http://adobe.com/AS3/2006/builtin`, so i guess we should at least include that one
Contributor guide
Assessment
This issue has not been assessed yet.