MCPcopy Create free account
hub / github.com/beefytech/Beef / VerifyIsStatement

Method VerifyIsStatement

IDEHelper/Compiler/BfAst.cpp:1302–1328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1300//////////////////////////////////////////////////////////////////////////
1301
1302bool BfExpression::VerifyIsStatement(BfPassInstance* passInstance, bool ignoreError)
1303{
1304 if (auto attribExpr = BfNodeDynCast<BfAttributedExpression>(this))
1305 {
1306 return attribExpr->mExpression->VerifyIsStatement(passInstance, ignoreError);
1307 }
1308
1309 if ((!BfNodeIsExact<BfAssignmentExpression>(this)) &&
1310 (!BfNodeIsExact<BfInvocationExpression>(this)) &&
1311 (!BfNodeIsExact<BfObjectCreateExpression>(this)))
1312 {
1313 if (auto castExpr = BfNodeDynCast<BfCastExpression>(this))
1314 {
1315 if ((castExpr->mTypeRef != NULL) && (castExpr->mTypeRef->ToString() == "void"))
1316 {
1317 // Is "(void)variable;" expression, used to remove warning about unused local variables
1318 return false;
1319 }
1320 }
1321
1322 if (!ignoreError)
1323 passInstance->Fail("This expression cannot be used as a statement", this);
1324 //passInstance->Fail("Only assignment, call, increment, decrement, and allocation expressions can be used as a statement", this);
1325 return false;
1326 }
1327 return true;
1328}
1329
1330//////////////////////////////////////////////////////////////////////////
1331

Callers 2

ProcessMethodMethod · 0.80
DoCreateStatementMethod · 0.80

Calls 2

ToStringMethod · 0.45
FailMethod · 0.45

Tested by

no test coverage detected