ir: remove redundant casting code

master
Andrew Kelley 2018-11-11 12:48:55 -05:00
parent ef5d7ce463
commit 67fbb0434f
No known key found for this signature in database
GPG Key ID: 4E7CD66038A4D47C
1 changed files with 0 additions and 19 deletions

View File

@ -10421,25 +10421,6 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
} }
} }
// cast from *const [N]T to []const T
if (is_slice(wanted_type) &&
actual_type->id == ZigTypeIdPointer &&
actual_type->data.pointer.is_const &&
actual_type->data.pointer.child_type->id == ZigTypeIdArray)
{
ZigType *ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry;
assert(ptr_type->id == ZigTypeIdPointer);
ZigType *array_type = actual_type->data.pointer.child_type;
if ((ptr_type->data.pointer.is_const || array_type->data.array.len == 0) &&
types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, array_type->data.array.child_type,
source_node, false).id == ConstCastResultIdOk)
{
return ir_analyze_array_to_slice(ira, source_instr, value, wanted_type);
}
}
// cast from [N]T to ?[]const T // cast from [N]T to ?[]const T
if (wanted_type->id == ZigTypeIdOptional && if (wanted_type->id == ZigTypeIdOptional &&
is_slice(wanted_type->data.maybe.child_type) && is_slice(wanted_type->data.maybe.child_type) &&