1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Fixed auto-prop issues

This commit is contained in:
Brian Fiete 2020-05-08 14:33:28 -07:00
parent a17f8961b0
commit 6ae5d2e7aa
3 changed files with 39 additions and 47 deletions

View file

@ -1382,7 +1382,7 @@ void BfAutoComplete::CheckIdentifier(BfIdentifierNode* identifierNode, bool isIn
"delegate", "delete", "do", "else", "false", "finally", "delegate", "delete", "do", "else", "false", "finally",
"fixed", "for", "function", "if", "implicit", "in", "internal", "is", "new", "mixin", "null", "fixed", "for", "function", "if", "implicit", "in", "internal", "is", "new", "mixin", "null",
"out", "params", "ref", "rettype", "return", "out", "params", "ref", "rettype", "return",
"sealed", "sizeof", "scope", "static", "strideof", "struct", "switch", /*"this",*/ "throw", "try", "true", "typeof", "unchecked", "sealed", "sizeof", "scope", "static", "strideof", "struct", "switch", /*"this",*/ "try", "true", "typeof", "unchecked",
"using", "var", "virtual", "volatile", "where", "while", "using", "var", "virtual", "volatile", "where", "while",
}; };

View file

@ -14227,11 +14227,6 @@ void BfModule::SetupIRMethod(BfMethodInstance* methodInstance, BfIRFunction func
argIdx++; argIdx++;
} }
if (methodDef->mName == "Hello")
{
NOP;
}
while (argIdx < argCount) while (argIdx < argCount)
{ {
while ((paramIdx != -1) && (methodInstance->IsParamSkipped(paramIdx))) while ((paramIdx != -1) && (methodInstance->IsParamSkipped(paramIdx)))
@ -15143,11 +15138,6 @@ void BfModule::EmitGCMarkValue(BfTypedValue markVal, BfModuleMethodInstance mark
if (markVal.mType != methodOwner) if (markVal.mType != methodOwner)
markVal = Cast(NULL, markVal, methodOwner); markVal = Cast(NULL, markVal, methodOwner);
if (markMemberMethodInstance.mMethodInstance->mIdHash == 0x1500000236LL)
{
NOP;
}
exprEvaluator.PushThis(NULL, markVal, markMemberMethodInstance.mMethodInstance, args); exprEvaluator.PushThis(NULL, markVal, markMemberMethodInstance.mMethodInstance, args);
exprEvaluator.CreateCall(markMemberMethodInstance.mMethodInstance, markMemberMethodInstance.mFunc, false, args); exprEvaluator.CreateCall(markMemberMethodInstance.mMethodInstance, markMemberMethodInstance.mFunc, false, args);
} }
@ -17427,33 +17417,7 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup)
skipBody = true; skipBody = true;
skipEndChecks = true; skipEndChecks = true;
} }
else if (HasCompiledOutput()) else
{
if ((methodDef->mName == BF_METHODNAME_MARKMEMBERS) || (methodDef->mName == BF_METHODNAME_MARKMEMBERS_STATIC))
{
if (mCompiler->mOptions.mEnableRealtimeLeakCheck)
{
EmitGCMarkMembers();
}
else if (!mCurTypeInstance->IsObject())
{
}
}
else if (methodDef->mName == BF_METHODNAME_FIND_TLS_MEMBERS)
{
if (mCompiler->mOptions.mEnableRealtimeLeakCheck)
{
EmitGCFindTLSMembers();
}
}
}
}
else if (!skipBody)
{
bool isEmptyBodied = BfNodeDynCast<BfTokenNode>(methodDef->mBody) != NULL;
if (isEmptyBodied) // Generate autoProperty things
{ {
auto propertyDeclaration = methodDef->GetPropertyDeclaration(); auto propertyDeclaration = methodDef->GetPropertyDeclaration();
if ((propertyDeclaration != NULL) && (!typeDef->HasAutoProperty(propertyDeclaration))) if ((propertyDeclaration != NULL) && (!typeDef->HasAutoProperty(propertyDeclaration)))
@ -17509,7 +17473,11 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup)
} }
else if (methodDef->mMethodType == BfMethodType_PropertySetter) else if (methodDef->mMethodType == BfMethodType_PropertySetter)
{ {
if (!mCompiler->IsAutocomplete()) if (!methodDef->mIsMutating)
{
Fail("Auto-setter must be marked as 'mut'", methodDef->GetRefNode(), true);
}
else if (!mCompiler->IsAutocomplete())
{ {
String autoPropName = typeDef->GetAutoPropertyName(propertyDeclaration); String autoPropName = typeDef->GetAutoPropertyName(propertyDeclaration);
BfFieldInstance* fieldInstance = GetFieldByName(mCurTypeInstance, autoPropName); BfFieldInstance* fieldInstance = GetFieldByName(mCurTypeInstance, autoPropName);
@ -17545,7 +17513,31 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup)
} }
} }
} }
else if ((methodDef->mName == BF_METHODNAME_MARKMEMBERS) || (methodDef->mName == BF_METHODNAME_MARKMEMBERS_STATIC))
{
if (mCompiler->mOptions.mEnableRealtimeLeakCheck)
{
if (HasCompiledOutput())
EmitGCMarkMembers();
} }
else if (!mCurTypeInstance->IsObject())
{
}
}
else if (methodDef->mName == BF_METHODNAME_FIND_TLS_MEMBERS)
{
if (mCompiler->mOptions.mEnableRealtimeLeakCheck)
{
if (HasCompiledOutput())
EmitGCFindTLSMembers();
}
}
}
}
else if (!skipBody)
{
bool isEmptyBodied = BfNodeDynCast<BfTokenNode>(methodDef->mBody) != NULL;
if ((!mCurMethodInstance->mReturnType->IsValuelessType()) && (!isEmptyBodied)) if ((!mCurMethodInstance->mReturnType->IsValuelessType()) && (!isEmptyBodied))
{ {

View file

@ -790,7 +790,7 @@ bool BfTypeDef::HasAutoProperty(BfPropertyDeclaration* propertyDeclaration)
for (auto methodDeclaration : propertyDeclaration->mMethods) for (auto methodDeclaration : propertyDeclaration->mMethods)
{ {
if (BfNodeDynCast<BfTokenNode>(methodDeclaration->mBody) != NULL) if (methodDeclaration->mBody == NULL)
return true; return true;
} }
return false; return false;