MCPcopy Create free account
hub / github.com/carbonengine/trinity / NewConditionalExpression

Function NewConditionalExpression

shadercompiler/ParserUtils.cpp:1125–1139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1123}
1124
1125ASTNode* NewConditionalExpression( ParserState& state, ASTNode* condition, ASTNode* trueExpr, ASTNode* falseExpr )
1126{
1127 auto expr = state.NewNode( NT_CONDITIONAL_EXPRESSION, ScannerToken::FromTokenType( OP_QUESTION ) );
1128 expr->AddChild( condition );
1129 expr->AddChild( trueExpr );
1130 expr->AddChild( falseExpr );
1131 Type type;
1132 if( !GetCommonType( trueExpr->GetType(), falseExpr->GetType(), type ) )
1133 {
1134 state.ShowMessage( EC_TYPE_MISMATCH );
1135 type.FromTokenType( OP_VOID );
1136 }
1137 expr->SetType( type );
1138 return expr;
1139}
1140
1141ASTNode* NewVarDeclaration( ParserState& state, const Type& type, const InlineString& name )
1142{

Callers

nothing calls this directly

Calls 7

GetCommonTypeFunction · 0.85
NewNodeMethod · 0.80
AddChildMethod · 0.80
ShowMessageMethod · 0.80
GetTypeMethod · 0.45
FromTokenTypeMethod · 0.45
SetTypeMethod · 0.45

Tested by

no test coverage detected