1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008, 2013, 2014 Henrik Tidefelt
19 #include "Shapes_Helpers_decls.h"
22 #include "astfun_impl.h"
23 #include "shapesexceptions.h"
24 #include "shapescore.h"
27 #include "continuations.h"
29 #include "astvalues.h"
30 #include "texlabelmanager.h"
34 using namespace Shapes
;
38 Kernel::Formals::Formals( )
39 : loc_( Ast::THE_UNKNOWN_LOCATION
, bool( ) ),
40 seenDefault_( false ), argumentOrder_( new std::map
< const char *, size_t, charPtrLess
> ),
42 stateOrder_( new std::map
< const char *, size_t, charPtrLess
> )
45 Kernel::Formals::Formals( size_t numberOfDummyDefaultExprs
)
46 : loc_( Ast::THE_UNKNOWN_LOCATION
, bool( ) ),
47 seenDefault_( false ), argumentOrder_( new std::map
< const char *, size_t, charPtrLess
> ),
49 stateOrder_( new std::map
< const char *, size_t, charPtrLess
> )
51 // Pushing null expressions is just a way of specifying how many non-sink arguments there are.
52 for( size_t i
= 0; i
< numberOfDummyDefaultExprs
; ++i
)
54 defaultExprs_
.push_back( 0 );
58 Kernel::Formals::~Formals( )
60 delete argumentOrder_
;
69 Kernel::Formals::setLoc( const Ast::SourceLocation
& loc
)
76 Kernel::Formals::push_exprs( Ast::ArgListExprs
* args
) const
78 typedef typeof defaultExprs_ ListType
;
79 for( ListType::const_iterator i
= defaultExprs_
.begin( ); i
!= defaultExprs_
.end( ); ++i
)
83 args
->orderedExprs_
->push_back( *i
);
88 Kernel::EvaluatedFormals
*
89 Kernel::Formals::newEvaluatedFormals( Kernel::Arguments
& args
) const
92 return newEvaluatedFormals( args
, & pos
);
95 Kernel::EvaluatedFormals
*
96 Kernel::Formals::newEvaluatedFormals( Kernel::Arguments
& args
, size_t * pos
) const
98 Kernel::EvaluatedFormals
* res
= new Kernel::EvaluatedFormals( const_cast< Kernel::Formals
* >( this ) );
99 res
->isSink_
= false; // The formals created here belong to user functions, which are exactly those which are not sinks.
101 res
->defaults_
.reserve( defaultExprs_
.size( ) );
102 res
->locations_
.reserve( defaultExprs_
.size( ) );
104 typedef typeof defaultExprs_ ListType
;
105 for( ListType::const_iterator i
= defaultExprs_
.begin( ); i
!= defaultExprs_
.end( ); ++i
)
109 res
->defaults_
.push_back( args
.getHandle( *pos
) );
110 res
->locations_
.push_back( args
.getNode( *pos
) );
115 res
->defaults_
.push_back( Kernel::THE_SLOT_VARIABLE
);
116 res
->locations_
.push_back( 0 ); // I really hope this is never dereferenced!
123 std::vector
< bool > *
124 Kernel::Formals::newArgListForcePos( const Ast::ArgListExprs
* argList
) const
126 /* Here, we use the knowledge that ordered arguments are evaluated backwards, and named arguments
127 * in the natural order (the lexiographic order of std::map).
130 std::vector
< bool > * res
= new std::vector
< bool >;
131 res
->resize( argList
->orderedExprs_
->size( ) );
132 res
->reserve( argList
->orderedExprs_
->size( ) + argList
->namedExprs_
->size( ) );
134 if( ! argList
->orderedExprs_
->empty( ) )
136 typedef typeof forcePos_ SrcType
;
137 SrcType::const_iterator src
= forcePos_
.begin( );
138 for( size_t arg
= argList
->orderedExprs_
->size( ) - 1; ; --arg
, ++src
)
140 (*res
)[ arg
] = *src
;
149 typedef typeof *argList
->namedExprs_ MapType
;
150 MapType::const_iterator end
= argList
->namedExprs_
->end( );
151 for( MapType::const_iterator arg
= argList
->namedExprs_
->begin( ); arg
!= end
; ++arg
)
153 res
->push_back( forcePos_
[ (*argumentOrder_
)[ arg
->first
] ] );
160 std::vector
< bool > *
161 Kernel::Formals::newArgListForcePos( const Ast::ArgListExprs
* argList
, const Kernel::Arguments
& curryArgs
) const
163 /* Compare with the non-curry version!
166 std::vector
< bool > * res
= new std::vector
< bool >;
167 res
->resize( argList
->orderedExprs_
->size( ) );
168 res
->reserve( argList
->orderedExprs_
->size( ) + argList
->namedExprs_
->size( ) );
170 if( ! argList
->orderedExprs_
->empty( ) )
172 typedef typeof forcePos_ SrcType
;
173 SrcType::const_iterator src
= forcePos_
.begin( );
175 while( curryPos
< curryArgs
.size( ) &&
176 ! curryArgs
.isSlot( curryPos
) )
181 for( size_t arg
= argList
->orderedExprs_
->size( ) - 1; ; --arg
)
183 (*res
)[ arg
] = *src
;
190 while( curryPos
< curryArgs
.size( ) &&
191 ! curryArgs
.isSlot( curryPos
) )
200 typedef typeof *argList
->namedExprs_ MapType
;
201 MapType::const_iterator end
= argList
->namedExprs_
->end( );
202 for( MapType::const_iterator arg
= argList
->namedExprs_
->begin( ); arg
!= end
; ++arg
)
204 res
->push_back( forcePos_
[ (*argumentOrder_
)[ arg
->first
] ] );
211 const Ast::SourceLocation
&
212 Kernel::Formals::loc( ) const
219 Ast::ArgListExprs::ConstIterator::ConstIterator( std::list
< Ast::Expression
* >::const_reverse_iterator i1
, std::map
< const char *, Ast::Expression
*, charPtrLess
>::const_iterator i2
, const size_t & index
)
220 : i1_( i1
), i2_( i2
), index_( index
)
223 Ast::ArgListExprs::ConstIterator::ConstIterator( const Ast::ArgListExprs::ConstIterator
& orig
)
224 : i1_( orig
.i1_
), i2_( orig
.i2_
), index_( orig
.index_
)
227 Ast::ArgListExprs::ArgListExprs( bool exprOwner
)
228 : exprOwner_( exprOwner
), firstOrderedStateOwner_( exprOwner
), orderedExprs_( new std::list
< Ast::Expression
* > ), namedExprs_( new std::map
< const char *, Ast::Expression
*, charPtrLess
> ),
229 orderedStates_( new std::list
< Ast::StateReference
* > ), namedStates_( new std::map
< const char *, Ast::StateReference
*, charPtrLess
> )
232 Ast::ArgListExprs::ArgListExprs( bool exprOwner
, bool firstOrderedStateOwner
)
233 : exprOwner_( exprOwner
), firstOrderedStateOwner_( firstOrderedStateOwner
), orderedExprs_( new std::list
< Ast::Expression
* > ), namedExprs_( new std::map
< const char *, Ast::Expression
*, charPtrLess
> ),
234 orderedStates_( new std::list
< Ast::StateReference
* > ), namedStates_( new std::map
< const char *, Ast::StateReference
*, charPtrLess
> )
238 Ast::ArgListExprs::ArgListExprs( std::list
< Ast::Expression
* > * orderedExprs
, std::map
< const char *, Ast::Expression
*, charPtrLess
> * namedExprs
, std::list
< Ast::StateReference
* > * orderedStates
, std::map
< const char *, Ast::StateReference
*, charPtrLess
> * namedStates
)
239 : exprOwner_( true ), firstOrderedStateOwner_( true ), orderedExprs_( orderedExprs
), namedExprs_( namedExprs
), orderedStates_( orderedStates
), namedStates_( namedStates
)
242 Ast::ArgListExprs::~ArgListExprs( )
247 typedef list
< Ast::Expression
* >::iterator I
;
248 for( I i
= orderedExprs_
->begin( ); i
!= orderedExprs_
->end( ); ++i
)
253 delete orderedExprs_
;
259 typedef std::map
< const char *, Ast::Expression
*, charPtrLess
>::const_iterator I
;
260 for( I i
= namedExprs_
->begin( ); i
!= namedExprs_
->end( ); ++i
)
272 typedef std::list
< Ast::StateReference
* >::iterator I
;
273 I i
= orderedStates_
->begin( );
274 if( i
!= orderedStates_
->end( ) ){
275 if( firstOrderedStateOwner_
){
278 for( ++i
; i
!= orderedStates_
->end( ); ++i
)
284 delete orderedStates_
;
290 typedef std::map
< const char *, Ast::StateReference
*, charPtrLess
>::const_iterator I
;
291 for( I i
= namedStates_
->begin( ); i
!= namedStates_
->end( ); ++i
)
301 Ast::ArgListExprs::ArgListExprs( size_t numberOfOrderedDummyExprs
)
302 : exprOwner_( true ), firstOrderedStateOwner_( true ), orderedExprs_( new std::list
< Ast::Expression
* > ), namedExprs_( new std::map
< const char *, Ast::Expression
*, charPtrLess
> ), orderedStates_( new typeof *orderedStates_
), namedStates_( new typeof *namedStates_
)
304 for( size_t i
= 0; i
< numberOfOrderedDummyExprs
; ++i
)
306 orderedExprs_
->push_back( new Ast::DummyExpression
);
311 Ast::ArgListExprs::evaluate( const RefCountPtr
< const Kernel::CallContInfo
> & info
, const Ast::ArgListExprs::ConstIterator
& pos
, const RefCountPtr
< const Lang::SingleList
> & vals
, Kernel::EvalState
* evalState
) const
313 std::list
< Ast::Expression
* >::const_reverse_iterator i1end
= orderedExprs_
->rend( );
315 if( pos
.i1_
== i1end
&&
316 pos
.i2_
== namedExprs_
->end( ) )
318 evalState
->cont_
= info
->cont_
;
319 info
->cont_
->takeValue( vals
, evalState
);
323 if( pos
.i1_
!= i1end
)
325 /* Note that it is necessary that the evaluation of expressions with free states is not delayed.
326 * If it would, it would be very strange for the calling function if a passed state would change
327 * value in response to the accessing of a formal parameter.
329 bool force
= info
->force( pos
.index_
);
330 if( force
|| (*(pos
.i1_
))->immediate_
)
332 typedef typeof const_cast< Ast::ArgListExprs::ConstIterator
& >( pos
).i1_ Iterator
;
333 Iterator next
= pos
.i1_
;
335 evalState
->expr_
= *(pos
.i1_
);
336 evalState
->env_
= info
->env_
;
337 evalState
->dyn_
= info
->dyn_
;
338 evalState
->cont_
= Kernel::ContRef( new Kernel::CallCont_n( evalState
->expr_
->loc( ),
340 Ast::ArgListExprs::ConstIterator( next
, pos
.i2_
, pos
.index_
+ 1 ),
347 /* Delay evaluation of this argument by just putting a thunk in the list.
349 typedef typeof const_cast< Ast::ArgListExprs::ConstIterator
& >( pos
).i1_ Iterator
;
350 Iterator next
= pos
.i1_
;
353 Ast::ArgListExprs::ConstIterator( next
, pos
.i2_
, pos
.index_
+ 1 ),
354 RefCountPtr
< const Lang::SingleListPair
>( new Lang::SingleListPair( Kernel::VariableHandle( new Kernel::Variable( new Kernel::Thunk( info
->env_
, info
->dyn_
, *pos
.i1_
) ) ),
357 return; /* It is not really important that the above compiles to a tail call. Hopefully, it does, but otherwise it is easy to see that the chain of recursive calls to this function
358 * will always completes without evaluation of expressions. */
363 bool force
= info
->force( pos
.index_
);
364 if( force
|| pos
.i2_
->second
->immediate_
)
366 typedef typeof const_cast< Ast::ArgListExprs::ConstIterator
& >( pos
).i2_ Iterator
;
367 Iterator next
= pos
.i2_
;
369 evalState
->expr_
= pos
.i2_
->second
;
370 evalState
->env_
= info
->env_
;
371 evalState
->dyn_
= info
->dyn_
;
372 evalState
->cont_
= Kernel::ContRef( new Kernel::CallCont_n( evalState
->expr_
->loc( ),
374 Ast::ArgListExprs::ConstIterator( pos
.i1_
, next
, pos
.index_
+ 1 ),
381 /* Delay evaluation of this argument by just putting a thunk in the list.
383 typedef typeof const_cast< Ast::ArgListExprs::ConstIterator
& >( pos
).i2_ Iterator
;
384 Iterator next
= pos
.i2_
;
387 Ast::ArgListExprs::ConstIterator( pos
.i1_
, next
, pos
.index_
+ 1 ),
388 RefCountPtr
< const Lang::SingleListPair
>( new Lang::SingleListPair( Kernel::VariableHandle( new Kernel::Variable( new Kernel::Thunk( info
->env_
, info
->dyn_
, pos
.i2_
->second
) ) ),
391 return; /* It is not really important that the above compiles to a tail call. Hopefully, it does, but otherwise it is easy to see that the chain of recursive calls to this function
392 * will always complete without evaluation of expressions. */
398 Ast::ArgListExprs::evaluate_Structure( const RefCountPtr
< const Kernel::CallContInfo
> & info
, size_t pos
, const RefCountPtr
< const Lang::SingleList
> & values
, Kernel::EvalState
* evalState
) const
400 const Lang::SingleListPair
* valuesPtr
= dynamic_cast< const Lang::SingleListPair
* >( values
.getPtr( ) );
401 if( valuesPtr
== NULL
){
402 /* Finished, let the waiting CallCont_Structure_last do the rest. */
403 evalState
->cont_
= info
->cont_
;
404 info
->cont_
->takeValue( Lang::THE_VOID
, /* The continuation already has all values; Lang::THE_VOID is just a dummy. */
409 Kernel::VariableHandle first
= valuesPtr
->car_
;
411 if( info
->force( pos
) && first
->isThunk( ) )
413 evalState
->env_
= info
->env_
;
414 evalState
->dyn_
= info
->dyn_
;
415 evalState
->cont_
= Kernel::ContRef( new Kernel::CallCont_Structure_n
416 ( evalState
->expr_
->loc( ),
420 first
->force( first
, evalState
);
425 evaluate_Structure( info
, pos
- 1, valuesPtr
->cdr_
, evalState
);
431 Ast::ArgListExprs::bind( Kernel::Arguments
* dst
, RefCountPtr
< const Lang::SingleList
> vals
, Kernel::PassedEnv env
, Kernel::PassedDyn dyn
) const
433 typedef const Lang::SingleListPair ConsType
;
435 /* Note that the arguments are bound in backwards-order, since that is how the values are accessed.
439 typedef std::map
< const char *, Ast::Expression
*, charPtrLess
>::const_reverse_iterator I
;
440 I i
= namedExprs_
->rbegin( );
441 I end
= namedExprs_
->rend( );
442 for( ; i
!= end
; ++i
)
444 RefCountPtr
< ConsType
> lst
= vals
.down_cast
< ConsType
>( );
445 if( lst
== NullPtr
< ConsType
>( ) )
447 throw Exceptions::InternalError( strrefdup( "Out of argument values when binding application." ) );
449 dst
->addNamedArgument( i
->first
, lst
->car_
, i
->second
);
455 typedef list
< Ast::Expression
* >::const_iterator I
;
456 I i
= orderedExprs_
->begin( );
457 I end
= orderedExprs_
->end( );
458 for( ; i
!= end
; ++i
)
460 RefCountPtr
< ConsType
> lst
= vals
.down_cast
< ConsType
>( );
461 if( lst
== NullPtr
< ConsType
>( ) )
463 throw Exceptions::InternalError( strrefdup( "Out of argument values when binding application." ) );
465 dst
->addOrderedArgument( lst
->car_
, *i
);
470 /* Here, it could/should be verified that vals is null. However, it only isn't in case of an internal error...
473 /* Next, we turn to the states. The states need no evaluation, as they are always passed by reference.
477 typedef std::map
< const char *, Ast::StateReference
*, charPtrLess
>::const_iterator I
;
478 I i
= namedStates_
->begin( );
479 I end
= namedStates_
->end( );
480 for( ; i
!= end
; ++i
)
482 dst
->addNamedState( i
->first
, i
->second
->getHandle( env
, dyn
) , i
->second
);
487 typedef list
< Ast::StateReference
* >::const_iterator I
;
488 I i
= orderedStates_
->begin( );
489 I end
= orderedStates_
->end( );
490 for( ; i
!= end
; ++i
)
492 dst
->addOrderedState( (*i
)->getHandle( env
, dyn
), *i
);
499 Kernel::VariableHandle
500 Ast::ArgListExprs::findNamed( RefCountPtr
< const Lang::SingleList
> vals
, const char * name
) const
502 /* This function is called when a Lang::Structure is asked for a field by name.
503 * This is reflected in the generated error in case the name is not found.
506 typedef const Lang::SingleListPair ConsType
;
508 /* Note that the arguments are bound in backwards-order, since that is how the values are accessed.
511 typedef std::map
< const char *, Ast::Expression
*, charPtrLess
>::const_reverse_iterator I
;
512 I i
= namedExprs_
->rbegin( );
513 I end
= namedExprs_
->rend( );
514 for( ; i
!= end
; ++i
)
516 RefCountPtr
< ConsType
> lst
= vals
.down_cast
< ConsType
>( );
517 if( lst
== NullPtr
< ConsType
>( ) )
519 throw Exceptions::InternalError( strrefdup( "Out of argument values when searching fields." ) );
521 if( strcmp( i
->first
, name
) == 0 )
528 throw Exceptions::NonExistentMember( strrefdup( "< user union >" ), name
);
531 Kernel::VariableHandle
532 Ast::ArgListExprs::getOrdered( RefCountPtr
< const Lang::SingleList
> vals
, size_t pos
) const
534 /* This function is called when a Lang::Structure is asked for a field by position.
535 * This is reflected in the generated error in case the position is not found.
538 typedef const Lang::SingleListPair ConsType
;
540 /* Note that the arguments are bound in backwards-order, since that is how the values are accessed.
545 typedef list
< Ast::Expression
* >::const_iterator I
;
548 RefCountPtr
< ConsType
> lst
= vals
.down_cast
< ConsType
>( );
549 if( lst
== NullPtr
< ConsType
>( ) )
562 throw Exceptions::NonExistentPosition( pos
, i
- 1 );
566 Ast::ArgListExprs::analyze( Ast::Node
* parent
, Ast::AnalysisEnvironment
* env
, Ast::StateIDSet
* freeStatesDst
)
570 RefCountPtr
< Ast::StateIDSet
> passedStates( new Ast::StateIDSet
);
572 /* First traverse state arguments, so that we know which states that must not appear in the value arguments.
575 typedef typeof *orderedStates_ ListType
;
576 for( ListType::iterator i
= orderedStates_
->begin( ); i
!= orderedStates_
->end( ); ++i
)
578 (*i
)->analyze( parent_
, env
, passedStates
.getPtr( ) );
582 typedef typeof *namedStates_ ListType
;
583 for( ListType::iterator i
= namedStates_
->begin( ); i
!= namedStates_
->end( ); ++i
)
585 i
->second
->analyze( parent_
, env
, passedStates
.getPtr( ) );
588 if( passedStates
->size( ) < orderedStates_
->size( ) + namedStates_
->size( ) )
590 Ast::theAnalysisErrorsList
.push_back( new Exceptions::RepeatedStateArgument( parent_
->loc( ), passedStates
) );
596 typedef typeof *orderedExprs_ ListType
;
597 for( ListType::iterator i
= orderedExprs_
->begin( ); i
!= orderedExprs_
->end( ); ++i
)
599 if( (*i
)->immediate_
)
601 (*i
)->analyze( parent_
, env
, freeStatesDst
);
605 Ast::StateIDSet freeStates
;
606 (*i
)->analyze( parent_
, env
, & freeStates
);
607 for( Ast::StateIDSet::const_iterator j
= freeStates
.begin( ); j
!= freeStates
.end( ); ++j
)
609 if( passedStates
->find( *j
) != passedStates
->end( ) )
611 Ast::theAnalysisErrorsList
.push_back( new Exceptions::FreeStateIsAlsoPassed( (*i
)->loc( ), *j
) );
613 freeStatesDst
->insert( *j
);
619 typedef typeof *namedExprs_ ListType
;
620 for( ListType::iterator i
= namedExprs_
->begin( ); i
!= namedExprs_
->end( ); ++i
)
622 if( i
->second
->immediate_
)
624 i
->second
->analyze( parent_
, env
, freeStatesDst
);
628 Ast::StateIDSet freeStates
;
629 i
->second
->analyze( parent_
, env
, & freeStates
);
630 for( Ast::StateIDSet::const_iterator j
= freeStates
.begin( ); j
!= freeStates
.end( ); ++j
)
632 if( passedStates
->find( *j
) != passedStates
->end( ) )
634 Ast::theAnalysisErrorsList
.push_back( new Exceptions::FreeStateIsAlsoPassed( i
->second
->loc( ), *j
) );
636 freeStatesDst
->insert( *j
);
643 for( Ast::StateIDSet::const_iterator i
= passedStates
->begin( ); i
!= passedStates
->end( ); ++i
)
645 freeStatesDst
->insert( *i
);
650 Ast::ArgListExprs::ConstIterator
651 Ast::ArgListExprs::begin( ) const
653 return Ast::ArgListExprs::ConstIterator( orderedExprs_
->rbegin( ), namedExprs_
->begin( ), 0 );
657 Ast::FunctionFunction::FunctionFunction( const Ast::SourceLocation
& loc
, const Kernel::Formals
* formals
, Ast::Expression
* body
, const Ast::FunctionMode
& functionMode
)
658 : Lang::Function( new Kernel::EvaluatedFormals( Ast::FileID::build_internal( "< function construction >" ), false ) ), loc_( loc
, bool( ) ), formals_( formals
), body_( body
), functionMode_( functionMode
)
661 Ast::FunctionFunction::~FunctionFunction( )
668 Ast::FunctionFunction::push_exprs( Ast::ArgListExprs
* args
) const
670 formals_
->push_exprs( args
);
674 Ast::FunctionFunction::analyze_impl( Ast::Node
* parent
, Ast::AnalysisEnvironment
* parentEnv
, Ast::StateIDSet
* freeStatesDst
)
676 Ast::AnalysisEnvironment
* env( new Ast::AnalysisEnvironment( Ast::theAnalysisEnvironmentList
, parentEnv
, formals_
->argumentOrder_
, formals_
->stateOrder_
) );
677 env
->activateFunctionBoundary( );
679 /* We know that the body does not access states outside the function's scope, so we can simply
680 * leave freeStatesDst without change.
682 Ast::StateIDSet freeStates
;
683 body_
->analyze( parent
, env
, & freeStates
);
687 Ast::FunctionFunction::call( Kernel::EvalState
* evalState
, Kernel::Arguments
& args
, const Ast::SourceLocation
& callLoc
) const
689 Kernel::ContRef cont
= evalState
->cont_
;
690 cont
->takeValue( Kernel::ValueRef( new Lang::UserFunction( formals_
->newEvaluatedFormals( args
),
691 body_
, evalState
->env_
, functionMode_
) ),
696 Kernel::CallCont_last::CallCont_last( const RefCountPtr
< const Lang::Function
> & fun
, const Ast::ArgListExprs
* argList
, bool curry
, Kernel::StateHandle mutatorSelf
, const Kernel::PassedEnv
& env
, const Kernel::PassedDyn
& dyn
, const Kernel::ContRef
& cont
, const Ast::SourceLocation
& callLoc
)
697 : Kernel::Continuation( callLoc
), fun_( fun
), argList_( argList
), curry_( curry
), mutatorSelf_( mutatorSelf
), env_( env
), dyn_( dyn
), cont_( cont
)
700 Kernel::CallCont_last::~CallCont_last( )
704 Kernel::CallCont_last::takeValue( const RefCountPtr
< const Lang::Value
> & valsUntyped
, Kernel::EvalState
* evalState
, bool dummy
) const
706 typedef const Lang::SingleList ArgType
;
707 RefCountPtr
< ArgType
> vals
= Helpers::down_cast
< ArgType
>( valsUntyped
, "< Internal error situation in CallCont_last >" );
709 Kernel::Arguments args
= fun_
->newCurriedArguments( );
710 argList_
->bind( & args
, vals
, env_
, dyn_
);
711 if( mutatorSelf_
!= 0 )
713 args
.setMutatorSelf( mutatorSelf_
);
718 evalState
->cont_
= cont_
;
719 cont_
->takeValue( Kernel::ValueRef( new Lang::CuteFunction( fun_
, args
) ), evalState
);
723 evalState
->env_
= env_
; /* This matters only when the function being called is FunctionFunction! */
724 evalState
->dyn_
= dyn_
;
725 evalState
->cont_
= cont_
;
726 fun_
->call( evalState
, args
, traceLoc_
);
731 Kernel::CallCont_last::up( ) const
736 RefCountPtr
< const char >
737 Kernel::CallCont_last::description( ) const
739 return strrefdup( "function call's application" );
743 Kernel::CallCont_last::gcMark( Kernel::GCMarkedSet
& marked
)
745 const_cast< Lang::Function
* >( fun_
.getPtr( ) )->gcMark( marked
);
746 dyn_
->gcMark( marked
);
747 cont_
->gcMark( marked
);
751 Kernel::CallCont_Structure_last::CallCont_Structure_last( const RefCountPtr
< const Lang::Function
> & fun
, const Ast::ArgListExprs
* argList
, const RefCountPtr
< const Lang::SingleList
> & values
, bool curry
, const Kernel::PassedEnv
& env
, const Kernel::PassedDyn
& dyn
, const Kernel::ContRef
& cont
, const Ast::SourceLocation
& callLoc
)
752 : Kernel::Continuation( callLoc
), fun_( fun
), argList_( argList
), values_( values
), curry_( curry
), env_( env
), dyn_( dyn
), cont_( cont
)
755 Kernel::CallCont_Structure_last::~CallCont_Structure_last( )
759 Kernel::CallCont_Structure_last::takeValue( const RefCountPtr
< const Lang::Value
> & valDummy
, Kernel::EvalState
* evalState
, bool dummy
) const
761 Kernel::Arguments args
= fun_
->newCurriedArguments( );
762 argList_
->bind( & args
, values_
, env_
, dyn_
);
766 evalState
->cont_
= cont_
;
767 cont_
->takeValue( Kernel::ValueRef( new Lang::CuteFunction( fun_
, args
) ), evalState
);
771 evalState
->env_
= env_
; /* This matters only when the function being called is FunctionFunction! */
772 evalState
->dyn_
= dyn_
;
773 evalState
->cont_
= cont_
;
774 fun_
->call( evalState
, args
, traceLoc_
);
779 Kernel::CallCont_Structure_last::up( ) const
784 RefCountPtr
< const char >
785 Kernel::CallCont_Structure_last::description( ) const
787 return strrefdup( "split structure application" );
791 Kernel::CallCont_Structure_last::gcMark( Kernel::GCMarkedSet
& marked
)
793 const_cast< Lang::Function
* >( fun_
.getPtr( ) )->gcMark( marked
);
794 const_cast< Lang::SingleList
* >( values_
.getPtr( ) )->gcMark( marked
);
795 dyn_
->gcMark( marked
);
796 cont_
->gcMark( marked
);
800 Kernel::CallContInfo::CallContInfo( const Ast::ArgListExprs
* argList
, const Kernel::EvalState
& evalState
, std::vector
< bool > * forcePos
)
801 : forcePos_( forcePos
), forceAll_( false ), argList_( argList
), env_( evalState
.env_
), dyn_( evalState
.dyn_
), cont_( evalState
.cont_
)
804 Kernel::CallContInfo::CallContInfo( const Ast::ArgListExprs
* argList
, const Kernel::EvalState
& evalState
, bool forceAll
)
805 : forcePos_( 0 ), forceAll_( forceAll
), argList_( argList
), env_( evalState
.env_
), dyn_( evalState
.dyn_
), cont_( evalState
.cont_
)
808 Kernel::CallContInfo::~CallContInfo( )
817 Kernel::CallContInfo::force( const size_t & pos
) const
821 return (*forcePos_
)[ pos
];
827 Kernel::CallContInfo::isSelective( ) const
829 return forcePos_
!= 0;
833 Kernel::CallContInfo::forceNone( ) const
841 Kernel::CallContInfo::forceAll( ) const
849 Kernel::CallContInfo::gcMark( Kernel::GCMarkedSet
& marked
)
851 env_
->gcMark( marked
);
852 dyn_
->gcMark( marked
);
853 cont_
->gcMark( marked
);
857 Kernel::CallCont_n::CallCont_n( const Ast::SourceLocation
& traceLoc
, const RefCountPtr
< const Kernel::CallContInfo
> & info
, const Ast::ArgListExprs::ConstIterator
& pos
, RefCountPtr
< const Lang::SingleList
> vals
, bool force
)
858 : Kernel::Continuation( traceLoc
), info_( info
), pos_( pos
), vals_( vals
), force_( force
)
861 Kernel::CallCont_n::~CallCont_n( )
865 Kernel::CallCont_n::takeHandle( Kernel::VariableHandle val
, Kernel::EvalState
* evalState
, bool dummy
) const
867 /* Even if force_ is set, this continuation takes handles since handles is what goes into the argument list.
870 if( force_
&& val
->isThunk( ) )
872 val
->force( val
, evalState
);
875 if( val
== Kernel::THE_SLOT_VARIABLE
)
877 /* If we don't detect this, the error messages that will be printed later would be very confusing,
878 * saying that the argument is missing, when the problem is likely to be that some internal
879 * computation should result in THE_VOID_VARIABLE rather than THE_SLOT_VARIABLE.
881 throw Exceptions::InternalError( "An argument expression evaluated to THE_SLOT_VARIABLE." );
883 info_
->argList_
->evaluate( info_
,
885 RefCountPtr
< const Lang::SingleListPair
>( new Lang::SingleListPair( val
, vals_
) ),
890 Kernel::CallCont_n::up( ) const
895 RefCountPtr
< const char >
896 Kernel::CallCont_n::description( ) const
898 return strrefdup( force_
? "function call's forced argument" : "function call's immediate argument" );
902 Kernel::CallCont_n::gcMark( Kernel::GCMarkedSet
& marked
)
904 const_cast< Kernel::CallContInfo
* >( info_
.getPtr( ) )->gcMark( marked
);
905 const_cast< Lang::SingleList
* >( vals_
.getPtr( ) )->gcMark( marked
);
909 Kernel::CallCont_Structure_n::CallCont_Structure_n( const Ast::SourceLocation
& traceLoc
, const RefCountPtr
< const Kernel::CallContInfo
> & info
, size_t pos
, RefCountPtr
< const Lang::SingleList
> rest
)
910 : Kernel::Continuation( traceLoc
), info_( info
), pos_( pos
), rest_( rest
)
913 Kernel::CallCont_Structure_n::~CallCont_Structure_n( )
917 Kernel::CallCont_Structure_n::takeValue( const RefCountPtr
< const Lang::Value
> & forcedValue
, Kernel::EvalState
* evalState
, bool dummy
) const
919 info_
->argList_
->evaluate_Structure( info_
, pos_
, rest_
, evalState
);
923 Kernel::CallCont_Structure_n::up( ) const
928 RefCountPtr
< const char >
929 Kernel::CallCont_Structure_n::description( ) const
931 return strrefdup( "split structure application forced argument" );
935 Kernel::CallCont_Structure_n::gcMark( Kernel::GCMarkedSet
& marked
)
937 const_cast< Kernel::CallContInfo
* >( info_
.getPtr( ) )->gcMark( marked
);
938 const_cast< Lang::SingleList
* >( rest_
.getPtr( ) )->gcMark( marked
);
942 Kernel::CallCont_1::CallCont_1( const Ast::SourceLocation
& traceLoc
, const Ast::ArgListExprs
* argList
, bool curry
, Kernel::StateHandle mutatorSelf
, const Kernel::EvalState
& evalState
, const Ast::SourceLocation
& callLoc
)
943 : Kernel::Continuation( traceLoc
), argList_( argList
), curry_( curry
), mutatorSelf_( mutatorSelf
), env_( evalState
.env_
), dyn_( evalState
.dyn_
), cont_( evalState
.cont_
), callLoc_( callLoc
)
946 Kernel::CallCont_1::~CallCont_1( )
950 Kernel::CallCont_1::takeValue( const RefCountPtr
< const Lang::Value
> & funUntyped
, Kernel::EvalState
* evalState
, bool dummy
) const
953 typedef const Lang::Function ArgType
;
954 RefCountPtr
< ArgType
> fun
= funUntyped
.down_cast
< const Lang::Function
>( );
955 if( fun
!= NullPtr
< ArgType
>( ) )
957 evalState
->env_
= env_
;
958 evalState
->dyn_
= dyn_
;
959 evalState
->cont_
= Kernel::ContRef( new Kernel::CallCont_last( fun
, argList_
, curry_
, mutatorSelf_
, env_
, dyn_
, cont_
, callLoc_
) );
960 argList_
->evaluate( fun
->newCallContInfo( argList_
, *evalState
),
961 argList_
->begin( ), Lang::THE_CONS_NULL
,
967 typedef const Lang::Transform2D ArgType
;
968 ArgType
* transformVal
= dynamic_cast< ArgType
* >( funUntyped
.getPtr( ) );
969 if( transformVal
!= 0 )
973 throw Exceptions::MiscellaneousRequirement( strrefdup( "Don't Curry transform applications. It's useless anyway!" ) );
975 if( argList_
->orderedExprs_
->size( ) != 1 )
977 throw Exceptions::CoreArityMismatch( "<transform application>", 1, argList_
->orderedExprs_
->size( ) );
979 if( ! argList_
->namedExprs_
->empty( ) )
981 throw Exceptions::CoreNoNamedFormals( "<transform application>" );
983 evalState
->expr_
= argList_
->orderedExprs_
->front( );
984 evalState
->env_
= env_
;
985 evalState
->dyn_
= dyn_
;
986 evalState
->cont_
= Kernel::ContRef( new Kernel::Transform2DCont( *transformVal
, cont_
, callLoc_
) );
991 typedef const Lang::Transform3D ArgType
;
992 ArgType
* transformVal
= dynamic_cast< ArgType
* >( funUntyped
.getPtr( ) );
993 if( transformVal
!= 0 )
997 throw Exceptions::MiscellaneousRequirement( strrefdup( "Don't Curry transform applications. It's useless anyway!" ) );
999 if( argList_
->orderedExprs_
->size( ) != 1 )
1001 throw Exceptions::CoreArityMismatch( "<transform application>", 1, argList_
->orderedExprs_
->size( ) );
1003 if( ! argList_
->namedExprs_
->empty( ) )
1005 throw Exceptions::CoreNoNamedFormals( "<transform application>" );
1007 evalState
->expr_
= argList_
->orderedExprs_
->front( );
1008 evalState
->env_
= env_
;
1009 evalState
->dyn_
= dyn_
;
1010 evalState
->cont_
= Kernel::ContRef( new Kernel::Transform3DCont( *transformVal
, cont_
, callLoc_
) );
1016 typedef const Lang::ElementaryPath2D ArgType
;
1017 RefCountPtr
< ArgType
> path
= NullPtr
< ArgType
>( );
1020 path
= Helpers::elementaryPathCast2D( funUntyped
, this );
1022 catch( const Exceptions::ContinuationTypeMismatch
& ball
)
1029 throw Exceptions::MiscellaneousRequirement( strrefdup( "Don't Curry path point selection. It's useless anyway!" ) );
1031 if( argList_
->orderedExprs_
->size( ) != 1 )
1033 throw Exceptions::CoreArityMismatch( "<path point selection>", 1, argList_
->orderedExprs_
->size( ) );
1035 if( ! argList_
->namedExprs_
->empty( ) )
1037 throw Exceptions::CoreNoNamedFormals( "<path point selection>" );
1040 evalState
->expr_
= argList_
->orderedExprs_
->front( );
1041 evalState
->env_
= env_
;
1042 evalState
->dyn_
= dyn_
;
1043 evalState
->cont_
= Kernel::ContRef( new Kernel::PathApplication2DCont( path
,
1051 typedef const Lang::ElementaryPath3D ArgType
;
1052 RefCountPtr
< ArgType
> path
= NullPtr
< ArgType
>( );
1055 path
= Helpers::elementaryPathCast3D( funUntyped
, this );
1057 catch( const Exceptions::ContinuationTypeMismatch
& ball
)
1064 throw Exceptions::MiscellaneousRequirement( strrefdup( "Don't Curry path point selection. It's useless anyway!" ) );
1066 if( argList_
->orderedExprs_
->size( ) != 1 )
1068 throw Exceptions::CoreArityMismatch( "<path point selection>", 1, argList_
->orderedExprs_
->size( ) );
1070 if( ! argList_
->namedExprs_
->empty( ) )
1072 throw Exceptions::CoreNoNamedFormals( "<path point selection>" );
1075 evalState
->expr_
= argList_
->orderedExprs_
->front( );
1076 evalState
->env_
= env_
;
1077 evalState
->dyn_
= dyn_
;
1078 evalState
->cont_
= Kernel::ContRef( new Kernel::PathApplication3DCont( path
,
1085 throw Exceptions::TypeMismatch( traceLoc_
,
1086 funUntyped
->getTypeName( ),
1087 Helpers::typeSetString( Lang::Function::staticTypeName( ),
1088 Lang::Transform2D::staticTypeName( ),
1089 Lang::Transform3D::staticTypeName( ),
1090 Lang::ElementaryPath2D::staticTypeName( ),
1091 Lang::ElementaryPath3D::staticTypeName( ) ) );
1095 Kernel::CallCont_1::up( ) const
1100 RefCountPtr
< const char >
1101 Kernel::CallCont_1::description( ) const
1103 return strrefdup( "function call's function" );
1107 Kernel::CallCont_1::gcMark( Kernel::GCMarkedSet
& marked
)
1109 dyn_
->gcMark( marked
);
1110 cont_
->gcMark( marked
);
1115 Ast::CallExpr::CallExpr( const Ast::SourceLocation
& loc
, Ast::Expression
* funExpr
, Ast::ArgListExprs
* argList
, bool curry
)
1116 : Ast::Expression( loc
), curry_( curry
), constFun_( Kernel::THE_NO_FUNCTION
), mutatorSelf_( 0 ), funExpr_( funExpr
), argList_( argList
)
1119 Ast::CallExpr::CallExpr( const Ast::SourceLocation
& loc
, const RefCountPtr
< const Lang::Function
> & constFun
, Ast::ArgListExprs
* argList
, bool curry
)
1120 : Ast::Expression( loc
), curry_( curry
), constFun_( constFun
), mutatorSelf_( 0 ), funExpr_( 0 ), argList_( argList
)
1123 Ast::CallExpr::~CallExpr( )
1129 if( mutatorSelf_
!= 0 )
1131 delete mutatorSelf_
;
1137 Ast::CallExpr::setMutatorSelf( Ast::StateReference
* mutatorSelf
)
1139 mutatorSelf_
= mutatorSelf
;
1143 Ast::CallExpr::analyze_impl( Ast::Node
* parent
, Ast::AnalysisEnvironment
* env
, Ast::StateIDSet
* freeStatesDst
)
1145 if( mutatorSelf_
!= 0 )
1147 mutatorSelf_
->analyze( this, env
, freeStatesDst
);
1151 funExpr_
->analyze( this, env
, freeStatesDst
);
1155 const_cast< Lang::Function
* >( constFun_
.getPtr( ) )->analyze( this, env
);
1157 argList_
->analyze( this, env
, freeStatesDst
);
1161 Ast::LexiographicVariable
* var
= dynamic_cast< Ast::LexiographicVariable
* >( funExpr_
);
1163 var
->scope_level( ) == 0 )
1165 /* The callee is bound in the base environment. */
1166 if( strcmp( var
->id( ), Lang::TEX_SYNTAX_ID
) == 0 )
1168 /* Someone is calling TeX. If the argument is a string literal, it should be announced. */
1169 if( argList_
->orderedExprs_
!= 0 && ! argList_
->orderedExprs_
->empty( ) )
1171 /* If there are named arguments or more than one ordered argument, they are ignored; only the first ordered argument is checked. */
1172 Ast::Constant
* carg
= dynamic_cast< Ast::Constant
* >( argList_
->orderedExprs_
->front( ) );
1177 typedef const Lang::String ArgType
;
1178 RefCountPtr
< ArgType
> strArg
= carg
->val( )->tryVal
< ArgType
>( );
1179 Kernel::theTeXLabelManager
.announce( std::string( strArg
->val_
.getPtr( ) ), carg
->loc( ) );
1181 catch( const NonLocalExit::NotThisType
& ball
)
1183 /* This is probably a type mismatch error, but we let the callee make the decision. */
1193 Ast::CallExpr::eval( Kernel::EvalState
* evalState
) const
1197 evalState
->expr_
= funExpr_
;
1198 evalState
->cont_
= Kernel::ContRef( new Kernel::CallCont_1( evalState
->expr_
->loc( ), argList_
, curry_
, mutatorSelf_
? (mutatorSelf_
->getHandle( evalState
->env_
, evalState
->dyn_
)) : 0, *evalState
, loc_
) );
1202 evalState
->cont_
= Kernel::ContRef( new Kernel::CallCont_last( constFun_
, argList_
, curry_
, mutatorSelf_
? (mutatorSelf_
->getHandle( evalState
->env_
, evalState
->dyn_
)) : 0, evalState
->env_
, evalState
->dyn_
, evalState
->cont_
, loc_
) );
1203 argList_
->evaluate( constFun_
->newCallContInfo( argList_
, *evalState
),
1204 argList_
->begin( ), Lang::THE_CONS_NULL
,
1209 Kernel::UnionCont_last::UnionCont_last( const Ast::ArgListExprs
* argList
, const Kernel::ContRef
& cont
, const Ast::SourceLocation
& callLoc
)
1210 : Kernel::Continuation( callLoc
), argList_( argList
), cont_( cont
)
1213 Kernel::UnionCont_last::~UnionCont_last( )
1217 Kernel::UnionCont_last::takeValue( const RefCountPtr
< const Lang::Value
> & valsUntyped
, Kernel::EvalState
* evalState
, bool dummy
) const
1219 typedef const Lang::SingleList ArgType
;
1220 RefCountPtr
< ArgType
> vals
= Helpers::down_cast
< ArgType
>( valsUntyped
, "< Internal error situation in UnionCont_last >" );
1222 evalState
->cont_
= cont_
;
1223 cont_
->takeValue( Kernel::ValueRef( new Lang::Structure( argList_
, vals
) ),
1228 Kernel::UnionCont_last::up( ) const
1233 RefCountPtr
< const char >
1234 Kernel::UnionCont_last::description( ) const
1236 return strrefdup( "union" );
1240 Kernel::UnionCont_last::gcMark( Kernel::GCMarkedSet
& marked
)
1242 cont_
->gcMark( marked
);
1246 Ast::UnionExpr::UnionExpr( const Ast::SourceLocation
& loc
, Ast::ArgListExprs
* argList
)
1247 : Ast::Expression( loc
), argList_( argList
)
1250 Ast::UnionExpr::~UnionExpr( )
1257 Ast::UnionExpr::analyze_impl( Ast::Node
* parent
, Ast::AnalysisEnvironment
* env
, Ast::StateIDSet
* freeStatesDst
)
1259 argList_
->analyze( this, env
, freeStatesDst
);
1263 Ast::UnionExpr::eval( Kernel::EvalState
* evalState
) const
1265 evalState
->cont_
= Kernel::ContRef( new Kernel::UnionCont_last( argList_
, evalState
->cont_
, loc_
) );
1267 argList_
->evaluate( RefCountPtr
< Kernel::CallContInfo
>( new Kernel::CallContInfo( argList_
, *evalState
, false ) ),
1268 argList_
->begin( ), Lang::THE_CONS_NULL
,
1273 Kernel::SplitCont_1::SplitCont_1( const Ast::SourceLocation
& traceLoc
, Ast::Expression
* argList
, bool curry
, const Kernel::EvalState
& evalState
, const Ast::SourceLocation
& callLoc
)
1274 : Kernel::Continuation( traceLoc
), argList_( argList
), curry_( curry
), env_( evalState
.env_
), dyn_( evalState
.dyn_
), cont_( evalState
.cont_
), callLoc_( callLoc
)
1277 Kernel::SplitCont_1::~SplitCont_1( )
1281 Kernel::SplitCont_1::takeValue( const RefCountPtr
< const Lang::Value
> & funUntyped
, Kernel::EvalState
* evalState
, bool dummy
) const
1283 typedef const Lang::Function ArgType
;
1284 RefCountPtr
< ArgType
> fun
= Helpers::down_cast
< ArgType
>( funUntyped
, "Split's function" );
1286 evalState
->env_
= env_
;
1287 evalState
->dyn_
= dyn_
;
1288 evalState
->cont_
= Kernel::ContRef( new Kernel::SplitCont_2( fun
, curry_
, env_
, dyn_
, cont_
, callLoc_
) );
1289 evalState
->expr_
= argList_
;
1293 Kernel::SplitCont_1::up( ) const
1298 RefCountPtr
< const char >
1299 Kernel::SplitCont_1::description() const
1301 return strrefdup( "split call's function" );
1305 Kernel::SplitCont_1::gcMark( Kernel::GCMarkedSet
& marked
)
1307 dyn_
->gcMark( marked
);
1308 cont_
->gcMark( marked
);
1312 Kernel::SplitCont_2::SplitCont_2( const RefCountPtr
< const Lang::Function
> & fun
, bool curry
, const Kernel::PassedEnv
& env
, const Kernel::PassedDyn
& dyn
, const Kernel::ContRef
& cont
, const Ast::SourceLocation
& callLoc
)
1313 : Kernel::Continuation( callLoc
), fun_( fun
), curry_( curry
), env_( env
), dyn_( dyn
), cont_( cont
)
1316 Kernel::SplitCont_2::~SplitCont_2( )
1320 Kernel::SplitCont_2::takeValue( const RefCountPtr
< const Lang::Value
> & valsUntyped
, Kernel::EvalState
* evalState
, bool dummy
) const
1322 /* This continuation shall mimic the behavior Kernel::CallCont_1.
1325 typedef const Lang::Structure ArgType
;
1326 RefCountPtr
< ArgType
> structure
= Helpers::down_cast
< ArgType
>( valsUntyped
, "Split" );
1328 const Ast::ArgListExprs
* argList
= structure
->argList_
;
1330 evalState
->env_
= env_
;
1331 evalState
->dyn_
= dyn_
;
1332 evalState
->cont_
= Kernel::ContRef( new Kernel::CallCont_Structure_last( fun_
, argList
, structure
->values_
, curry_
, env_
, dyn_
, cont_
, traceLoc_
) );
1333 RefCountPtr
< Kernel::CallContInfo
> callContInfo
= fun_
->newCallContInfo( argList
, *evalState
);
1335 if( callContInfo
->forceNone( ) ){
1339 Kernel::ContRef cont
= evalState
->cont_
;
1340 cont
->takeValue( structure
->values_
, evalState
);
1344 argList
->evaluate_Structure( callContInfo
,
1345 structure
->valueCount( ) - 1, /* Reverse index of first element in structure->values_. */
1353 Kernel::SplitCont_2::up( ) const
1358 RefCountPtr
< const char >
1359 Kernel::SplitCont_2::description( ) const
1361 return strrefdup( "Split/splice" );
1365 Kernel::SplitCont_2::gcMark( Kernel::GCMarkedSet
& marked
)
1367 cont_
->gcMark( marked
);
1371 Ast::CallSplitExpr::CallSplitExpr( const Ast::SourceLocation
& loc
, Ast::Expression
* funExpr
, Ast::Expression
* argList
, bool curry
)
1372 : Ast::Expression( loc
), curry_( curry
), funExpr_( funExpr
), argList_( argList
)
1375 Ast::CallSplitExpr::~CallSplitExpr( )
1383 Ast::CallSplitExpr::analyze_impl( Ast::Node
* parent
, Ast::AnalysisEnvironment
* env
, Ast::StateIDSet
* freeStatesDst
)
1385 funExpr_
->analyze( this, env
, freeStatesDst
);
1386 argList_
->analyze( this, env
, freeStatesDst
);
1390 Ast::CallSplitExpr::eval( Kernel::EvalState
* evalState
) const
1392 evalState
->expr_
= funExpr_
;
1393 evalState
->cont_
= Kernel::ContRef( new Kernel::SplitCont_1( evalState
->expr_
->loc( ), argList_
, curry_
, *evalState
, loc_
) );
1397 Ast::DummyExpression::DummyExpression( )
1398 : Ast::Expression( Ast::THE_UNKNOWN_LOCATION
)
1401 Ast::DummyExpression::DummyExpression( const Ast::SourceLocation
& loc
)
1402 : Ast::Expression( loc
)
1405 Ast::DummyExpression::~DummyExpression( )
1409 Ast::DummyExpression::analyze_impl( Ast::Node
* parent
, Ast::AnalysisEnvironment
* env
, Ast::StateIDSet
* freeStatesDst
)
1411 /* Nothing to do! */
1415 Ast::DummyExpression::eval( Kernel::EvalState
* evalState
) const
1417 throw Exceptions::InternalError( strrefdup( "A DummyExpression must never be evaluated." ) );