| 13214 | } |
| 13215 | |
| 13216 | bool BfModule::AreSplatsCompatible(BfType* fromType, BfType* toType, bool* outNeedsMemberCasting) |
| 13217 | { |
| 13218 | if ((fromType->IsTypeInstance()) && (!fromType->IsSplattable())) |
| 13219 | return false; |
| 13220 | if ((toType->IsTypeInstance()) && (!toType->IsSplattable())) |
| 13221 | return false; |
| 13222 | |
| 13223 | auto _GetTypes = [&](BfType* type, Array<BfType*>& types) |
| 13224 | { |
| 13225 | BfTypeUtils::SplatIterate([&](BfType* memberType) { types.Add(memberType); }, type); |
| 13226 | }; |
| 13227 | |
| 13228 | Array<BfType*> fromTypes; |
| 13229 | _GetTypes(fromType, fromTypes); |
| 13230 | Array<BfType*> toTypes; |
| 13231 | _GetTypes(toType, toTypes); |
| 13232 | |
| 13233 | if (toTypes.size() > fromTypes.size()) |
| 13234 | return false; |
| 13235 | |
| 13236 | for (int i = 0; i < toTypes.size(); i++) |
| 13237 | { |
| 13238 | BfType* fromMemberType = fromTypes[i]; |
| 13239 | BfType* toMemberType = toTypes[i]; |
| 13240 | |
| 13241 | if (fromMemberType != toMemberType) |
| 13242 | { |
| 13243 | if ((outNeedsMemberCasting != NULL) && |
| 13244 | (fromMemberType->IsIntPtrable()) && (toMemberType->IsIntPtrable())) |
| 13245 | *outNeedsMemberCasting = true; |
| 13246 | else |
| 13247 | return false; |
| 13248 | } |
| 13249 | } |
| 13250 | |
| 13251 | return true; |
| 13252 | } |
| 13253 | |
| 13254 | BfType* BfModule::GetClosestNumericCastType(const BfTypedValue& typedVal, BfType* wantType) |
| 13255 | { |
no test coverage detected