Transpiled version (4103L) is out of date.
1 | // get/set fieldName (refers to this.fieldName) |
2 | // get/set fieldName(expr) (refers to expr.fieldName) |
3 | svoid tok_transpileGetSet(LS tok) { |
4 | jreplace(tok, "set/get <id>", "get/set $4"); |
5 | |
6 | for (int i : jfindAll_reverse(tok, "get/set <id>")) { |
7 | S field = tok.get(i+6); |
8 | int iOpening = i+8; |
9 | int iClosing; |
10 | if (eq(get(tok, iOpening), "(")) |
11 | iClosing = tok_findEndOfBracketPart(tok, iOpening)-1; |
12 | else |
13 | iClosing = 0; |
14 | S expr = iClosing == 0 ? "this" : tok_join(tok, iOpening+1, iClosing); |
15 | int iEnd = iClosing == 0 ? iOpening-2 : iClosing; |
16 | tokReplace_reTok(tok, i, iEnd+1, |
17 | replaceDollarVars("iSetAndGet($expr, " + |
18 | "(e, v) -> { e.$field = v; }, " + |
19 | "e -> e.$field)", |
20 | +expr, +field)); |
21 | } |
22 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031580 |
Snippet name: | tok_transpileGetSet - "get/set" or "set/get" |
Eternal ID of this version: | #1031580/8 |
Text MD5: | 2b199144108bd36442c6fa1162ea1b9a |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-06-29 17:23:02 |
Source code size: | 780 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 192 / 289 |
Version history: | 7 change(s) |
Referenced in: | [show references] |