| 4417 | } |
| 4418 | |
| 4419 | bool BfResolvedTypeSet::Equals(BfType* lhs, BfType* rhs, LookupContext* ctx) |
| 4420 | { |
| 4421 | if (lhs->IsBoxed()) |
| 4422 | { |
| 4423 | if (!rhs->IsBoxed()) |
| 4424 | return false; |
| 4425 | BfBoxedType* lhsBoxedType = (BfBoxedType*)lhs; |
| 4426 | BfBoxedType* rhsBoxedType = (BfBoxedType*)rhs; |
| 4427 | if (lhsBoxedType->mBoxedFlags != rhsBoxedType->mBoxedFlags) |
| 4428 | return false; |
| 4429 | return lhsBoxedType->mElementType == rhsBoxedType->mElementType; |
| 4430 | } |
| 4431 | else if (lhs->IsArray()) |
| 4432 | { |
| 4433 | if (!rhs->IsArray()) |
| 4434 | return false; |
| 4435 | BfArrayType* lhsArrayType = (BfArrayType*) lhs; |
| 4436 | BfArrayType* rhsArrayType = (BfArrayType*) rhs; |
| 4437 | if (lhsArrayType->mDimensions != rhsArrayType->mDimensions) |
| 4438 | return false; |
| 4439 | return lhsArrayType->mGenericTypeInfo->mTypeGenericArguments[0] == rhsArrayType->mGenericTypeInfo->mTypeGenericArguments[0]; |
| 4440 | } |
| 4441 | else if (lhs->IsTypeInstance()) |
| 4442 | { |
| 4443 | if ((!rhs->IsTypeInstance()) || (rhs->IsBoxed())) |
| 4444 | return false; |
| 4445 | BfTypeInstance* lhsInst = (BfTypeInstance*)lhs; |
| 4446 | BfTypeInstance* rhsInst = (BfTypeInstance*)rhs; |
| 4447 | |
| 4448 | if (lhs->IsClosure()) |
| 4449 | { |
| 4450 | if (!rhs->IsClosure()) |
| 4451 | return false; |
| 4452 | auto lhsClosure = (BfClosureType*)lhs; |
| 4453 | auto rhsClosure = (BfClosureType*)rhs; |
| 4454 | if ((lhsClosure->mIsUnique) || (rhsClosure->mIsUnique)) |
| 4455 | return false; |
| 4456 | if (lhsClosure->mBaseType != rhsClosure->mBaseType) |
| 4457 | return false; |
| 4458 | return lhsClosure->mClosureHash == rhsClosure->mClosureHash; |
| 4459 | } |
| 4460 | |
| 4461 | if (lhs->IsDelegateFromTypeRef() || lhs->IsFunctionFromTypeRef()) |
| 4462 | { |
| 4463 | if (!rhs->IsDelegateFromTypeRef() && !rhs->IsFunctionFromTypeRef()) |
| 4464 | return false; |
| 4465 | if (lhs->IsDelegate() != rhs->IsDelegate()) |
| 4466 | return false; |
| 4467 | BfDelegateInfo* lhsDelegateInfo = lhs->GetDelegateInfo(); |
| 4468 | BfDelegateInfo* rhsDelegateInfo = rhs->GetDelegateInfo(); |
| 4469 | if (lhsInst->mTypeDef->mIsDelegate != rhsInst->mTypeDef->mIsDelegate) |
| 4470 | return false; |
| 4471 | if (lhsDelegateInfo->mCallingConvention != rhsDelegateInfo->mCallingConvention) |
| 4472 | return false; |
| 4473 | if (lhsDelegateInfo->mHasParams != rhsDelegateInfo->mHasParams) |
| 4474 | return false; |
| 4475 | if (lhsDelegateInfo->mHasVarArgs != rhsDelegateInfo->mHasVarArgs) |
| 4476 | return false; |
no test coverage detected