aboutsummaryrefslogtreecommitdiff
path: root/src/exact_value.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/exact_value.cpp')
-rw-r--r--src/exact_value.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/exact_value.cpp b/src/exact_value.cpp
index 1473319cc..2e33d1786 100644
--- a/src/exact_value.cpp
+++ b/src/exact_value.cpp
@@ -592,6 +592,10 @@ i32 exact_value_order(ExactValue const &v) {
return 5;
case ExactValue_Pointer:
return 6;
+ case ExactValue_Procedure:
+ return 7;
+ // case ExactValue_Compound:
+ // return 8;
default:
GB_PANIC("How'd you get here? Invalid Value.kind");
@@ -652,6 +656,9 @@ void match_exact_values(ExactValue *x, ExactValue *y) {
return;
}
break;
+
+ case ExactValue_Procedure:
+ return;
}
compiler_error("match_exact_values: How'd you get here? Invalid ExactValueKind %d", x->kind);
@@ -915,12 +922,23 @@ bool compare_exact_values(TokenKind op, ExactValue x, ExactValue y) {
case Token_NotEq: return !are_types_identical(x.value_typeid, y.value_typeid);
}
break;
+
+ case ExactValue_Procedure:
+ switch (op) {
+ case Token_CmpEq: return are_types_identical(x.value_typeid, y.value_typeid);
+ case Token_NotEq: return !are_types_identical(x.value_typeid, y.value_typeid);
+ }
+ break;
}
GB_PANIC("Invalid comparison");
return false;
}
+Entity *strip_entity_wrapping(Ast *expr);
+Entity *strip_entity_wrapping(Entity *e);
+
+gbString write_expr_to_string(gbString str, Ast *node);
gbString write_exact_value_to_string(gbString str, ExactValue const &v, isize string_limit=36) {
switch (v.kind) {
@@ -956,9 +974,9 @@ gbString write_exact_value_to_string(gbString str, ExactValue const &v, isize st
case ExactValue_Pointer:
return str;
case ExactValue_Compound:
- return str;
+ return write_expr_to_string(str, v.value_compound);
case ExactValue_Procedure:
- return str;
+ return write_expr_to_string(str, v.value_procedure);
}
return str;
};