Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1017958 - tok_addFieldOrder

JavaX fragment (include)

static void tok_addFieldOrder(L<S> tok, int i) {
  int idx = findCodeTokens(tok, i, false, "{");
  if (idx < 0) ret;
  int j = findEndOfBracketPart(tok, idx);
  L<S> vars = allVarNames(subList(tok, idx+1, j-1));
  //print("addFieldOrder " + struct(vars));
  if (nempty(vars) && !vars.contains("_fieldOrder")
    && !isSortedList(vars)) {
    print("Adding field order");
    tok.set(idx+2, "static final String _fieldOrder = " + quote(join(" ", vars)) + ";\n  " + tok.get(idx+2));
    // reTok has to be done by caller
  }
}

download  show line numbers  debug dex   

Travelled to 11 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1017958
Snippet name: tok_addFieldOrder
Eternal ID of this version: #1017958/5
Text MD5: e90a3591e42e51ae4ebd72dbb702d95c
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-29 00:44:05
Source code size: 536 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 205 / 199
Version history: 4 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1017958 & http://1017958.tinybrain.de