Compiler - Also gather constants from OP_INPUT

This commit is contained in:
Emmanuel BENOîT 2017-11-13 18:21:06 +01:00
parent e7029af764
commit 673b73c42d

View file

@ -156,11 +156,19 @@ void T_CompilerImpl_::gatherConstants( ) noexcept
{
constants.clear( );
astVisitor.visit( input->root , [&]( A_Node& node , const bool exit ) {
if ( exit && node.type( ) == A_Node::EXPR_CONST ) {
T_OpValue value;
value.f = dynamic_cast< T_ConstantExprNode& >( node ).floatValue( );
constants.add( value.u );
if ( exit ) {
return true;
}
T_OpValue value;
if ( node.type( ) == A_Node::EXPR_CONST ) {
value.f = dynamic_cast< T_ConstantExprNode& >( node ).floatValue( );
} else if ( node.type( ) == A_Node::OP_INPUT ) {
value.f = dynamic_cast< T_InputInstrNode& >( node ).defValue( );
} else {
return true;
}
constants.add( value.u );
return true;
} );