authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-11-11 12:48:55-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-11-11 12:48:55-05:00
log67fbb0434f7104801c66e821b5057a8323e377df
treed0d4e792b6b5cbe7e87f1f01ea3d75c285e6fc6d
parentef5d7ce46382fb2735e83958fe1bbe416624906a
signature Commit is signed but in an unrecognized format.

ir: remove redundant casting code


1 files changed, 0 insertions(+), 19 deletions(-)

src/ir.cpp-19
...@@ -10421,25 +10421,6 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst...@@ -10421,25 +10421,6 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
10421 }10421 }
10422 }10422 }
1042310423
10424 // cast from *const [N]T to []const T
10425 if (is_slice(wanted_type) &&
10426 actual_type->id == ZigTypeIdPointer &&
10427 actual_type->data.pointer.is_const &&
10428 actual_type->data.pointer.child_type->id == ZigTypeIdArray)
10429 {
10430 ZigType *ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry;
10431 assert(ptr_type->id == ZigTypeIdPointer);
10432
10433 ZigType *array_type = actual_type->data.pointer.child_type;
10434
10435 if ((ptr_type->data.pointer.is_const || array_type->data.array.len == 0) &&
10436 types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, array_type->data.array.child_type,
10437 source_node, false).id == ConstCastResultIdOk)
10438 {
10439 return ir_analyze_array_to_slice(ira, source_instr, value, wanted_type);
10440 }
10441 }
10442
10443 // cast from [N]T to ?[]const T10424 // cast from [N]T to ?[]const T
10444 if (wanted_type->id == ZigTypeIdOptional &&10425 if (wanted_type->id == ZigTypeIdOptional &&
10445 is_slice(wanted_type->data.maybe.child_type) &&10426 is_slice(wanted_type->data.maybe.child_type) &&