Transpiled version (6046L) is out of date.
1 | // Currently it matters whether you put modifiers like |
2 | // "public" left or right of the "simplyCached". |
3 | svoid test_tok_simplyCachedFunctions() { |
4 | testTranspilationFunction tok_simplyCachedFunctions( |
5 | "transient simplyCached S x() { null; }", |
6 | [[ transient S x_cache; |
7 | S x() { if (x_cache == null) x_cache = x_load(); ret x_cache; } |
8 | S x_load() { null; } ]], |
9 | |
10 | "simplyCached final S x() { null; }", |
11 | [[ S x_cache; |
12 | final S x() { if (x_cache == null) x_cache = x_load(); ret x_cache; } |
13 | final S x_load() { null; } ]], |
14 | |
15 | "simplyCached void x() { y(); }", |
16 | [[ bool ran_x; |
17 | void x() { if (ran_x) ret; set ran_x; x_impl(); } |
18 | void x_impl() { y(); } ]], |
19 | |
20 | // abstract load method |
21 | "simplyCached abstract S x();", |
22 | [[ S x_cache; |
23 | S x() { if (x_cache == null) x_cache = x_load(); ret x_cache; } |
24 | abstract S x_load(); ]], |
25 | |
26 | // public |
27 | "simplyCached public S x() { null; }", |
28 | [[ public S x_cache; |
29 | public S x() { if (x_cache == null) x_cache = x_load(); ret x_cache; } |
30 | public S x_load() { null; } ]], |
31 | |
32 | // primitive return type |
33 | "simplyCached int x() { null; }", |
34 | [[ Int x_cache; |
35 | int x() { if (x_cache == null) x_cache = x_load(); ret x_cache; } |
36 | int x_load() { null; } ]], |
37 | |
38 | ); |
39 | } |
Began life as a copy of #1020989
download show line numbers debug dex old transpilations
Travelled to 5 computer(s): bhatertpkbcr, ekrmjmnbrukm, elmgxqgtpvxh, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034327 |
Snippet name: | test_tok_simplyCachedFunctions |
Eternal ID of this version: | #1034327/20 |
Text MD5: | 9b6825c0384ee2ac63dec58fe1f2f78e |
Author: | stefan |
Category: | javax / transpiling |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-08-05 16:48:59 |
Source code size: | 1361 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 234 / 363 |
Version history: | 19 change(s) |
Referenced in: | [show references] |