mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 21:59:16 +02:00
Issue #509 - Raise error on invalid complex ops
Error on more types of complex comparison operations.
This commit is contained in:
parent
ca931300e3
commit
20fe02d9d9
1 changed files with 18 additions and 5 deletions
23
runtime.c
23
runtime.c
|
@ -1863,8 +1863,15 @@ int FUNC_OP(void *data, object x, object y) { \
|
||||||
make_pair(c0, &s, &c1); \
|
make_pair(c0, &s, &c1); \
|
||||||
Cyc_rt_raise(data, &c0); \
|
Cyc_rt_raise(data, &c0); \
|
||||||
} \
|
} \
|
||||||
} else if (tx == complex_num_tag && ty != complex_num_tag) { \
|
} else if ((tx == complex_num_tag && ty != complex_num_tag) || \
|
||||||
} else if (tx != complex_num_tag && ty == complex_num_tag) { \
|
(tx != complex_num_tag && ty == complex_num_tag)) { \
|
||||||
|
if (BN_CMP != CYC_BN_EQ) { \
|
||||||
|
make_string(s, "Complex comparison operation not allowed"); \
|
||||||
|
make_pair(c2, y, NULL); \
|
||||||
|
make_pair(c1, x, &c2); \
|
||||||
|
make_pair(c0, &s, &c1); \
|
||||||
|
Cyc_rt_raise(data, &c0); \
|
||||||
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
make_string(s, "Bad argument type"); \
|
make_string(s, "Bad argument type"); \
|
||||||
make_pair(c1, y, NULL); \
|
make_pair(c1, y, NULL); \
|
||||||
|
@ -1950,9 +1957,15 @@ object FUNC_FAST_OP(void *data, object x, object y) { \
|
||||||
Cyc_rt_raise(data, &c0); \
|
Cyc_rt_raise(data, &c0); \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
} \
|
} \
|
||||||
} else if (tx == complex_num_tag && ty != complex_num_tag) { \
|
} else if ((tx == complex_num_tag && ty != complex_num_tag) || \
|
||||||
return boolean_f; \
|
(tx != complex_num_tag && ty == complex_num_tag)) { \
|
||||||
} else if (tx != complex_num_tag && ty == complex_num_tag) { \
|
if (BN_CMP != CYC_BN_EQ) { \
|
||||||
|
make_string(s, "Complex comparison operation not allowed"); \
|
||||||
|
make_pair(c2, y, NULL); \
|
||||||
|
make_pair(c1, x, &c2); \
|
||||||
|
make_pair(c0, &s, &c1); \
|
||||||
|
Cyc_rt_raise(data, &c0); \
|
||||||
|
} \
|
||||||
return boolean_f; \
|
return boolean_f; \
|
||||||
} else { \
|
} else { \
|
||||||
goto bad_arg_type_error; \
|
goto bad_arg_type_error; \
|
||||||
|
|
Loading…
Add table
Reference in a new issue