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

23
LINES

< > BotCompany Repo | #1009477 - migrateClassesInStructureText

JavaX fragment (include)

static S migrateClassesInStructureText(S s, O... migrations) {
  L<S> tok = javaTok(s);
  for (int i = 0; i < l(migrations); i += 2) {
    S from = cast migrations[i];
    O to = migrations[i+1];
    
    replace(tok, from, to instanceof S ? (S) to : dropPrefix("main$", className((Class) to)));
  }
  ret join(tok);
}

static S migrateClassesInStructureText(S s, Map<S, O> migrations) {
  if (empty(migrations)) ret s;
  L<S> tok = javaTok(s);
  for (int i = 1; i < l(tok); i += 2) {
    S t = tok.get(i);
    if (!isIdentifier(t)) continue;
    O to = migrations.get(t);
    if (to == null) continue;
    tok.set(i, to instanceof S ? (S) to : dropPrefix("main$", className((Class) to)));
  }
  ret join(tok);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009477
Snippet name: migrateClassesInStructureText
Eternal ID of this version: #1009477/6
Text MD5: 9574f3353f7f1fc1bdeee3bd27d65711
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-05 20:21:45
Source code size: 734 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 416 / 417
Version history: 5 change(s)
Referenced in: [show references]

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