-
Notifications
You must be signed in to change notification settings - Fork 1
/
class_test.rs
2026 lines (1499 loc) · 44.4 KB
/
class_test.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2023 Silvio Mayolo
//
// This file is part of GDLisp.
//
// GDLisp is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GDLisp is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with GDLisp. If not, see <https://www.gnu.org/licenses/>.
extern crate gdlisp;
use gdlisp::ir::identifier::ClassNamespace;
use gdlisp::ir::modifier::{ParseError as ModifierParseError, ParseErrorF as ModifierParseErrorF};
use gdlisp::compile::args::Expecting;
use gdlisp::compile::error::{GDError, GDErrorF};
use gdlisp::pipeline::error::PError;
use gdlisp::pipeline::source::SourceOffset;
use super::common::*;
#[test]
pub fn empty_class_test() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node)))"), r#"extends Reference
class ClassName extends Node:
func _init():
pass
"#);
}
#[test]
pub fn simple_class_test_1() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defvar x) (defn _init (y)) (defn foo () 2)))"),
r#"extends Reference
class ClassName extends Node:
func _init(y):
pass
var x
func foo():
return 2
"#);
}
#[test]
pub fn simple_class_test_2() {
assert_eq!(parse_compile_decl("((defclass ClassName () (defvar x) (defn _init (y)) (defn foo () 2)))"),
r#"extends Reference
class ClassName extends Reference:
func _init(y):
pass
var x
func foo():
return 2
"#);
}
#[test]
pub fn parent_constructor_class_test_1() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defvar x) (defn _init (y) (super y y)) (defn foo () 2)))"), r#"extends Reference
class ClassName extends Node:
func _init(y).(y, y):
pass
var x
func foo():
return 2
"#);
}
#[test]
pub fn parent_constructor_class_test_2() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defvar x) (defn _init (y) (super (progn y))) (defn foo () 2)))"), r#"extends Reference
class ClassName extends Node:
func _init(y).(y):
pass
var x
func foo():
return 2
"#);
}
#[test]
pub fn parent_constructor_class_test_3() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defvar x) (defn _init (y) (super (if y 1 2))) (defn foo () 2)))"), r#"extends Reference
class _LambdaBlock extends GDLisp.Function:
var y
func _init(y):
self.y = y
self.__gdlisp_required = 0
self.__gdlisp_optional = 0
self.__gdlisp_rest = 0
func call_func():
var _cond = null
if y:
_cond = 1
else:
if true:
_cond = 2
else:
_cond = null
return _cond
func call_funcv(args):
if args == null:
return call_func()
else:
push_error("Too many arguments")
class ClassName extends Node:
func _init(y).(GDLisp.sys_DIV_funcall(_LambdaBlock.new(y), null)):
pass
var x
func foo():
return 2
"#);
}
#[test]
pub fn parent_constructor_class_test_4() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defvar x) (defn _init (@x y) (super (if y 1 2))) (defn foo () 2)))"), r#"extends Reference
class _LambdaBlock extends GDLisp.Function:
var y
func _init(y):
self.y = y
self.__gdlisp_required = 0
self.__gdlisp_optional = 0
self.__gdlisp_rest = 0
func call_func():
var _cond = null
if y:
_cond = 1
else:
if true:
_cond = 2
else:
_cond = null
return _cond
func call_funcv(args):
if args == null:
return call_func()
else:
push_error("Too many arguments")
class ClassName extends Node:
func _init(x_0, y).(GDLisp.sys_DIV_funcall(_LambdaBlock.new(y), null)):
self.x = x_0
var x
func foo():
return 2
"#);
}
#[test]
pub fn parent_constructor_class_test_5() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defvar x-x) (defn _init (@x-x y) (super (if y 1 2))) (defn foo () 2)))"), r#"extends Reference
class _LambdaBlock extends GDLisp.Function:
var y
func _init(y):
self.y = y
self.__gdlisp_required = 0
self.__gdlisp_optional = 0
self.__gdlisp_rest = 0
func call_func():
var _cond = null
if y:
_cond = 1
else:
if true:
_cond = 2
else:
_cond = null
return _cond
func call_funcv(args):
if args == null:
return call_func()
else:
push_error("Too many arguments")
class ClassName extends Node:
func _init(x_x_0, y).(GDLisp.sys_DIV_funcall(_LambdaBlock.new(y), null)):
self.x_x = x_x_0
var x_x
func foo():
return 2
"#);
}
#[test]
pub fn parent_constructor_class_running_test() {
assert_eq!(parse_and_run("((defclass A (Reference) (defvar x) (defn _init (x) (set self:x x))) (defclass B (A) (defn _init (y) (super (if y 1 2)))) (print (B:new #t):x))"), "\n1\n");
}
#[test]
pub fn super_call_in_class_test_1() {
assert_eq!(parse_compile_decl(r#"((defclass Foo () (defn foo () (super:foo))))"#),
r#"extends Reference
class Foo extends Reference:
func _init():
pass
func foo():
return .foo()
"#);
}
#[test]
pub fn super_call_in_class_test_2() {
assert_eq!(parse_compile_decl(r#"((defclass Foo () (defn foo () (super:bar)) (defn bar () (super:foo))))"#),
r#"extends Reference
class Foo extends Reference:
func _init():
pass
func foo():
return .bar()
func bar():
return .foo()
"#);
}
#[test]
pub fn super_call_in_class_test_3() {
assert_eq!(parse_compile_decl(r#"((defclass Foo () main (defn foo () (super:foo)) (defn bar () (super:foo))))"#),
r#"extends Reference
func _init():
pass
func foo():
return .foo()
func bar():
return .foo()
"#);
}
#[test]
pub fn super_call_in_class_test_4() {
assert_eq!(parse_compile_decl(r#"((defclass Foo () (defn _init () (super:foo))))"#),
r#"extends Reference
class Foo extends Reference:
func _init():
.foo()
"#);
}
#[test]
pub fn super_call_in_class_test_5() {
assert_eq!(parse_compile_decl(r#"((defclass Foo () (defn foo-bar () (super:foo-bar))))"#),
r#"extends Reference
class Foo extends Reference:
func _init():
pass
func foo_bar():
return .foo_bar()
"#);
}
#[test]
pub fn super_call_closed_in_class_test_1() {
assert_eq!(parse_compile_decl(r#"((defclass Foo () (defn foo () (lambda () (super:foo)))))"#),
r#"extends Reference
class _LambdaBlock extends GDLisp.Function:
var _self_0
func _init(_self_0):
self._self_0 = _self_0
self.__gdlisp_required = 0
self.__gdlisp_optional = 0
self.__gdlisp_rest = 0
func call_func():
return _self_0.__gdlisp_super_1()
func call_funcv(args):
if args == null:
return call_func()
else:
push_error("Too many arguments")
class Foo extends Reference:
func _init():
pass
func foo():
return _LambdaBlock.new(self)
func __gdlisp_super_1():
return .foo()
"#);
}
#[test]
pub fn super_call_closed_in_class_test_2() {
assert_eq!(parse_compile_decl(r#"((defclass Foo () (defn foo () (lambda () (super:foo) (super:bar)))))"#),
r#"extends Reference
class _LambdaBlock extends GDLisp.Function:
var _self_0
func _init(_self_0):
self._self_0 = _self_0
self.__gdlisp_required = 0
self.__gdlisp_optional = 0
self.__gdlisp_rest = 0
func call_func():
_self_0.__gdlisp_super_1()
return _self_0.__gdlisp_super_2()
func call_funcv(args):
if args == null:
return call_func()
else:
push_error("Too many arguments")
class Foo extends Reference:
func _init():
pass
func foo():
return _LambdaBlock.new(self)
func __gdlisp_super_1():
return .foo()
func __gdlisp_super_2():
return .bar()
"#);
}
#[test]
pub fn super_call_closed_in_class_test_3() {
assert_eq!(parse_compile_decl(r#"((defclass Foo () (defn foo () (lambda () (super:foo-bar) (super:bar-bar)))))"#),
r#"extends Reference
class _LambdaBlock extends GDLisp.Function:
var _self_0
func _init(_self_0):
self._self_0 = _self_0
self.__gdlisp_required = 0
self.__gdlisp_optional = 0
self.__gdlisp_rest = 0
func call_func():
_self_0.__gdlisp_super_1()
return _self_0.__gdlisp_super_2()
func call_funcv(args):
if args == null:
return call_func()
else:
push_error("Too many arguments")
class Foo extends Reference:
func _init():
pass
func foo():
return _LambdaBlock.new(self)
func __gdlisp_super_1():
return .foo_bar()
func __gdlisp_super_2():
return .bar_bar()
"#);
}
#[test]
pub fn member_var_class_test_1() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defvar x) (defn get-x () self:x)))"),
r#"extends Reference
class ClassName extends Node:
func _init():
pass
var x
func get_x():
return self.x
"#);
}
#[test]
pub fn member_var_class_test_2() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defvar x) (defn _init (x) (set self:x x)) (defn get-x () self:x)))"),
r#"extends Reference
class ClassName extends Node:
func _init(x):
self.x = x
var x
func get_x():
return self.x
"#);
}
#[test]
pub fn member_var_class_test_3() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defvar x 999) (defn _init (x) (set self:x x)) (defn get-x () self:x)))"),
r#"extends Reference
class ClassName extends Node:
func _init(x):
self.x = x
var x = 999
func get_x():
return self.x
"#);
}
#[test]
pub fn member_var_class_test_4() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) main (defvar x (export int 1 2)) (defn _init (x) (set self:x x)) (defn get-x () self:x)))"),
r#"extends Node
func _init(x):
self.x = x
export(int, 1, 2) var x
func get_x():
return self.x
"#);
}
#[test]
pub fn member_var_class_test_5() {
assert_eq!(parse_compile_decl(r#"((defclass ClassName (Node) main (defvar x "foo" (export String "foo" "bar")) (defn _init (x) (set self:x x)) (defn get-x () self:x)))"#),
r#"extends Node
func _init(x):
self.x = x
export(String, "foo", "bar") var x = "foo"
func get_x():
return self.x
"#);
}
#[test]
pub fn member_var_class_test_6() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defvars x y z)))"),
r#"extends Reference
class ClassName extends Node:
func _init():
pass
var x
var y
var z
"#);
}
#[test]
pub fn member_var_class_test_7() {
assert_eq!(parse_compile_decl(r#"((defclass ClassName (Node) main (defvar x "foo" (export String "foo" "bar")) (defn _init (x) (set @x x)) (defn get-x () @x)))"#),
r#"extends Node
func _init(x):
self.x = x
export(String, "foo", "bar") var x = "foo"
func get_x():
return self.x
"#);
}
#[test]
pub fn init_member_var_class_test_1() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defvars x y z) (defn _init (@x))))"),
r#"extends Reference
class ClassName extends Node:
func _init(x_0):
self.x = x_0
var x
var y
var z
"#);
}
#[test]
pub fn init_member_var_class_test_2() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defvars x y) (defvar z 10) (defn _init (@x @y))))"),
r#"extends Reference
class ClassName extends Node:
func _init(x_0, y_1):
self.x = x_0
self.y = y_1
var x
var y
var z = 10
"#);
}
#[test]
pub fn init_member_var_class_test_3() {
// sys/split is just to force the variable initialization to go into
// the constructor rather than be inline on the 'var' line.
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defvars x y) (defvar z (sys/split 3)) (defn _init (@x @y))))"),
r#"extends Reference
class ClassName extends Node:
func _init(x_0, y_1):
var _split = 3
self.z = _split
self.x = x_0
self.y = y_1
var x
var y
var z
"#);
}
#[test]
pub fn ready_member_var_class_test_1() {
assert_eq!(parse_compile_decl(r#"((defclass ClassName (Node) main (defvar x "foo" onready)))"#),
r#"extends Node
func _init():
pass
onready var x = "foo"
"#);
}
#[test]
pub fn ready_member_var_class_test_2() {
assert_eq!(parse_compile_decl(r#"((defclass ClassName (Node) main (defvar x "foo" (export String) onready)))"#),
r#"extends Node
func _init():
pass
export(String) onready var x = "foo"
"#);
}
#[test]
pub fn complicated_member_var_class_test() {
assert_eq!(
parse_compile_decl("((defclass ClassName (Node) main (defvar x (if 1 2 3)) (defn _init (x) (set self:x x)) (defn get-x () self:x)))"),
r#"extends Node
func _init(x):
var _cond = null
if 1:
_cond = 2
else:
if true:
_cond = 3
else:
_cond = null
self.x = _cond
self.x = x
var x
func get_x():
return self.x
"#);
}
#[test]
pub fn complicated_ready_member_var_class_test() {
assert_eq!(
parse_compile_decl("((defclass ClassName (Node) main (defvar x (if 1 2 3) onready) (defn _init (x) (set self:x x)) (defn get-x () self:x)))"),
r#"extends Node
func _init(x):
self.x = x
var x
func get_x():
return self.x
func _ready():
var _cond = null
if 1:
_cond = 2
else:
if true:
_cond = 3
else:
_cond = null
self.x = _cond
"#);
}
#[test]
pub fn bad_member_var_class_test_1() {
// Can't have export on inner class
assert_eq!(
parse_compile_decl_err("((defclass ClassName (Node) (defvar x (export int)) (defn _init (x) (set self:x x)) (defn get-x () self:x)))"),
Err(PError::from(GDError::new(GDErrorF::ExportOnInnerClassVar(String::from("x")), SourceOffset(28)))),
);
}
#[test]
pub fn bad_self_static_ref_class_test() {
// Can't reference self from static context
assert_eq!(
parse_compile_decl_err("((defclass ClassName (Node) (defn get-self () static self)))"),
Err(PError::from(GDError::new(GDErrorF::NoSuchVar(String::from("self")), SourceOffset(53)))),
);
}
#[test]
pub fn bad_member_const_class_test() {
// Consts must be initialized
let result = parse_compile_decl_err("((defclass ClassName (Node) (defconst x)))");
assert_eq!(
result,
Err(PError::GDError(GDError::new(GDErrorF::WrongNumberArgs(String::from("defconst"), Expecting::exactly(2), 1), SourceOffset(28)))),
);
}
#[test]
pub fn bad_static_constructor_class_test() {
// Constructors cannot be static
assert_eq!(
parse_compile_decl_err("((defclass ClassName (Node) (defn _init () static)))"),
Err(PError::from(GDError::new(GDErrorF::StaticConstructor, SourceOffset(29)))),
);
}
#[test]
pub fn bad_nullargs_constructor_class_test() {
// Constructors cannot be sys/nullargs
assert_eq!(
parse_compile_decl_err("((defclass ClassName (Node) (defn _init () sys/nullargs)))"),
Err(PError::from(GDError::new(GDErrorF::NullargsConstructor, SourceOffset(29)))),
);
}
#[test]
pub fn bad_super_in_instance_function_test() {
// Can't have super in non-constructor method
assert_eq!(
parse_compile_decl_err("((defclass ClassName (Node) (defn foo () (super 1))))"),
Err(PError::from(GDError::new(GDErrorF::BadSuperCall(String::from("(init)")), SourceOffset(42)))),
);
}
#[test]
pub fn signal_class_test_1() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defsignal my-signal)))"),
r#"extends Reference
class ClassName extends Node:
func _init():
pass
signal my_signal
"#);
}
#[test]
pub fn signal_class_test_2() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defsignal my-signal ())))"),
r#"extends Reference
class ClassName extends Node:
func _init():
pass
signal my_signal
"#);
}
#[test]
pub fn signal_class_test_3() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defsignal my-signal (foo bar))))"),
r#"extends Reference
class ClassName extends Node:
func _init():
pass
signal my_signal(foo, bar)
"#);
}
#[test]
pub fn signal_class_test_4() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defsignal my-signal (foo bar)) (defsignal my-other-signal)))"),
r#"extends Reference
class ClassName extends Node:
func _init():
pass
signal my_signal(foo, bar)
signal my_other_signal
"#);
}
#[test]
pub fn const_in_class_test() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defconst x 1)))"),
r#"extends Reference
class ClassName extends Node:
func _init():
pass
const x = 1
"#);
}
#[test]
pub fn const_in_main_class_test() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) main (defconst x 1)))"),
r#"extends Node
func _init():
pass
const x = 1
"#);
}
#[test]
pub fn static_in_class_test() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defn foo () static 1)))"),
r#"extends Reference
class ClassName extends Node:
func _init():
pass
static func foo():
return 1
"#);
}
#[test]
pub fn nullargs_in_class_test_1() {
// No effect since there are no arguments.
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defn foo () sys/nullargs 1)))"),
r#"extends Reference
class ClassName extends Node:
func _init():
pass
func foo():
return 1
"#);
}
#[test]
pub fn nullargs_in_class_test_2() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defn foo (x y z) sys/nullargs 1)))"),
r#"extends Reference
class ClassName extends Node:
func _init():
pass
func foo(x = null, y = null, z = null):
return 1
"#);
}
#[test]
pub fn nullargs_in_class_test_3() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defn foo (x y z) sys/nullargs static 1)))"),
r#"extends Reference
class ClassName extends Node:
func _init():
pass
static func foo(x = null, y = null, z = null):
return 1
"#);
}
#[test]
pub fn nullargs_in_class_test_4() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) (defn foo (x y z) static sys/nullargs 1)))"),
r#"extends Reference
class ClassName extends Node:
func _init():
pass
static func foo(x = null, y = null, z = null):
return 1
"#);
}
#[test]
pub fn static_in_main_class_test() {
assert_eq!(parse_compile_decl("((defclass ClassName (Node) main (defn foo () static 1)))"),
r#"extends Node
func _init():
pass
static func foo():
return 1
"#);
}
#[test]
pub fn simple_self_closure_class_test() {
assert_eq!(parse_compile_decl("((defclass Foo (Node) (defn test () (lambda () self))))"),
r#"extends Reference
class _LambdaBlock extends GDLisp.Function:
var _self_0
func _init(_self_0):
self._self_0 = _self_0
self.__gdlisp_required = 0
self.__gdlisp_optional = 0
self.__gdlisp_rest = 0
func call_func():
return _self_0
func call_funcv(args):
if args == null:
return call_func()
else:
push_error("Too many arguments")
class Foo extends Node:
func _init():
pass
func test():