Libraryless. Click here for Pure Java version (5399L/30K).
1 | sbool preciseCall_debug; |
2 | |
3 | static Object preciseCall(Object o, String method, Object... args) ctex {
|
4 | if (o cast Class) {
|
5 | _MethodCache cache = callOpt_getCache(o); |
6 | L<Method> methods = cache.cache.get(method); |
7 | //L<Method> methods = findMethodsNamed2(o, method, true); |
8 | new Lowest<Method> best; |
9 | if (methods != null) for (Method m : methods) {
|
10 | continue unless isStaticMethod(m); |
11 | int score = methodApplicabilityScore(m, args); |
12 | if (score < Int.MAX_VALUE) {
|
13 | if (preciseCall_debug) |
14 | print("Method score: " + m + " " + score);
|
15 | best.put(m, score); |
16 | } |
17 | } |
18 | Method m = best!; |
19 | if (m != null) |
20 | ret invokeMethod(m, null, args); |
21 | |
22 | ret call_withVarargs(o, method, args); // TODO: make this precise too |
23 | } else |
24 | throw todo(); |
25 | } |
Began life as a copy of #1000630
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1007856 |
| Snippet name: | preciseCall - better method resolution. Could optimize method lookup |
| Eternal ID of this version: | #1007856/14 |
| Text MD5: | da6b29433a7f97355e59344f67181097 |
| Transpilation MD5: | 0f04a732ead3049c7f1568aec5d1a59d |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-03-08 02:12:32 |
| Source code size: | 829 bytes / 25 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 833 / 947 |
| Version history: | 13 change(s) |
| Referenced in: | [show references] |