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

11
LINES

< > BotCompany Repo | #1030764 // tok_ifNullAssign

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (3620L) is out of date.

svoid tok_ifNullAssign(LS tok) {
  for (int i : jfindAll_reversed(tok, "return <id> if null =")) {
    S var = tok.get(i+2);
    int iEnd = findEndOfStatement(tok, i);
    tok.set(iEnd-1, "; return \*var*/; }");
    replaceTokens(tok, i, i+5*2-1,
      "{ if (\*var*/ == null) \*var*/ =");
  }
  
  jreplace(tok, "<id> if null =", "if ($1 == null) $1 =");
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030764
Snippet name: tok_ifNullAssign
Eternal ID of this version: #1030764/6
Text MD5: f8e4ec9ebdb98df0d99e9813a47f6095
Author: stefan
Category: javax / transpilation
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-19 15:29:48
Source code size: 369 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 161 / 258
Version history: 5 change(s)
Referenced in: [show references]