Skip to content

Commit 6fb02d8

Browse files
committed
autovivification WIP
1 parent ba78658 commit 6fb02d8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/main/java/org/perlonjava/runtime/RuntimeHash.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ public int countElements() {
7070
* @param array The RuntimeArray to which this hash will be added.
7171
*/
7272
public void addToArray(RuntimeArray array) {
73+
74+
if (this.elements instanceof AutovivificationHash) {
75+
throw new PerlCompilerException("Can't use an undefined value as an HASH reference");
76+
}
77+
7378
List<RuntimeScalar> elements = array.elements;
7479
for (Map.Entry<String, RuntimeScalar> entry : this.elements.entrySet()) {
7580
elements.add(new RuntimeScalar(entry.getKey()));

0 commit comments

Comments
 (0)