aboutsummaryrefslogtreecommitdiff
path: root/src/exact_value.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-03-03 11:16:48 +0000
committergingerBill <bill@gingerbill.org>2018-03-03 11:16:48 +0000
commit9274f29ca950a1f6b91506b56a291fce0b534f64 (patch)
treeb9a8b563fc23492e23921258b3f0150adb041082 /src/exact_value.cpp
parent08c87e57f878130fd10d8845115070e8bce2a588 (diff)
`deprecated` attribute for procedure declarations
Diffstat (limited to 'src/exact_value.cpp')
-rw-r--r--src/exact_value.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/exact_value.cpp b/src/exact_value.cpp
index 2c6527f3f..49ba5c353 100644
--- a/src/exact_value.cpp
+++ b/src/exact_value.cpp
@@ -6,6 +6,7 @@
struct AstNode;
struct HashKey;
struct Type;
+struct Entity;
bool are_types_identical(Type *x, Type *y);
struct Complex128 {
@@ -21,9 +22,9 @@ enum ExactValueKind {
ExactValue_Float,
ExactValue_Complex,
ExactValue_Pointer,
- ExactValue_Compound, // TODO(bill): Is this good enough?
+ ExactValue_Compound, // TODO(bill): Is this good enough?
ExactValue_Procedure, // TODO(bill): Is this good enough?
- ExactValue_Type,
+ ExactValue_Entity, // TODO(bill): Is this good enough?
ExactValue_Count,
};
@@ -39,7 +40,7 @@ struct ExactValue {
Complex128 value_complex;
AstNode * value_compound;
AstNode * value_procedure;
- Type * value_type;
+ Entity * value_entity;
};
};
@@ -67,8 +68,8 @@ HashKey hash_exact_value(ExactValue v) {
return hash_pointer(v.value_compound);
case ExactValue_Procedure:
return hash_pointer(v.value_procedure);
- case ExactValue_Type:
- return hash_pointer(v.value_type);
+ case ExactValue_Entity:
+ return hash_pointer(v.value_entity);
}
return hashing_proc(&v, gb_size_of(ExactValue));
@@ -125,18 +126,18 @@ ExactValue exact_value_pointer(i64 ptr) {
return result;
}
-ExactValue exact_value_type(Type *type) {
- ExactValue result = {ExactValue_Type};
- result.value_type = type;
- return result;
-}
-
ExactValue exact_value_procedure(AstNode *node) {
ExactValue result = {ExactValue_Procedure};
result.value_procedure = node;
return result;
}
+ExactValue exact_value_entity(Entity *entity) {
+ ExactValue result = {ExactValue_Entity};
+ result.value_entity = entity;
+ return result;
+}
+
ExactValue exact_value_integer_from_string(String string) {
u64 u = u64_from_string(string);
@@ -690,13 +691,6 @@ bool compare_exact_values(TokenKind op, ExactValue x, ExactValue y) {
}
break;
}
-
- case ExactValue_Type:
- switch (op) {
- case Token_CmpEq: return are_types_identical(x.value_type, y.value_type);
- case Token_NotEq: return !are_types_identical(x.value_type, y.value_type);
- }
- break;
}
GB_PANIC("Invalid comparison");