Skip to content

Commit 404e842

Browse files
committed
Implement multi-dim access funcs in VMArray.
1 parent ef20fbf commit 404e842

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/VMArrayInstanceBase.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,28 @@ public void set_dimensions(ThreadContext tc, long[] dims) {
1616
throw ExceptionHandling.dieInternal(tc, "A dynamic array can only have a single dimension");
1717
this.set_elems(tc, dims[0]);
1818
}
19+
20+
public SixModelObject at_pos_multidim_boxed(ThreadContext tc, long[] indices) {
21+
if (indices.length != 1)
22+
throw ExceptionHandling.dieInternal(tc, "A dynamic array can only be indexed with a single dimension");
23+
return this.at_pos_boxed(tc, indices[0]);
24+
}
25+
26+
public void at_pos_multidim_native(ThreadContext tc, long[] indices) {
27+
if (indices.length != 1)
28+
throw ExceptionHandling.dieInternal(tc, "A dynamic array can only be indexed with a single dimension");
29+
this.at_pos_native(tc, indices[0]);
30+
}
31+
32+
public void bind_pos_multidim_boxed(ThreadContext tc, long[] indices, SixModelObject value) {
33+
if (indices.length != 1)
34+
throw ExceptionHandling.dieInternal(tc, "A dynamic array can only be indexed with a single dimension");
35+
this.bind_pos_boxed(tc, indices[0], value);
36+
}
37+
38+
public void bind_pos_multidim_native(ThreadContext tc, long[] indices) {
39+
if (indices.length != 1)
40+
throw ExceptionHandling.dieInternal(tc, "A dynamic array can only be indexed with a single dimension");
41+
this.bind_pos_native(tc, indices[0]);
42+
}
1943
}

0 commit comments

Comments
 (0)