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

19
LINES

< > BotCompany Repo | #1020928 // tok_overridableFunctionDefs

JavaX fragment (include)

svoid tok_overridableFunctionDefs(LS tok, Set<S> overriableFunctions_out) {
  int i;
  while ((i = jfind(tok, "static overridable <id>")) >= 0) {
    int bracket = indexOf(tok, "(", i);
    int codeStart = indexOf(tok, "{", bracket);
    S fName = assertIdentifier(tok.get(bracket-2));
    S type = joinSubList(tok, i+4, bracket-3);
    S boxedType = tok_toNonPrimitiveTypes(type);
    S args = joinWithComma(map tok_lastIdentifier(tok_parseArgsDeclList(subList(tok, i))));
    S castIt = eq(type, "Object") ? "" : "(\*type*/)";

    replaceTokens(tok, i, bracket-1, "static Object _override_\*fName*/;\n"
      + "static \*type*/ \*fName*/");
    
    tokAppend(tok, codeStart, " if (_override_\*fName*/ != null) return \*castIt*/ callF(_override_\*fName*/, \*args*/);\n");
    reTok(tok, i, codeStart+1);
    addToCollection(overriableFunctions_out, fName);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020928
Snippet name: tok_overridableFunctionDefs
Eternal ID of this version: #1020928/11
Text MD5: 90b073a517e07a52a0ce42da4a73924c
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-10 23:23:59
Source code size: 883 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 372 / 444
Version history: 10 change(s)
Referenced in: [show references]