@@ -239,6 +239,40 @@ algorithm
239239end getSimulationArguments;
240240
241241public function elabCallInteractive "This function elaborates the functions defined in the interactive environment.
242+ Since some of these functions are meta-functions, they can not be described in the type
243+ system, and is thus given the the type T_UNKNOWN"
244+ input output FCore . Cache cache;
245+ input FCore . Graph env;
246+ input Absyn . ComponentRef fn;
247+ input list< Absyn . Exp > args;
248+ input list< Absyn . NamedArg > nargs;
249+ input Boolean impl;
250+ input Prefix . Prefix pre;
251+ input SourceInfo info;
252+ output DAE . Exp e;
253+ output DAE . Properties prop;
254+ protected
255+ list< Integer > handles;
256+ algorithm
257+ if Flags . getConfigBool(Flags . BUILDING_MODEL ) then
258+ ErrorExt . delCheckpoint("elabCall_InteractiveFunction" );
259+ fail();
260+ end if ;
261+ handles := ErrorExt . popCheckPoint("elabCall_InteractiveFunction" );
262+ try
263+ /* An extra try-block to avoid the assignment to handles being optimized away */
264+ ErrorExt . setCheckpoint("elabCall_InteractiveFunction1" );
265+ (cache,e,prop) := elabCallInteractive_work(cache, env, fn, args, nargs, impl, pre, info) "Elaborate interactive function calls, such as simulate(), plot() etc." ;
266+ ErrorExt . delCheckpoint("elabCall_InteractiveFunction1" );
267+ else
268+ ErrorExt . rollBack("elabCall_InteractiveFunction1" );
269+ ErrorExt . pushMessages(handles);
270+ fail();
271+ end try ;
272+ ErrorExt . freeMessages(handles);
273+ end elabCallInteractive;
274+
275+ protected function elabCallInteractive_work "This function elaborates the functions defined in the interactive environment.
242276 Since some of these functions are meta-functions, they can not be described in the type
243277 system, and is thus given the the type T_UNKNOWN"
244278 input FCore . Cache inCache;
@@ -252,7 +286,7 @@ public function elabCallInteractive "This function elaborates the functions defi
252286 output FCore . Cache outCache;
253287 output DAE . Exp outExp;
254288 output DAE . Properties outProperties;
255- algorithm
289+ algorithm
256290 (outCache,outExp,outProperties):=
257291 matchcontinue
258292 (inCache,inEnv,inComponentRef,inExps,inNamedArgs,inImplInst,inPrefix,info)
@@ -467,7 +501,7 @@ public function elabCallInteractive "This function elaborates the functions defi
467501 DAE . T_STRING_DEFAULT ),DAE . PROP (DAE . T_BOOL_DEFAULT ,DAE . C_CONST ()));
468502
469503 end matchcontinue;
470- end elabCallInteractive ;
504+ end elabCallInteractive_work ;
471505
472506public function elabExp "
473507function: elabExp
@@ -560,7 +594,7 @@ algorithm
560594 Prefix . Prefix pre;
561595 case (cache,env,fn,args,nargs,impl,pre,_,_)
562596 equation
563- (cache,e,prop) = elabCallInteractive (cache, env, fn, args, nargs, impl, pre, info) "Elaborate interactive function calls, such as simulate(), plot() etc." ;
597+ (cache,e,prop) = elabCallInteractive_work (cache, env, fn, args, nargs, impl, pre, info) "Elaborate interactive function calls, such as simulate(), plot() etc." ;
564598 then
565599 (cache,e,prop);
566600 end match;
0 commit comments