Transpiled version (6972L) is out of date.
1 | svoid test_tok_defaultArguments() { |
2 | forEachLL(s -> print(applyTranspilationFunction tok_defaultArguments(s)), |
3 | "public default void replaceValue(A oldValue, A newValue) {}", |
4 | "static <A> ReturnType method(S arg1, S arg2 default blubb, S arg3) {}", |
5 | "static S method(X a default new X(), S arg2) {}", |
6 | "static S method(L<X> a default new L) {}", |
7 | [[ifdef NoNanoHTTPD static virtual NanoHTTPD.Response serve404(S msg default "Not found") {]], |
8 | ); |
9 | |
10 | testTranspilationFunction tok_defaultArguments( |
11 | "sS hjs(S script, O... _ default (O[]) null) {}", |
12 | "sS hjs(S script) { return hjs(script, (O[]) null); }\n" + |
13 | "sS hjs(S script, O... _) {}", |
14 | |
15 | // combine with aka |
16 | "S a aka b(D e, F g default h) { ret i; }", |
17 | "S a aka b(D e) { return a(e, h); }\n" + |
18 | "S a aka b(D e, F g) { ret i; }", |
19 | |
20 | "S nuLike a aka b(D e, F g default h) { ret i; }", |
21 | "S nuLike a aka b(D e) { return a(e, h); }\n" + |
22 | "S nuLike a aka b(D e, F g) { ret i; }", |
23 | |
24 | // default methods |
25 | "default S bla(int i default 5) { ret str(i); }", |
26 | "default S bla() { return bla(5); }\n" + |
27 | "default S bla(int i) { ret str(i); }", |
28 | |
29 | // abstract methods |
30 | "abstract S bla(int i default 5);", |
31 | "S bla() { return bla(5); }\n" + |
32 | "abstract S bla(int i);", |
33 | |
34 | // method in an interface |
35 | "S bla(int i default 5);", |
36 | "default S bla() { return bla(5); }\n" + |
37 | "S bla(int i);", |
38 | |
39 | // star constructor with default argument |
40 | "*(S x, S y default null) { bla; }", |
41 | [[ *(S x) { this(x, null); } |
42 | *(S x, S y) { bla; } ]], |
43 | |
44 | // two default arguments! |
45 | "void a(B b default c, D e default g) { x; }", |
46 | [[ |
47 | void a() { a(c); } |
48 | void a(B b) { a(b, g); } |
49 | void a(D e) { a(c, e); } |
50 | void a(B b, D e) { x; } |
51 | ]], |
52 | ); |
53 | } |
Began life as a copy of #1027998
download show line numbers debug dex old transpilations
Travelled to 9 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1028000 |
Snippet name: | test_tok_defaultArguments |
Eternal ID of this version: | #1028000/28 |
Text MD5: | f7d438b0fec2d5180954e200c6a31e1b |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-10 16:53:10 |
Source code size: | 1908 bytes / 53 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 396 / 677 |
Version history: | 27 change(s) |
Referenced in: | [show references] |