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

12
LINES

< > BotCompany Repo | #1003852 // tok_addReturn - convert expression to return statement; if it's statements already, leave it alone

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

Libraryless. Click here for Pure Java version (4821L/27K).

// optionally convert expression to return statement
static S tok_addReturn(L<S> tok) {
  if (tok_shouldAddReturn(tok)) {
    tokPrepend(tok, 1, "return ");
    tokAppend(tok, l(tok)-2, ";");
  }
  ret join(tok);
}

static S tok_addReturn(S s) {
  ret tok_addReturn(javaTok(s));
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1003852
Snippet name: tok_addReturn - convert expression to return statement; if it's statements already, leave it alone
Eternal ID of this version: #1003852/6
Text MD5: 9652a3207e53cba7eaf0bb62c1c83da9
Transpilation MD5: 8237a76c57488b6795e679c86774d0b2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-20 00:31:45
Source code size: 291 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 738 / 1332
Version history: 5 change(s)
Referenced in: [show references]