Parser - Errors when using inputs in initialisation

This commit is contained in:
Emmanuel BENOîT 2017-11-11 16:16:22 +01:00
parent 5d3aa32e9d
commit 773efeff54

View file

@ -685,8 +685,7 @@ bool T_ParserImpl_::checkIdentifierExpressions( ) noexcept
T_StringBuilder esb;
for ( cfi = 0 ; cfi < output->root.nFunctions( ) ; cfi ++ ) {
auto& function( output->root.function( cfi ) );
visitor.visit( function ,
[&]( A_Node& n , const bool exit ) -> bool {
visitor.visit( function , [&]( A_Node& n , const bool exit ) -> bool {
if ( exit ) {
return true;
}
@ -701,6 +700,9 @@ bool T_ParserImpl_::checkIdentifierExpressions( ) noexcept
esb << "'" << e.id( ) << "' used as input but declared as a "
<< *t;
errors.addNew( std::move( esb ) , e.idLocation( ) );
} else if ( callInfo[ cfi ] & E_InstrRestriction::INIT ) {
errors.addNew( "input used in initialisation" ,
e.location( ) );
}
return false;
}