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).

1  
// optionally convert expression to return statement
2  
static S tok_addReturn(L<S> tok) {
3  
  if (tok_shouldAddReturn(tok)) {
4  
    tokPrepend(tok, 1, "return ");
5  
    tokAppend(tok, l(tok)-2, ";");
6  
  }
7  
  ret join(tok);
8  
}
9  
10  
static S tok_addReturn(S s) {
11  
  ret tok_addReturn(javaTok(s));
12  
}

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: 740 / 1336
Version history: 5 change(s)
Referenced in: [show references]