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

36
LINES

< > BotCompany Repo | #1019998 // transpileLocalSnippet [dev.]

JavaX fragment (include)

1  
svoid transpileLocalSnippet(S progID) {
2  
  transpileLocalSnippet(progID, "quick");
3  
}
4  
5  
svoid transpileLocalSnippet(S progID, S mode) {
6  
  if (neq(mode, 'quick)) refreshTranspiler();
7  
  S javax = loadLocalSnippet(progID);
8  
9  
  time "Transpile" {
10  
    transpileRaw_silent = false;
11  
    S java;
12  
    try {
13  
      java = transpileRaw(javax);
14  
    } catch e {
15  
      // (line 980,col 1)
16  
      int line = parseIntOpt(jextract("(line <int>,", str(e)));
17  
      if (line != 0) {
18  
        L<S> lines = lines(loadProgramTextFile("error.java"));
19  
        for (int i = line-1; i <= line+1; i++)
20  
          print("[line " + i + "] " + get(lines, i-1));
21  
      }
22  
      throw rethrow(e);
23  
    }
24  
    print("Transpiled to " + l(java) + " chars");
25  
  }
26  
27  
  new L<S> libs;
28  
  java = findTranslators2(java, libs);
29  
  print("Libs: " + or2(joinWithComma(libs), "-"));
30  
31  
  S dehlibs = join(" ", libs);
32  
  saveTranspiledCode(progID, dehlibs + "\n" + java);
33  
  
34  
  File bytecode = javaCompile_overInternalBot(java, dehlibs);
35  
  print("Bytecode: " + f2s(assertNotNull(bytecode)));
36  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019998
Snippet name: transpileLocalSnippet [dev.]
Eternal ID of this version: #1019998/2
Text MD5: 983cdfa3fa19ed7d73948e1e76ac96df
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-16 20:07:39
Source code size: 1063 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 270 / 319
Version history: 1 change(s)
Referenced in: [show references]