1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Fixed issue where we allowed multiple semicolons at end of if statements

This commit is contained in:
Brian Fiete 2020-03-02 06:25:00 -08:00
parent 76cb117e1f
commit 2c30afbfcf
4 changed files with 31 additions and 8 deletions

View file

@ -738,6 +738,16 @@ bool BfAstNode::IsMissingSemicolon()
{
if (auto deferStmt = BfNodeDynCast<BfDeferStatement>(this))
return BfNodeDynCastExact<BfBlock>(deferStmt->mTargetNode) == NULL;
if (auto stmt = BfNodeDynCast<BfCompoundStatement>(this))
{
if (auto repeatStmt = BfNodeDynCast<BfRepeatStatement>(this))
{
if (repeatStmt->mWhileToken == NULL)
return false;
}
else
return false;
}
if (auto stmt = BfNodeDynCast<BfStatement>(this))
return stmt->mTrailingSemicolon == NULL;

View file

@ -3891,8 +3891,8 @@ void BfCompiler::ProcessAutocompleteTempType()
if (fieldInstance->mConstIdx != -1)
{
auto constant = typeInst->mConstHolder->GetConstantById(fieldInstance->mConstIdx);
auto retVal = module->ConstantToCurrent(constant, typeInst->mConstHolder, typeInst);
BfTypedValue typedValue = BfTypedValue(retVal, typeInst);
auto retVal = module->ConstantToCurrent(constant, typeInst->mConstHolder, fieldInstance->mResolvedType);
BfTypedValue typedValue = BfTypedValue(retVal, fieldInstance->mResolvedType);
autoComplete->CheckResult(fieldDef->GetRefNode(), typedValue);
}
}

View file

@ -1176,6 +1176,8 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* targetTypeInstance, BfTypeInst
(targetTypeInstance != NULL) && (targetTypeInstance->IsObject()))
{
mModule->PopulateType(targetTypeInstance, BfPopulateType_DataAndMethods);
if ((methodInstance->mVirtualTableIdx < targetTypeInstance->mVirtualMethodTable.mSize) && (methodInstance->mVirtualTableIdx >= 0))
{
BfVirtualMethodEntry& vEntry = targetTypeInstance->mVirtualMethodTable[methodInstance->mVirtualTableIdx];
auto implMethod = (BfMethodInstance*)vEntry.mImplementingMethod;
if (implMethod != methodInstance)
@ -1184,6 +1186,15 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* targetTypeInstance, BfTypeInst
return CheckMethod(targetTypeInstance, implMethod->GetOwner(), implMethod->mMethodDef, isFailurePass);
}
}
else
{
// Being in autocomplete mode is the only excuse for not having the virtual method table slotted
if ((!mModule->mCompiler->IsAutocomplete()) && (!targetTypeInstance->mTypeFailed))
{
mModule->AssertErrorState();
}
}
}
HashSet<int> allowEmptyGenericSet;
BfAutoComplete* autoComplete = NULL;

View file

@ -3507,7 +3507,9 @@ BF_EXPORT const char* BF_CALLTYPE BfParser_GetDebugExpressionAt(BfParser* bfPars
if ((exprNode->IsA<BfMethodDeclaration>()) ||
(exprNode->IsA<BfBlock>()) ||
(exprNode->IsA<BfStatement>()))
(exprNode->IsA<BfStatement>()) ||
(exprNode->IsA<BfTokenNode>())
)
{
return NULL;
}