1 | static LS tok_equalsCast(LS tok) { |
2 | if (!tok.contains("cast")) ret tok; |
3 | int iVar = -1; |
4 | while ((iVar = jfind(tok, iVar+1, "<id> = cast")) >= 0) { |
5 | int iTypeStart = tok_scanTypeBackwards(tok, iVar-2); |
6 | int iCast = iVar+4; |
7 | int j = scanToEndOfInitializer2(tok, iCast); |
8 | S type = joinSubList(tok, iTypeStart, iVar-1); |
9 | clearTokens(tok, iCast, iCast+1); |
10 | if (!tok_typeIsObject(type)) { |
11 | bool needBrackets = j > iCast+4; |
12 | tokPrepend(tok, iCast+2, "(" + type + ") " + (needBrackets ? "(" : "")); |
13 | if (needBrackets) tokPrepend(tok, j+1, ")"); |
14 | } |
15 | reTok(tok, iCast, j+2); |
16 | } |
17 | ret tok; |
18 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1021796 |
Snippet name: | tok_equalsCast |
Eternal ID of this version: | #1021796/20 |
Text MD5: | 7479e2476eb5fb2e08cb288fd878abb8 |
Author: | stefan |
Category: | javax / transpiling |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-29 00:17:40 |
Source code size: | 640 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 369 / 397 |
Version history: | 19 change(s) |
Referenced in: | [show references] |