aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-03-16 21:41:46 -0400
committerAndrew Kelley <andrew@ziglang.org>2020-03-19 09:53:54 -0400
commit0707be8de88823ff943c3fbd7d0035f88d32dd87 (patch)
tree97e21a5c78e3aa7272e929a3fb3621aeb67dcb3b /src/analyze.cpp
parent2182d28cb0917b8d869d13802a5955ee35b4537a (diff)
downloadzig-0707be8de88823ff943c3fbd7d0035f88d32dd87.tar.gz
zig-0707be8de88823ff943c3fbd7d0035f88d32dd87.zip
fixes in semantic analysis needed to support this feature
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index e9b9f03704..afffe47c82 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -5280,6 +5280,11 @@ static uint32_t hash_const_val_ptr(ZigValue *const_val) {
hash_val += hash_ptr(const_val->data.x_ptr.data.base_array.array_val);
hash_val += hash_size(const_val->data.x_ptr.data.base_array.elem_index);
return hash_val;
+ case ConstPtrSpecialSubArray:
+ hash_val += (uint32_t)2643358777;
+ hash_val += hash_ptr(const_val->data.x_ptr.data.base_array.array_val);
+ hash_val += hash_size(const_val->data.x_ptr.data.base_array.elem_index);
+ return hash_val;
case ConstPtrSpecialBaseStruct:
hash_val += (uint32_t)3518317043;
hash_val += hash_ptr(const_val->data.x_ptr.data.base_struct.struct_val);
@@ -6746,6 +6751,7 @@ bool const_values_equal_ptr(ZigValue *a, ZigValue *b) {
return false;
return true;
case ConstPtrSpecialBaseArray:
+ case ConstPtrSpecialSubArray:
if (a->data.x_ptr.data.base_array.array_val != b->data.x_ptr.data.base_array.array_val) {
return false;
}
@@ -7003,6 +7009,7 @@ static void render_const_val_ptr(CodeGen *g, Buf *buf, ZigValue *const_val, ZigT
render_const_value(g, buf, const_ptr_pointee(nullptr, g, const_val, nullptr));
return;
case ConstPtrSpecialBaseArray:
+ case ConstPtrSpecialSubArray:
buf_appendf(buf, "*");
// TODO we need a source node for const_ptr_pointee because it can generate compile errors
render_const_value(g, buf, const_ptr_pointee(nullptr, g, const_val, nullptr));