Compiler - Also gather constants from OP_INPUT
This commit is contained in:
parent
e7029af764
commit
673b73c42d
1 changed files with 12 additions and 4 deletions
16
opcomp.cc
16
opcomp.cc
|
@ -156,11 +156,19 @@ void T_CompilerImpl_::gatherConstants( ) noexcept
|
||||||
{
|
{
|
||||||
constants.clear( );
|
constants.clear( );
|
||||||
astVisitor.visit( input->root , [&]( A_Node& node , const bool exit ) {
|
astVisitor.visit( input->root , [&]( A_Node& node , const bool exit ) {
|
||||||
if ( exit && node.type( ) == A_Node::EXPR_CONST ) {
|
if ( exit ) {
|
||||||
T_OpValue value;
|
return true;
|
||||||
value.f = dynamic_cast< T_ConstantExprNode& >( node ).floatValue( );
|
|
||||||
constants.add( value.u );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
return true;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue