Transpiled version (10739L) is out of date.
1 | scope loadLibraryOrSrcLib. |
2 | |
3 | sbool #srcLibsEnabled = true; |
4 | |
5 | // to avoid checking src libs too often when booting OS |
6 | static ThreadLocal<Map<Long, File>> #tempCache = new ThreadLocal; |
7 | static new ThreadLocal<IF1<S, File>> loadLibraryOrSrcLib_compiler; |
8 | |
9 | static File loadLibraryOrSrcLib(S snippetID, IF1<S, File> compiler default loadLibraryOrSrcLib_compiler!) ctex {
|
10 | vmBus_send loadLibraryOrSrcLib(snippetID); |
11 | long id = parseSnippetID(snippetID); |
12 | |
13 | if (#tempCache! != null) {
|
14 | File f = #tempCache->get(id); |
15 | if (f != null) |
16 | ret f with print(snippetID + " from tempCache: " + f); |
17 | } |
18 | |
19 | bool srcLib = #srcLibsEnabled && isMarkedAsSrcLib(snippetID); |
20 | if (srcLib) {
|
21 | print(snippetID + " marked as src lib, compiling"); |
22 | File f; |
23 | if (compiler != null) |
24 | f = compiler.get(snippetID); |
25 | else |
26 | f = pairA(hotwire_compile(snippetID)); |
27 | print("Src lib: " + f);
|
28 | mapPut(#tempCache!, id, f); |
29 | ret f; |
30 | } |
31 | |
32 | File f = DiskSnippetCache_getLibrary(id); |
33 | if (fileSize(f) != 0) ret f/* with print(snippetID + " from disk cache: " + f)*/; |
34 | try {
|
35 | print("Trying " + snippetID + " as binary library");
|
36 | ret loadDataSnippetToFile(snippetID); |
37 | } catch e {
|
38 | if (#srcLibsEnabled) {
|
39 | print("Trying " + snippetID + " as src lib");
|
40 | if (nempty(loadSnippet(snippetID))) {
|
41 | print("Is src lib.");
|
42 | markAsSrcLib(snippetID); |
43 | ret pairA(hotwire_compile(snippetID)); |
44 | } |
45 | } |
46 | throw rethrow(e); |
47 | } |
48 | } |
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1020726 |
| Snippet name: | loadLibraryOrSrcLib |
| Eternal ID of this version: | #1020726/20 |
| Text MD5: | 6e4d21062ed79d2e0f26484c8136802a |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-03-29 18:47:38 |
| Source code size: | 1512 bytes / 48 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 701 / 935 |
| Version history: | 19 change(s) |
| Referenced in: | [show references] |