mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Fixed issue where we allowed multiple semicolons at end of if statements
This commit is contained in:
parent
76cb117e1f
commit
2c30afbfcf
4 changed files with 31 additions and 8 deletions
|
@ -738,6 +738,16 @@ bool BfAstNode::IsMissingSemicolon()
|
||||||
{
|
{
|
||||||
if (auto deferStmt = BfNodeDynCast<BfDeferStatement>(this))
|
if (auto deferStmt = BfNodeDynCast<BfDeferStatement>(this))
|
||||||
return BfNodeDynCastExact<BfBlock>(deferStmt->mTargetNode) == NULL;
|
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))
|
if (auto stmt = BfNodeDynCast<BfStatement>(this))
|
||||||
return stmt->mTrailingSemicolon == NULL;
|
return stmt->mTrailingSemicolon == NULL;
|
||||||
|
|
||||||
|
|
|
@ -3891,8 +3891,8 @@ void BfCompiler::ProcessAutocompleteTempType()
|
||||||
if (fieldInstance->mConstIdx != -1)
|
if (fieldInstance->mConstIdx != -1)
|
||||||
{
|
{
|
||||||
auto constant = typeInst->mConstHolder->GetConstantById(fieldInstance->mConstIdx);
|
auto constant = typeInst->mConstHolder->GetConstantById(fieldInstance->mConstIdx);
|
||||||
auto retVal = module->ConstantToCurrent(constant, typeInst->mConstHolder, typeInst);
|
auto retVal = module->ConstantToCurrent(constant, typeInst->mConstHolder, fieldInstance->mResolvedType);
|
||||||
BfTypedValue typedValue = BfTypedValue(retVal, typeInst);
|
BfTypedValue typedValue = BfTypedValue(retVal, fieldInstance->mResolvedType);
|
||||||
autoComplete->CheckResult(fieldDef->GetRefNode(), typedValue);
|
autoComplete->CheckResult(fieldDef->GetRefNode(), typedValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1176,12 +1176,23 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* targetTypeInstance, BfTypeInst
|
||||||
(targetTypeInstance != NULL) && (targetTypeInstance->IsObject()))
|
(targetTypeInstance != NULL) && (targetTypeInstance->IsObject()))
|
||||||
{
|
{
|
||||||
mModule->PopulateType(targetTypeInstance, BfPopulateType_DataAndMethods);
|
mModule->PopulateType(targetTypeInstance, BfPopulateType_DataAndMethods);
|
||||||
BfVirtualMethodEntry& vEntry = targetTypeInstance->mVirtualMethodTable[methodInstance->mVirtualTableIdx];
|
if ((methodInstance->mVirtualTableIdx < targetTypeInstance->mVirtualMethodTable.mSize) && (methodInstance->mVirtualTableIdx >= 0))
|
||||||
auto implMethod = (BfMethodInstance*)vEntry.mImplementingMethod;
|
|
||||||
if (implMethod != methodInstance)
|
|
||||||
{
|
{
|
||||||
SetAndRestoreValue<bool> prevBypassVirtual(mBypassVirtual, true);
|
BfVirtualMethodEntry& vEntry = targetTypeInstance->mVirtualMethodTable[methodInstance->mVirtualTableIdx];
|
||||||
return CheckMethod(targetTypeInstance, implMethod->GetOwner(), implMethod->mMethodDef, isFailurePass);
|
auto implMethod = (BfMethodInstance*)vEntry.mImplementingMethod;
|
||||||
|
if (implMethod != methodInstance)
|
||||||
|
{
|
||||||
|
SetAndRestoreValue<bool> prevBypassVirtual(mBypassVirtual, true);
|
||||||
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3507,7 +3507,9 @@ BF_EXPORT const char* BF_CALLTYPE BfParser_GetDebugExpressionAt(BfParser* bfPars
|
||||||
|
|
||||||
if ((exprNode->IsA<BfMethodDeclaration>()) ||
|
if ((exprNode->IsA<BfMethodDeclaration>()) ||
|
||||||
(exprNode->IsA<BfBlock>()) ||
|
(exprNode->IsA<BfBlock>()) ||
|
||||||
(exprNode->IsA<BfStatement>()))
|
(exprNode->IsA<BfStatement>()) ||
|
||||||
|
(exprNode->IsA<BfTokenNode>())
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue