1 | svoid tok_settableFields(LS tok) { |
2 | int i = -1; |
3 | while ((i = jfind(tok, i+1, "settable <id>")) >= 0) { |
4 | int iEndOfLModifiers = i; |
5 | int iLModifiers = tok_leftScanModifiers(tok, iEndOfLModifiers); |
6 | int iRModifiers = i+2; |
7 | int iEndOfRModifiers = tok_scanModifiers_idx(tok, iRModifiers); |
8 | int iType = iEndOfRModifiers; |
9 | int iEndOfType = tok_endOfType(tok, iEndOfRModifiers); |
10 | S type = joinSubList_cToC(tok, iType, iEndOfType); |
11 | S var = identifierOrQuestionMark(get(tok, iEndOfType); |
12 | LS modifiers = identifiersOnly(joinLists( |
13 | subList(tok, iLModifiers, iEndOfLModifiers), |
14 | subList(tok, iRModifiers, iEndOfRModifiers))); |
15 | LS functionModifiers = listMinus(modifiers, "volatile", "transient"); |
16 | printVars(+i, +iRModifiers, +iEndOfRModifiers, +iType, +iEndOfType, +type, +var); |
17 | tokReplace_reTok(tok, iLModifiers, i+2, tok_formatDollarVars( |
18 | joinWithSpace(functionModifiers) |
19 | + "public selfType $var aka $setVar($type $var) { this.$var = $var; this; } gettable ", |
20 | +type, +var, setVar := "set" + firstToUpper(var))); |
21 | } |
22 | |
23 | tok_gettableFields(tok); |
24 | } |
Began life as a copy of #1033078
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033795 |
Snippet name: | tok_settableFields backup |
Eternal ID of this version: | #1033795/1 |
Text MD5: | 9445c7861b1975c00272a9ce02b1ea68 |
Author: | stefan |
Category: | javax / transpiling |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-05 02:53:16 |
Source code size: | 1132 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 124 / 147 |
Referenced in: | [show references] |