Skip to content
Snippets Groups Projects
Commit 6ebfaad6 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

abstraction: fix cast noop detection

parent bedf902e
No related branches found
No related tags found
1 merge request!227Merge jt
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
namespace abstraction { namespace abstraction {
   
std::shared_ptr < abstraction::Value > CastHelper::eval ( abstraction::TemporariesHolder & environment, std::shared_ptr < abstraction::Value > param, const core::type_details & type ) { std::shared_ptr < abstraction::Value > CastHelper::eval ( abstraction::TemporariesHolder & environment, std::shared_ptr < abstraction::Value > param, const core::type_details & type ) {
if ( abstraction::Registry::isCastNoOp ( type, param->getActualType ( ) ) ) { if ( abstraction::Registry::isCastNoOp ( param->getActualType ( ), type ) ) {
return param; return param;
} }
   
......
...@@ -70,9 +70,7 @@ std::shared_ptr < abstraction::Value > EvalHelper::evalAbstraction ( abstraction ...@@ -70,9 +70,7 @@ std::shared_ptr < abstraction::Value > EvalHelper::evalAbstraction ( abstraction
unsigned i = 0; unsigned i = 0;
ext::vector < std::shared_ptr < abstraction::Value > > casted_params; ext::vector < std::shared_ptr < abstraction::Value > > casted_params;
for ( std::shared_ptr < abstraction::Value > param : params ) { for ( std::shared_ptr < abstraction::Value > param : params ) {
if ( ! abstraction::Registry::isCastNoOp ( param->getActualType ( ), abstraction->getParamType ( i ) ) ) { param = abstraction::CastHelper::eval ( environment, param, abstraction->getParamType ( i ) );
param = abstraction::CastHelper::eval ( environment, param, abstraction->getParamType ( i ) );
}
   
if ( abstraction::Registry::hasDenormalize ( abstraction->getParamType ( i ) ) && abstraction->getParamType ( i ) != param->getDeclaredType ( ) ) { if ( abstraction::Registry::hasDenormalize ( abstraction->getParamType ( i ) ) && abstraction->getParamType ( i ) != param->getDeclaredType ( ) ) {
std::unique_ptr < abstraction::OperationAbstraction > denormalize = abstraction::Registry::getDenormalizeAbstraction ( abstraction->getParamType ( i ) ); std::unique_ptr < abstraction::OperationAbstraction > denormalize = abstraction::Registry::getDenormalizeAbstraction ( abstraction->getParamType ( i ) );
......
...@@ -24,11 +24,7 @@ std::shared_ptr < abstraction::Value > ContainerStatement::translateAndEval ( co ...@@ -24,11 +24,7 @@ std::shared_ptr < abstraction::Value > ContainerStatement::translateAndEval ( co
int i = 0; int i = 0;
ext::vector < std::shared_ptr < abstraction::Value > > casted_params; ext::vector < std::shared_ptr < abstraction::Value > > casted_params;
for ( const std::shared_ptr < abstraction::Value > & param : params ) { for ( const std::shared_ptr < abstraction::Value > & param : params ) {
if ( abstraction::Registry::isCastNoOp ( algo->getParamType ( i ), param->getDeclaredType ( ) ) ) { casted_params.push_back ( abstraction::CastHelper::eval ( environment, param, algo->getParamType ( i ) ) );
casted_params.push_back ( param );
} else {
casted_params.push_back ( abstraction::CastHelper::eval ( environment, param, algo->getParamType ( i ) ) );
}
++ i; ++ i;
} }
   
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment