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

Fixed method selection when we have append args

This commit is contained in:
Brian Fiete 2020-01-15 08:31:34 -08:00
parent 9d1b85cceb
commit 39b7309dd5
7 changed files with 19 additions and 9 deletions

View file

@ -102,7 +102,7 @@ namespace System
[AllowAppend]
public this(String str, int offset)
{
Debug.Assert(offset <= str.Length);
Debug.Assert((uint)offset <= (uint)str.Length);
let count = str.mLength - offset;
int bufferSize = (count == 0) ? 0 : (count - 1) & ~(sizeof(char8*) - 1);
#unwarn

View file

@ -49,7 +49,7 @@ OtherLinkFlags = ""
TargetDirectory = "$(WorkspaceDir)/dist"
TargetName = "BeefIDE_d2"
OtherLinkFlags = "$(LinkFlags) Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDEHelper64_d.lib BeefySysLib64_d.lib wsock32.lib"
DebugCommandArguments = "-proddir=C:\\Beef\\ide\\mintest"
DebugCommandArguments = "-workspace=c:\\beef\\ide\\mintest"
DebugWorkingDirectory = "$(ProjectDir)\\dist"
EnvironmentVars = ["_NO_DEBUG_HEAP=1"]

View file

@ -49,6 +49,7 @@ struct Blurg
StructA sa = .();
sa.mA = 123
return (int32)123;
}
}

View file

@ -17,11 +17,6 @@ namespace IDE
//System.Collections.Generic.List<System.String> list;
static int32 Main(String[] args)
{
/*if ((var str = scope String()) || (var str2 = scope String()))
{
}*/
//Test.Test();
#if SMALLTEST
Debug.WriteLine("Hey!\n");
#else

View file

@ -1535,8 +1535,8 @@ NoMatch:
if (mBackupMethodDef != NULL)
{
int prevParamDiff = (int)mBackupMethodDef->mParams.size() - (int)mArguments.size();
int paramDiff = (int)checkMethod->mParams.size() - (int)mArguments.size();
int prevParamDiff = (int)mBackupMethodDef->GetExplicitParamCount() - (int)mArguments.size();
int paramDiff = (int)checkMethod->GetExplicitParamCount() - (int)mArguments.size();
if ((prevParamDiff < 0) && (prevParamDiff > paramDiff))
return false;
if ((prevParamDiff >= 0) && ((paramDiff < 0) || (prevParamDiff < paramDiff)))

View file

@ -571,6 +571,19 @@ String BfMethodDef::ToString()
return methodText;
}
int BfMethodDef::GetExplicitParamCount()
{
for (int i = 0; i < (int)mParams.size(); i++)
{
auto param = mParams[i];
if ((param->mParamKind != BfParamKind_AppendIdx) &&
(param->mParamKind != BfParamKind_ImplicitCapture))
return (int)mParams.size() - i;
}
return (int)mParams.size();
}
///
void BfTypeDef::Reset()

View file

@ -772,6 +772,7 @@ public:
bool IsEmptyPartial();
bool IsDefaultCtor();
String ToString();
int GetExplicitParamCount();
};
class BfOperatorDef : public BfMethodDef