11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
-
+
|
{
void SetupIfStmt( Env& e )
{
auto handleIf = []( Parser& p, uint32_t locationId, uint32_t prec )
{
auto& dm = DiagnosticsManager::GetInstance();
if( p.isInParenExpr() )
if( p.isInParenExpr() || !p.cfg() )
{
dm.emitSyntaxErrorMessage( locationId, "the if statement is not allowed here.", 0 );
return false;
}
auto pPrecBB = p.currentBB();
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
+
+
+
|
case ValUnifyError::Ambiguous:
dm.emitSyntaxErrorMessage( condVal->locationId(), "ambiguous if condition bool conversion." );
break;
}
return false;
}
if( get< Value >( converted ).isPoison() )
p.cfg()->poison();
auto pThenBB = ParseSubStatement( p, precedence::IfStmt );
if( !pThenBB )
{
dm.emitSyntaxErrorMessage( p.resolver()->getCurrentLocation(), "expected a statement after the if condition.", 0 );
return false;
}
|