Download Jar. Uses 3874K of libraries. Click here for Pure Java version (7977L/55K).
1 | !7 |
2 | |
3 | p-experiment { |
4 | makeSFSynonym("setTextAndSelectAll", "setTextSelectAll"); |
5 | } |
6 | |
7 | svoid makeSFSynonym(S oldName, S newName) { |
8 | S snippetID = stdFunctions_cached().get(oldName); |
9 | if (snippetID == null) |
10 | fail("Standard function " + oldName + " not found"); |
11 | L<S> tok = javaTok(loadSnippet |
12 | (snippetID)); |
13 | LL<S> funcs = findFullFunctionDefs(tok, true); |
14 | new L<S> out; |
15 | for (L<S> tokF : funcs) { |
16 | int i = indexOfAny(tokF, 0, "(", "{"); |
17 | if (i < 0) continue; |
18 | S fname = get(tok, i-2); |
19 | if (!eq(fname, oldName)) continue; |
20 | L<S> args = tok_parseArgsList(tokF); |
21 | jreplace(tokF, oldName, newName); |
22 | L<S> start = subList(tok, 0, i); |
23 | bool isVoid = contains(start, "void"); |
24 | out.add(join(start) + "(" + joinWithComma(trimAll(map tok_dropFinal(args))) + ") {\n" |
25 | + " " + (isVoid ? "" : "ret ") + oldName + "(" + joinWithComma(map tok_lastIdentifier(args)) + ");\n" |
26 | + "}"); |
27 | } |
28 | print(); |
29 | printIndent(joinWithEmptyLines(out)); |
30 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1015567 |
Snippet name: | Make synonym of function Spike [OK, see makeSFSynonym] |
Eternal ID of this version: | #1015567/12 |
Text MD5: | 05279b802c03a41a449c2418c057d6d0 |
Transpilation MD5: | 4d35fc8d098d8d9b6bc7cff554770df5 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-17 22:53:20 |
Source code size: | 993 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 468 / 1262 |
Version history: | 11 change(s) |
Referenced in: | [show references] |