Libraryless. Click here for Pure Java version (3828L/22K).
1 | // optional S bla; |
2 | // => S bla() { ret getOpt(this, "bla"); } |
3 | // void bla(S bla) { setOpt(this, "bla", bla); } |
4 | svoid tok_optionalFields(LS tok) { |
5 | for (int i : jfindAll_reverse(tok, "optional <id>")) { |
6 | int iSemicolon = tok_endOfStatement(tok, i)-1; |
7 | S var = tok.get(iSemicolon-2); |
8 | S type = joinSubList(tok, i+2, iSemicolon-3); |
9 | tokReplace_reTok(tok, i, iSemicolon+1, |
10 | "public \*type*/ \*var*/() { ret (\*type*/ getOpt(this, \*quote(var)*/); }\n" + |
11 | "public void var(\*type*/ var) { setOpt(this, \*quote(var)*/, \*var*/); }"); |
12 | } |
13 | } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1031988 |
Snippet name: | tok_optionalFields |
Eternal ID of this version: | #1031988/5 |
Text MD5: | 3fd9ccbcf405c8c54d9ebf5028b545f4 |
Transpilation MD5: | dae22e46d78f048fd61b8d7f01231bc9 |
Author: | stefan |
Category: | javax / image reconstruction [dev.] |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-08-06 07:38:51 |
Source code size: | 571 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 218 / 298 |
Version history: | 4 change(s) |
Referenced in: | [show references] |