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

Function EvaluateIntegerExpression

shadercompiler/FXAnalyzer.cpp:1771–1788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1769}
1770
1771int EvaluateIntegerExpression( ParserState& state, ASTNode* node, int defaultValue )
1772{
1773 Type type;
1774 ExpressionValue value;
1775 if( !EvaluateExpression( state, node, type, value, nullptr ) )
1776 {
1777 return defaultValue;
1778 }
1779
1780 Type newType;
1781 newType.FromTokenType( OP_INT );
1782 if( !CastExpressionValue( value, type, newType ) )
1783 {
1784 state.ShowMessage( node->GetToken()->fileLocation, EC_INVALID_IMPLICIT_CAST );
1785 return defaultValue;
1786 }
1787 return int( value[0].intValue );
1788}
1789
1790
1791std::optional<RtShaderType> ParseRtShaderName( const InlineString& name )

Callers

nothing calls this directly

Calls 5

EvaluateExpressionFunction · 0.85
CastExpressionValueFunction · 0.85
ShowMessageMethod · 0.80
GetTokenMethod · 0.80
FromTokenTypeMethod · 0.45

Tested by

no test coverage detected