Libraryless. Click here for Pure Java version (7636L/46K).
// e.g.: // sclass Bla extends Stages & Var<S> { svoid tok_andVarMixIn(LS tok) { for (i : jfindAll_reversed_any(tok, "& Var<<id>> {", "& Var<<id><<id>>> {")) { int iOpening = indexOf(tok, i, "{"); S valueType = tok_scanTypeArgWithoutBrackets(tok, indexOf(tok, i, "<")); int iClosing = tok_endOfBracketPart(tok, iOpening)-1; // get Var include LS tokVar = javaTok(cacheGet(#1032845)); jreplace(tokVar, "A", valueType); // find code that is to be executed before get() returns a result int iGet = jfind_upTo(tok, iOpening, iClosing, "get :: before {"); if (iGet >= 0) { int iOpening2 = indexOf(tok, iGet, "{"); int iClosing2 = tok_endOfBracketPart(tok, iOpening2)-1; S code = joinSubList(tok, iOpening2+1, iClosing2); jreplace1(tokVar, "get() {", "get() {" + code); clearTokens_reTok(tok, iGet, iClosing2+1); } tokReplace_reTok(tok, iOpening+1, "\n" + join(tokVar) + "\n"); tokReplace_reTok(tok, i, i+3, "implements IVar"); } }
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1032846 |
Snippet name: | tok_andVarMixIn |
Eternal ID of this version: | #1032846/20 |
Text MD5: | 52835a56d52f33676253f8293b6b96d9 |
Transpilation MD5: | 791e16d302ba65617714121e4ed9a144 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-06 22:01:30 |
Source code size: | 1073 bytes / 31 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 211 / 365 |
Version history: | 19 change(s) |
Referenced in: | [show references] |