aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2018-02-07 20:38:49 +0100
committerAndrew Kelley <superjoe30@gmail.com>2018-02-07 14:38:49 -0500
commit0090c2d70b89cc6b5ab02bdc02aa49c4caf71a5a (patch)
tree3ad1caa3ee17dc7ee71d19f343121f429b101f5d /src/analyze.cpp
parent917e6fe3707a82f76c48e484735b86937831451f (diff)
downloadzig-0090c2d70b89cc6b5ab02bdc02aa49c4caf71a5a.tar.gz
zig-0090c2d70b89cc6b5ab02bdc02aa49c4caf71a5a.zip
DRY 'is slice?' conditionals in parser (#750)
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index 2812c9d79e..4c982c160c 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -3380,11 +3380,7 @@ bool types_match_const_cast_only(TypeTableEntry *expected_type, TypeTableEntry *
}
// slice const
- if (expected_type->id == TypeTableEntryIdStruct &&
- actual_type->id == TypeTableEntryIdStruct &&
- expected_type->data.structure.is_slice &&
- actual_type->data.structure.is_slice)
- {
+ if (is_slice(expected_type) && is_slice(actual_type)) {
TypeTableEntry *actual_ptr_type = actual_type->data.structure.fields[slice_ptr_index].type_entry;
TypeTableEntry *expected_ptr_type = expected_type->data.structure.fields[slice_ptr_index].type_entry;
if ((!actual_ptr_type->data.pointer.is_const || expected_ptr_type->data.pointer.is_const) &&