@@ -2468,81 +2468,6 @@ algorithm
24682468 end matchcontinue;
24692469end addClassdefToEnv2;
24702470
2471- protected function isStructuralParameter
2472- "author: PA
2473- This function investigates a component to find out if it is a structural parameter.
2474- This is achieved by looking at the restriction to find if it is a parameter
2475- and by investigating all components to find it is used in array dimensions
2476- of the component. A parameter can also be structural if is is used
2477- in an if equation with different number of equations in each branch."
2478- input SCode . Variability inVariability;
2479- input Absyn . ComponentRef inComponentRef;
2480- input list< tuple< SCode . Element , DAE . Mod >> inElements;
2481- input list< SCode . Equation > inEquations;
2482- output Boolean outBoolean;
2483- algorithm
2484- outBoolean := matchcontinue(inVariability, inComponentRef, inElements, inEquations)
2485- local
2486- list< Absyn . ComponentRef > crefs;
2487- Boolean b1,b2,res;
2488- SCode . Variability param;
2489- Absyn . ComponentRef compname;
2490- list< tuple< SCode . Element , DAE . Mod >> allcomps;
2491- list< SCode . Equation > eqns;
2492- /* constants does not need to be checked.
2493- * Must return false here to prevent constants from be outputed
2494- * as structural parameters, i.e. \"parameter\" in DAE, which is
2495- * incorrect
2496- */
2497- case (SCode . CONST (),_,_,_) then false ;
2498-
2499- /* Check if structural:
2500- * 1. By investigating array dimensions.
2501- * 2. By investigating if-equations.
2502- */
2503- case (param,compname,allcomps,eqns)
2504- equation
2505- true = SCode . isParameterOrConst(param);
2506- crefs = getCrefsFromCompdims(allcomps);
2507- b1 = memberCrefs(compname, crefs);
2508- b2 = isStructuralIfEquationParameter(compname, eqns);
2509- res = boolOr(b1, b2);
2510- then
2511- res;
2512- else false ;
2513- end matchcontinue;
2514- end isStructuralParameter;
2515-
2516- protected function isStructuralIfEquationParameter
2517- "author: PA
2518- This function checks if a parameter is structural because
2519- it is present in the condition expression of an if equation."
2520- input Absyn . ComponentRef inComponentRef;
2521- input list< SCode . Equation > inSCodeEquationLst;
2522- output Boolean outBoolean;
2523- algorithm
2524- outBoolean := matchcontinue (inComponentRef,inSCodeEquationLst)
2525- local
2526- list< Absyn . ComponentRef > crefs;
2527- Absyn . ComponentRef compname;
2528- list< Absyn . Exp > conds;
2529- Boolean res;
2530- list< SCode . Equation > eqns;
2531- case (_,{}) then false ;
2532- case (compname,(SCode . EQUATION (eEquation = SCode . EQ_IF (condition = conds)) :: _))
2533- equation
2534- crefs = List . flatten(List . map2(conds,Absyn . getCrefFromExp,false ,false ));
2535- true = memberCrefs(compname, crefs);
2536- then
2537- true ;
2538- case (compname,(_ :: eqns))
2539- equation
2540- res = isStructuralIfEquationParameter(compname, eqns);
2541- then
2542- res;
2543- end matchcontinue;
2544- end isStructuralIfEquationParameter;
2545-
25462471protected function checkCompEnvPathVsCompTypePath
25472472"fails if the comp env path is NOT a prefix of comp type path"
25482473 input Option < Absyn . Path > inCompEnvPath;
0 commit comments