1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-11 04:52:21 +02:00

Fixed params in extension methods

This commit is contained in:
Brian Fiete 2020-08-12 11:58:59 -07:00
parent 0fbe15040d
commit a4abd54e7d

View file

@ -5615,6 +5615,10 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
if (!isDirectPass) if (!isDirectPass)
{ {
int numElements = (int)argValues.size() - argIdx;
if (methodDef->mMethodType == BfMethodType_Extension)
numElements++;
if (wantType->IsArray()) if (wantType->IsArray())
{ {
BfArrayType* arrayType = (BfArrayType*)wantType; BfArrayType* arrayType = (BfArrayType*)wantType;
@ -5623,7 +5627,6 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
int arrayClassSize = arrayType->mInstSize - expandedParamsElementType->mSize; int arrayClassSize = arrayType->mInstSize - expandedParamsElementType->mSize;
int numElements = (int)argValues.size() - argIdx;
expandedParamsArray = BfTypedValue(mModule->AllocFromType(arrayType->GetUnderlyingType(), boxScopeData, BfIRValue(), mModule->GetConstValue(numElements), 1, BfAllocFlags_None), expandedParamsArray = BfTypedValue(mModule->AllocFromType(arrayType->GetUnderlyingType(), boxScopeData, BfIRValue(), mModule->GetConstValue(numElements), 1, BfAllocFlags_None),
arrayType, false); arrayType, false);
@ -5649,7 +5652,6 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
} }
else else
{ {
int numElements = (int)argValues.size() - argIdx;
auto genericTypeInst = wantType->ToGenericTypeInstance(); auto genericTypeInst = wantType->ToGenericTypeInstance();
expandedParamsElementType = genericTypeInst->mGenericTypeInfo->mTypeGenericArguments[0]; expandedParamsElementType = genericTypeInst->mGenericTypeInfo->mTypeGenericArguments[0];