Transpiled version (4103L) is out of date.
// get/set fieldName (refers to this.fieldName) // get/set fieldName(expr) (refers to expr.fieldName) svoid tok_transpileGetSet(LS tok) { jreplace(tok, "set/get <id>", "get/set $4"); for (int i : jfindAll_reverse(tok, "get/set <id>")) { S field = tok.get(i+6); int iOpening = i+8; int iClosing; if (eq(get(tok, iOpening), "(")) iClosing = tok_findEndOfBracketPart(tok, iOpening)-1; else iClosing = 0; S expr = iClosing == 0 ? "this" : tok_join(tok, iOpening+1, iClosing); int iEnd = iClosing == 0 ? iOpening-2 : iClosing; tokReplace_reTok(tok, i, iEnd+1, replaceDollarVars("iSetAndGet($expr, " + "(e, v) -> { e.$field = v; }, " + "e -> e.$field)", +expr, +field)); } }
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: | 191 / 286 |
Version history: | 7 change(s) |
Referenced in: | [show references] |