pike.git/
src/
pike_types.cmod
Branch:
Tag:
Non-build tags
All tags
No tags
2021-02-15
2021-02-15 12:21:34 by Henrik Grubbström (Grubba) <grubba@grubba.org>
e75593ae31d86f01dc9e296a9e1105f18269cb72 (
106
lines) (+
52
/-
54
)
[
Show
|
Annotate
]
Branch:
master
Compiler
[Typechecker]
: Fix handling of nullable-void with mixed.
5166:
} if (a->type != b->type) {
-
if (
(
a->type == T_VOID)
&&
(bflags & PT_FLAG_CMP_VOIDABLE)
)
{
+
if (a->type == T_VOID)
{
+
if
(bflags & PT_FLAG_CMP_VOIDABLE) {
b = a; goto recur; }
-
if ((b->type == T_VOID)
&&
(aflags & PT_FLAG_CMP_VOIDABLE)
)
{
+
if (
aflags & PT_FLAG_CMP_NULLABLE) {
+
a = zero_type_string;
+
goto recur;
+
}
+
}
+
if
(b->type == T_VOID)
{
+
if
(aflags & PT_FLAG_CMP_VOIDABLE) {
a = b; goto recur; }
-
-
if
(((b->type
==
T_MIXED) &&
(
a->type
== T_VOID)) ||
-
((a->type == T_MIXED)
&
&
(b->type == T_VOID))) {
-
switch (op & (
PT_
BINOP
_
MINUS | PT
_
BINOP_INVERSE_MINUS
)
)
{
-
case
0:
-
return NULL;
-
case PT_BINOP_MINUS:
-
add_ref(a);
-
return a;
-
case PT_BINOP_INVERSE_MINUS:
-
add_ref(
b
);
-
return b;
-
default:
-
type
_
stack_mark();
-
push_finished_
type
(a);
-
push
_
finished_type(b)
;
-
push_type(T_OR);
-
return pop_unfinished_type()
;
+
if
(
bflags
& PT_
FLAG
_
CMP
_
NULLABLE
) {
+
b
=
zero
_type_
string
;
+
goto
recur
;
} }
-
+
+
if (a->type != T_VOID) {
if (b->type == T_MIXED) { switch(op & PT_BINOP_B) { case 0:
5210:
return b; } }
+
}
+
if (b->type != T_VOID) {
if (a->type == T_MIXED) { switch(op & PT_BINOP_A) { case 0:
5228:
return a; } }
+
}
if ((a->type == T_ZERO) && (bflags & PT_FLAG_CMP_NULLABLE)) { b = a;