aboutsummaryrefslogtreecommitdiff
path: root/src/compile/binops.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-09-21 15:43:59 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-09-21 15:43:59 -0400
commit71f73d8b3ce63f9a3685bc1a1686ef4fab3294a6 (patch)
tree99fe1309fa4d24609867dcc62859caed909a76d9 /src/compile/binops.c
parentf5612e38183dc20d18f207f8ab055574a4d93ad0 (diff)
Deprecate sets
Diffstat (limited to 'src/compile/binops.c')
-rw-r--r--src/compile/binops.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/compile/binops.c b/src/compile/binops.c
index 9710019b..0bff98c0 100644
--- a/src/compile/binops.c
+++ b/src/compile/binops.c
@@ -160,8 +160,8 @@ Text_t compile_binary_op(env_t *env, ast_t *ast) {
return Texts("(", lhs, " + ", rhs, ")");
}
case Minus: {
- if (overall_t->tag == SetType)
- return Texts("Table$without(", lhs, ", ", rhs, ", ", compile_type_info(overall_t), ")");
+ if (overall_t->tag == TableType)
+ return Texts("Table$minus(", lhs, ", ", rhs, ", ", compile_type_info(overall_t), ")");
if (overall_t->tag != IntType && overall_t->tag != NumType && overall_t->tag != ByteType)
code_err(ast,
"Math operations are only supported for values of the same "
@@ -204,8 +204,8 @@ Text_t compile_binary_op(env_t *env, ast_t *ast) {
case And: {
if (overall_t->tag == BoolType) return Texts("(", lhs, " && ", rhs, ")");
else if (overall_t->tag == IntType || overall_t->tag == ByteType) return Texts("(", lhs, " & ", rhs, ")");
- else if (overall_t->tag == SetType)
- return Texts("Table$overlap(", lhs, ", ", rhs, ", ", compile_type_info(overall_t), ")");
+ else if (overall_t->tag == TableType)
+ return Texts("Table$and(", lhs, ", ", rhs, ", ", compile_type_info(overall_t), ")");
else
code_err(ast, "The 'and' operator isn't supported between ", type_to_text(lhs_t), " and ",
type_to_text(rhs_t), " values");
@@ -218,18 +218,18 @@ Text_t compile_binary_op(env_t *env, ast_t *ast) {
return Texts("(", lhs, " || ", rhs, ")");
} else if (overall_t->tag == IntType || overall_t->tag == ByteType) {
return Texts("(", lhs, " | ", rhs, ")");
- } else if (overall_t->tag == SetType) {
- return Texts("Table$with(", lhs, ", ", rhs, ", ", compile_type_info(overall_t), ")");
+ } else if (overall_t->tag == TableType) {
+ return Texts("Table$or(", lhs, ", ", rhs, ", ", compile_type_info(overall_t), ")");
} else {
- code_err(ast, "The 'or' operator isn't supported between ", type_to_text(lhs_t), " and ", type_to_text(rhs_t),
- " values");
+ code_err(ast, "The 'or' operator isn't supported between ", type_to_text(lhs_t), " and ",
+ type_to_text(rhs_t), " values");
}
}
case Xor: {
// TODO: support optional values in `xor` expressions
if (overall_t->tag == BoolType || overall_t->tag == IntType || overall_t->tag == ByteType)
return Texts("(", lhs, " ^ ", rhs, ")");
- else if (overall_t->tag == SetType)
+ else if (overall_t->tag == TableType)
return Texts("Table$xor(", lhs, ", ", rhs, ", ", compile_type_info(overall_t), ")");
else
code_err(ast, "The 'xor' operator isn't supported between ", type_to_text(lhs_t), " and ",