| 9668 | } |
| 9669 | |
| 9670 | BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExpression* methodBoundExpr, BfTypedValue target, bool allowImplicitThis, bool bypassVirtual, const StringImpl& methodName, |
| 9671 | BfResolvedArgs& argValues, const BfMethodGenericArguments& methodGenericArgs, BfCheckedKind checkedKind) |
| 9672 | { |
| 9673 | BP_ZONE("MatchMethod"); |
| 9674 | |
| 9675 | auto methodGenericArguments = methodGenericArgs.mArguments; |
| 9676 | |
| 9677 | if (bypassVirtual) |
| 9678 | { |
| 9679 | // "bypassVirtual" means that we know for sure that the target is EXACTLY the specified target type, |
| 9680 | // not derived from (or implementing) the target type. This cannot apply to interfaces. |
| 9681 | BF_ASSERT(!target.mType->IsInterface()); |
| 9682 | } |
| 9683 | |
| 9684 | auto origTarget = target; |
| 9685 | if (mFunctionBindResult != NULL) |
| 9686 | { |
| 9687 | BF_ASSERT(!mFunctionBindResult->mOrigTarget); |
| 9688 | mFunctionBindResult->mOrigTarget = origTarget; |
| 9689 | } |
| 9690 | |
| 9691 | if (target) |
| 9692 | { |
| 9693 | if (target.mType->IsConcreteInterfaceType()) |
| 9694 | target.mType = target.mType->GetUnderlyingType(); |
| 9695 | |
| 9696 | // Turn T* into a T, if we can |
| 9697 | if ((target.mType->IsPointer()) && (target.mType->GetUnderlyingType()->IsGenericParam())) |
| 9698 | { |
| 9699 | auto underlyingType = target.mType->GetUnderlyingType(); |
| 9700 | auto genericParam = mModule->GetGenericParamInstance((BfGenericParamType*)underlyingType); |
| 9701 | if (((genericParam->mTypeConstraint != NULL) && (genericParam->mTypeConstraint->IsValueType())) || |
| 9702 | ((genericParam->mGenericParamFlags & (BfGenericParamFlag_Struct)) != 0)) |
| 9703 | { |
| 9704 | target.mType = underlyingType; |
| 9705 | } |
| 9706 | } |
| 9707 | |
| 9708 | if ((!target.mType->IsGenericParam()) && |
| 9709 | ((!target.IsSplat()) || (target.mType->IsWrappableType())) && |
| 9710 | (!IsVar(target.mType))) |
| 9711 | target = MakeCallableTarget(targetSrc, target); |
| 9712 | } |
| 9713 | |
| 9714 | // static int sCallIdx = 0; |
| 9715 | // if (!mModule->mCompiler->mIsResolveOnly) |
| 9716 | // sCallIdx++; |
| 9717 | // int callIdx = sCallIdx; |
| 9718 | // if (callIdx == 118) |
| 9719 | // { |
| 9720 | // NOP; |
| 9721 | // } |
| 9722 | |
| 9723 | bool prevAllowVariableDeclarations = true; |
| 9724 | if (mModule->mCurMethodState != NULL) |
| 9725 | { |
| 9726 | // Don't allow variable declarations in arguments for this method call |
| 9727 | prevAllowVariableDeclarations = mModule->mCurMethodState->mCurScope->mAllowVariableDeclarations; |
no test coverage detected