@@ -43,6 +43,7 @@ protected
4343import BuiltinCall = NFBuiltinCall ;
4444import Ceval = NFCeval ;
4545import ComponentRef = NFComponentRef ;
46+ import Config ;
4647import Dimension = NFDimension ;
4748import ErrorExt ;
4849import Inline = NFInline ;
@@ -847,10 +848,29 @@ protected
847848 ComponentRef fn_ref;
848849 list< Expression > args;
849850 list< NamedArg > named_args;
851+ String name;
850852 algorithm
851- (args, named_args) := instArgs(functionArgs, scope, info);
852853
853- callExp := match AbsynUtil . crefFirstIdent(functionName)
854+ name := AbsynUtil . crefFirstIdent(functionName);
855+
856+ // try to inst the parameters
857+ try
858+ (args, named_args) := instArgs(functionArgs, scope, info);
859+ else
860+ // didn't work, is this DynamicSelect dynamic part?! #5631
861+ if Config . getGraphicsExpMode() and stringEq(name, "DynamicSelect" ) then
862+ // return just the first part of DynamicSelect
863+ callExp := match functionArgs
864+ case Absyn . FUNCTIONARGS () then
865+ Inst . instExp(listHead(functionArgs. args), scope, info);
866+ end match;
867+ return ;
868+ else
869+ fail();
870+ end if ;
871+ end try ;
872+
873+ callExp := match name
854874 // size creates Expression.SIZE instead of Expression.CALL.
855875 case "size" then BuiltinCall . makeSizeExp(args, named_args, info);
856876 // array() call with no iterators creates Expression.ARRAY instead of Expression.CALL.
@@ -862,6 +882,7 @@ protected
862882 fn_ref := Function . instFunction(functionName,scope,info);
863883 then
864884 Expression . CALL (UNTYPED_CALL (fn_ref, args, named_args, scope));
885+
865886 end match;
866887 end instNormalCall;
867888
0 commit comments