From 22287b631bf3d20aa49739ca702d3bb1d1ee4361 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Tue, 27 Oct 2015 02:18:01 +0100 Subject: [PATCH] Bugfix: Immediate nodes at end of code bracket shouldn't be forced --- source/astvar.cc | 55 ++++++++++++++++++++----------------------------------- 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/source/astvar.cc b/source/astvar.cc index df5030c7..a710c120 100644 --- a/source/astvar.cc +++ b/source/astvar.cc @@ -324,41 +324,26 @@ Ast::CodeBracket::eval( Kernel::EvalState * evalState, Kernel::Environment * ext void Ast::CodeBracket::evalAt( const RefCountPtr< const Kernel::CodeBracketContInfo > & info, const std::list< Ast::Node * >::const_iterator & pos, Kernel::EvalState * evalState ) const { - Ast::Expression * e = dynamic_cast< Ast::Expression * >( *pos ); - { - std::list< Ast::Node * >::const_iterator next = pos; - ++next; - if( next == nodes_->end( ) ) - { - if( e != 0 && - e->immediate_ ) - { - evalState->cont_ = Kernel::ContRef( new Kernel::ForcingContinuation( info->cont_, (*pos)->loc( ) ) ); - } - else - { - evalState->cont_ = info->cont_; - } - } - else - { - evalState->cont_ = Kernel::ContRef( new Kernel::CodeBracketContinuation( (*pos)->loc( ), info, next ) ); - } - } - evalState->env_ = info->env_; - evalState->dyn_ = info->dyn_; - if( e != 0 ) - { - evalState->expr_ = e; - return; - } - const Ast::BindNode * bn = dynamic_cast< const Ast::BindNode * >( *pos ); - if( bn != 0 ) - { - bn->evalHelper( evalState ); - return; - } - throw Exceptions::InternalError( (*pos)->loc( ), "CodeBracket::evalAt: Node was neither Expression or BindNode." ); + { + std::list< Ast::Node * >::const_iterator next = pos; + ++next; + if( next == nodes_->end( ) ){ + evalState->cont_ = info->cont_; + }else{ + evalState->cont_ = Kernel::ContRef( new Kernel::CodeBracketContinuation( (*pos)->loc( ), info, next ) ); + } + } + evalState->env_ = info->env_; + evalState->dyn_ = info->dyn_; + if( Ast::Expression * e = dynamic_cast< Ast::Expression * >( *pos ) ){ + evalState->expr_ = e; + return; + } + if( const Ast::BindNode * bn = dynamic_cast< const Ast::BindNode * >( *pos ) ){ + bn->evalHelper( evalState ); + return; + } + throw Exceptions::InternalError( (*pos)->loc( ), "CodeBracket::evalAt: Node was neither Expression or BindNode." ); } -- 2.11.4.GIT