@@ -3,6 +3,7 @@ export 0 = &function ['./test/end-to-end/tests/arrays.test.mvms:run'];
3
3
slot ['./test/end-to-end/tests/arrays.test.mvms:a'] = &allocation 6;
4
4
slot ['./test/end-to-end/tests/arrays.test.mvms:b'] = &allocation 7;
5
5
slot ['./test/end-to-end/tests/arrays.test.mvms:c'] = &allocation 8;
6
+ slot ['./test/end-to-end/tests/arrays.test.mvms:d'] = &allocation 9;
6
7
slot ['./test/end-to-end/tests/arrays.test.mvms:init'] = &function ['./test/end-to-end/tests/arrays.test.mvms:init'];
7
8
slot ['./test/end-to-end/tests/arrays.test.mvms:testArrays'] = &function ['./test/end-to-end/tests/arrays.test.mvms:testArrays'];
8
9
slot ['global:assert'] = host function 2;
@@ -46,6 +47,46 @@ function ['./test/end-to-end/tests/arrays.test.mvms:init']() {
46
47
LoadVar(index 0);
47
48
StoreGlobal(name './test/end-to-end/tests/arrays.test.mvms:c');
48
49
Pop(count 1);
50
+ ArrayNew();
51
+ LoadVar(index 0);
52
+ Literal(lit 0);
53
+ ArrayNew();
54
+ LoadVar(index 3);
55
+ Literal(lit 0);
56
+ ArrayNew();
57
+ LoadVar(index 6);
58
+ Literal(lit 0);
59
+ Literal(lit 1);
60
+ ObjectSet();
61
+ LoadVar(index 6);
62
+ Literal(lit 1);
63
+ Literal(lit 2);
64
+ ObjectSet();
65
+ ObjectSet();
66
+ LoadVar(index 3);
67
+ Literal(lit 1);
68
+ ArrayNew();
69
+ LoadVar(index 6);
70
+ Literal(lit 0);
71
+ Literal(lit 3);
72
+ ObjectSet();
73
+ LoadVar(index 6);
74
+ Literal(lit 1);
75
+ Literal(lit 4);
76
+ ObjectSet();
77
+ ObjectSet();
78
+ LoadVar(index 3);
79
+ Literal(lit 2);
80
+ Literal(lit 5);
81
+ ObjectSet();
82
+ ObjectSet();
83
+ LoadVar(index 0);
84
+ Literal(lit 1);
85
+ Literal(lit 6);
86
+ ObjectSet();
87
+ LoadVar(index 0);
88
+ StoreGlobal(name './test/end-to-end/tests/arrays.test.mvms:d');
89
+ Pop(count 1);
49
90
Literal(lit undefined);
50
91
Return();
51
92
}
@@ -511,6 +552,103 @@ function ['./test/end-to-end/tests/arrays.test.mvms:testArrays']() {
511
552
Literal(lit 30);
512
553
Call(count 3);
513
554
Pop(count 1);
555
+ // See that the nested arrays are correct
556
+ LoadGlobal(name 'global:assertEqual');
557
+ Literal(lit undefined);
558
+ LoadGlobal(name './test/end-to-end/tests/arrays.test.mvms:d');
559
+ Literal(lit 'length');
560
+ ObjectGet();
561
+ Literal(lit 2);
562
+ Call(count 3);
563
+ Pop(count 1);
564
+ LoadGlobal(name 'global:assertEqual');
565
+ Literal(lit undefined);
566
+ LoadGlobal(name './test/end-to-end/tests/arrays.test.mvms:d');
567
+ Literal(lit 0);
568
+ ObjectGet();
569
+ Literal(lit 'length');
570
+ ObjectGet();
571
+ Literal(lit 3);
572
+ Call(count 3);
573
+ Pop(count 1);
574
+ LoadGlobal(name 'global:assertEqual');
575
+ Literal(lit undefined);
576
+ LoadGlobal(name './test/end-to-end/tests/arrays.test.mvms:d');
577
+ Literal(lit 0);
578
+ ObjectGet();
579
+ Literal(lit 0);
580
+ ObjectGet();
581
+ Literal(lit 'length');
582
+ ObjectGet();
583
+ Literal(lit 2);
584
+ Call(count 3);
585
+ Pop(count 1);
586
+ LoadGlobal(name 'global:assertEqual');
587
+ Literal(lit undefined);
588
+ LoadGlobal(name './test/end-to-end/tests/arrays.test.mvms:d');
589
+ Literal(lit 0);
590
+ ObjectGet();
591
+ Literal(lit 0);
592
+ ObjectGet();
593
+ Literal(lit 0);
594
+ ObjectGet();
595
+ Literal(lit 1);
596
+ Call(count 3);
597
+ Pop(count 1);
598
+ LoadGlobal(name 'global:assertEqual');
599
+ Literal(lit undefined);
600
+ LoadGlobal(name './test/end-to-end/tests/arrays.test.mvms:d');
601
+ Literal(lit 0);
602
+ ObjectGet();
603
+ Literal(lit 0);
604
+ ObjectGet();
605
+ Literal(lit 1);
606
+ ObjectGet();
607
+ Literal(lit 2);
608
+ Call(count 3);
609
+ Pop(count 1);
610
+ LoadGlobal(name 'global:assertEqual');
611
+ Literal(lit undefined);
612
+ LoadGlobal(name './test/end-to-end/tests/arrays.test.mvms:d');
613
+ Literal(lit 0);
614
+ ObjectGet();
615
+ Literal(lit 1);
616
+ ObjectGet();
617
+ Literal(lit 0);
618
+ ObjectGet();
619
+ Literal(lit 3);
620
+ Call(count 3);
621
+ Pop(count 1);
622
+ LoadGlobal(name 'global:assertEqual');
623
+ Literal(lit undefined);
624
+ LoadGlobal(name './test/end-to-end/tests/arrays.test.mvms:d');
625
+ Literal(lit 0);
626
+ ObjectGet();
627
+ Literal(lit 1);
628
+ ObjectGet();
629
+ Literal(lit 1);
630
+ ObjectGet();
631
+ Literal(lit 4);
632
+ Call(count 3);
633
+ Pop(count 1);
634
+ LoadGlobal(name 'global:assertEqual');
635
+ Literal(lit undefined);
636
+ LoadGlobal(name './test/end-to-end/tests/arrays.test.mvms:d');
637
+ Literal(lit 0);
638
+ ObjectGet();
639
+ Literal(lit 2);
640
+ ObjectGet();
641
+ Literal(lit 5);
642
+ Call(count 3);
643
+ Pop(count 1);
644
+ LoadGlobal(name 'global:assertEqual');
645
+ Literal(lit undefined);
646
+ LoadGlobal(name './test/end-to-end/tests/arrays.test.mvms:d');
647
+ Literal(lit 1);
648
+ ObjectGet();
649
+ Literal(lit 6);
650
+ Call(count 3);
651
+ Pop(count 1);
514
652
// Reset the arrays to their initial state, because this test runs multiple
515
653
// times (before and after the snapshot)
516
654
LoadGlobal(name './test/end-to-end/tests/arrays.test.mvms:init');
@@ -536,6 +674,22 @@ function ['<builtin>:Array_push']() {
536
674
Return();
537
675
}
538
676
677
+ allocation 10 = [
678
+ &allocation 11,
679
+ &allocation 12,
680
+ 5,
681
+ ];
682
+
683
+ allocation 11 = [
684
+ 1,
685
+ 2,
686
+ ];
687
+
688
+ allocation 12 = [
689
+ 3,
690
+ 4,
691
+ ];
692
+
539
693
allocation 3 = {
540
694
push: &function ['<builtin>:Array_push'],
541
695
};
@@ -554,4 +708,9 @@ allocation 8 = [
554
708
,
555
709
3,
556
710
,
711
+ ];
712
+
713
+ allocation 9 = [
714
+ &allocation 10,
715
+ 6,
557
716
];
0 commit comments