Skip to content

Commit 832dbf4

Browse files
committed
Tweak to QAST to get it to not explode when loaded.
1 parent 2763317 commit 832dbf4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/QAST/Operations.nqp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class QAST::Operations {
5555

5656
# Adds a HLL op handler.
5757
method add_hll_op($hll, $op, $handler, :$inlinable = 0) {
58-
%hll_ops{$hll} := {} unless %hll_ops{$hll};
58+
%hll_ops{$hll} := {} unless nqp::existskey(%hll_ops, $hll);
5959
%hll_ops{$hll}{$op} := $handler;
6060
self.set_hll_op_inlinability($hll, $op, $inlinable);
6161
}
@@ -73,7 +73,7 @@ class QAST::Operations {
7373
# Adds a HLL op that maps to a PIR op.
7474
method add_hll_pirop_mapping($hll, $op, $pirop, $sig, :$inlinable = 0) {
7575
my $pirop_mapper := pirop_mapper($pirop, $sig);
76-
%hll_ops{$hll} := {} unless %hll_ops{$hll};
76+
%hll_ops{$hll} := {} unless nqp::existskey(%hll_ops, $hll);
7777
%hll_ops{$hll}{$op} := -> $qastcomp, $op {
7878
$pirop_mapper($qastcomp, $op.op, $op.list)
7979
};
@@ -89,7 +89,7 @@ class QAST::Operations {
8989
# Sets op inlinability at a HLL level. (Can override at HLL level whether
9090
# or not the HLL overrides the op itself.)
9191
method set_hll_op_inlinability($hll, $op, $inlinable) {
92-
%hll_inlinability{$hll} := {} unless %hll_inlinability{$hll};
92+
%hll_inlinability{$hll} := {} unless nqp::existskey(%hll_inlinability, $hll);
9393
%hll_inlinability{$hll}{$op} := $inlinable;
9494
}
9595

@@ -119,7 +119,7 @@ class QAST::Operations {
119119
# Sets op inlinability at a HLL level. (Can override at HLL level whether
120120
# or not the HLL overrides the op itself.)
121121
method set_hll_op_result_type($hll, $op, $type_char) {
122-
%hll_result_type{$hll} := {} unless %hll_result_type{$hll};
122+
%hll_result_type{$hll} := {} unless nqp::existskey(%hll_result_type, $hll);
123123
if $type_char eq 'I' {
124124
%hll_result_type{$hll}{$op} := int;
125125
}
@@ -150,7 +150,7 @@ class QAST::Operations {
150150
unless $type eq 'i' || $type eq 'n' || $type eq 's' {
151151
nqp::die("Unknown box type '$type'");
152152
}
153-
%hll_box{$hll} := {} unless %hll_box{$hll};
153+
%hll_box{$hll} := {} unless nqp::existskey(%hll_box, $hll);
154154
%hll_box{$hll}{$type} := $handler;
155155
}
156156

@@ -159,7 +159,7 @@ class QAST::Operations {
159159
unless $type eq 'i' || $type eq 'n' || $type eq 's' {
160160
nqp::die("Unknown unbox type '$type'");
161161
}
162-
%hll_unbox{$hll} := {} unless %hll_unbox{$hll};
162+
%hll_unbox{$hll} := {} unless nqp::existskey(%hll_unbox, $hll);
163163
%hll_unbox{$hll}{$type} := $handler;
164164
}
165165

0 commit comments

Comments
 (0)