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

10
LINES

< > BotCompany Repo | #1024937 - tok_questionDot

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

Libraryless. Click here for Pure Java version (2838L/18K).

svoid tok_questionDot(LS tok) {
  jreplace_dyn(tok, "<id> ?.",
    func(L<S> tok, int i) -> S {
      S var = tok.get(i);
      bool isExpression = eqGetOneOf(tok, i-2, "ret", "return"); // just  one case so far
      ret isExpression
        ? "\*var*/ == null ? null : \*var*/."
        : "if (\*var*/ != null) \*var*/.";
    });
}

download  show line numbers  debug dex   

Travelled to 3 computer(s): mqqgnosmbjvj, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1024937
Snippet name: tok_questionDot
Eternal ID of this version: #1024937/4
Text MD5: 0640a84d5282173e4f4ecea2177a014b
Transpilation MD5: 4f1e2423f803822a7a759853ed74a779
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-02 14:26:17
Source code size: 342 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 45 / 66
Version history: 3 change(s)
Referenced in: [show references]

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