Transpiled version (5799L) is out of date.
1 | svoid tok_cachedFunctions_new(LS tok) { pcall { |
2 | int i = -1; |
3 | while ((i = jfind(tok, i+1, "cached <id>")) >= 0) { |
4 | Cl<S> modifiers = tok_modifiersLeftOf(tok, i); |
5 | int iMod = tok_leftScanModifiers(tok, i); |
6 | int bracket = indexOf(tok, "(", i); |
7 | S fName = assertIdentifier(tok.get(bracket-2)); |
8 | int iMod2 = tok_rightScanModifiers(tok, i+2); |
9 | printVars tok_cachedFunctions_new(+modifiers); |
10 | modifiers.addAll(codeTokensFromSubList(tok, i+2, iMod2)); |
11 | S type = joinSubList(tok, iMod2, bracket-3); |
12 | S boxedType = tok_toNonPrimitiveTypes(type); |
13 | S mods = joinWithSpace(listMinus(modifiers, "final")); |
14 | S mods2 = joinWithSpace(listMinus(modifiers, "transient")); |
15 | printVars tok_cachedFunctions_new(+mods, +mods2); |
16 | |
17 | replaceTokens_reTok(tok, iMod, bracket-1, |
18 | "\*mods*/ Cache<\*boxedType*/> \*fName*/_cache = new Cache<>(lambda0 \*fName*/_load);\n" |
19 | + "\*mods2*/ \*type*/ \*fName*/() { ret \*fName*/_cache!; }\n\n" |
20 | + "\*mods2*/ \*boxedType*/ \*fName*/_load"); |
21 | } |
22 | }} |
Began life as a copy of #1020989
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034364 |
Snippet name: | tok_cachedFunctions_new |
Eternal ID of this version: | #1034364/4 |
Text MD5: | d7d8568256bba26d426885cbc3a7d3db |
Author: | stefan |
Category: | javax / transpiling |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-02-03 08:06:25 |
Source code size: | 1038 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 145 / 211 |
Version history: | 3 change(s) |
Referenced in: | [show references] |