diff options
| author | Ginger Bill <bill@gingerbill.org> | 2016-09-30 20:38:46 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2016-09-30 20:38:46 +0100 |
| commit | c6aac264fa8001ff5e55e5ac6f56289ff0a755ee (patch) | |
| tree | 4ff0521b330e5a2b0183d3bab2f762a669b5efa5 /src/exact_value.cpp | |
| parent | 04b5d8c132e8aabb3bb5dff31683cb45d4dff9c0 (diff) | |
Begin work on const llvm aggregate literals
Diffstat (limited to 'src/exact_value.cpp')
| -rw-r--r-- | src/exact_value.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/exact_value.cpp b/src/exact_value.cpp index e120bff7a..1d4c47520 100644 --- a/src/exact_value.cpp +++ b/src/exact_value.cpp @@ -3,6 +3,8 @@ // TODO(bill): Big numbers // IMPORTANT TODO(bill): This needs to be completely fixed!!!!!!!! +struct AstNode; + enum ExactValueKind { ExactValue_Invalid, @@ -11,6 +13,7 @@ enum ExactValueKind { ExactValue_Integer, ExactValue_Float, ExactValue_Pointer, // TODO(bill): Handle ExactValue_Pointer correctly + ExactValue_Compound, ExactValue_Count, }; @@ -18,11 +21,12 @@ enum ExactValueKind { struct ExactValue { ExactValueKind kind; union { - b32 value_bool; - String value_string; - i64 value_integer; - f64 value_float; - void * value_pointer; + b32 value_bool; + String value_string; + i64 value_integer; + f64 value_float; + void * value_pointer; + AstNode *value_compound; }; }; @@ -30,6 +34,13 @@ HashKey hash_exact_value(ExactValue v) { return hashing_proc(&v, gb_size_of(ExactValue)); } + +ExactValue make_exact_value_compound(AstNode *node) { + ExactValue result = {ExactValue_Compound}; + result.value_compound = node; + return result; +} + ExactValue make_exact_value_bool(b32 b) { ExactValue result = {ExactValue_Bool}; result.value_bool = (b != 0); |