summaryrefslogtreecommitdiff
path: root/05/parse.b
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-02-12 23:04:53 -0500
committerpommicket <pommicket@gmail.com>2022-02-12 23:05:14 -0500
commit47688e0a467dc7960740f8730539c3b806c033da (patch)
tree591f97d50c2bc83448ce250a318f979f0d80efb5 /05/parse.b
parente0495afd425d88be28bd0f4cd9ce23eced474bc1 (diff)
fix generate_function_addr; conditional expressions
Diffstat (limited to '05/parse.b')
-rw-r--r--05/parse.b10
1 files changed, 10 insertions, 0 deletions
diff --git a/05/parse.b b/05/parse.b
index 61b2418..96941b9 100644
--- a/05/parse.b
+++ b/05/parse.b
@@ -3075,6 +3075,11 @@ function parse_expression
a = out + 4
out = parse_expression(tokens, best, out)
type_decay_array_to_pointer_in_place(*4a)
+
+ ; check type of "condition"
+ b = types + *4a
+ if *1b > TYPE_POINTER goto bad_condition_type
+
a = out + 4 ; type of left branch of conditional
best += 16
out = parse_expression(best, p, out)
@@ -3093,6 +3098,11 @@ function parse_expression
; no conversions
*4type = *4a
return out
+ :bad_condition_type
+ token_error(tokens, .str_bad_condition_type)
+ :str_bad_condition_type
+ string Bad condition type for conditional operator (? :).
+ byte 0
:parse_postincrement
*1out = EXPRESSION_POST_INCREMENT
p = tokens_end - 16