File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -556,6 +556,24 @@ algorithm
556556 end match;
557557end liftArrayR;
558558
559+ public function dimensionSizeConstantExp
560+ "Converts (extracts) a dimension to an expression.
561+ This function will fail if dimension is unknown or an expression (in case the dimension is from a different scope).
562+ If you want to(kind of) handle unknown dims use dimensionSizeExpHandleUnkown."
563+ input DAE . Dimension dim;
564+ output DAE . Exp exp;
565+ algorithm
566+ exp := match(dim)
567+ local
568+ Integer i;
569+ DAE . Exp e;
570+
571+ case DAE . DIM_INTEGER (integer = i) then DAE . ICONST (i);
572+ case DAE . DIM_ENUM (size = i) then DAE . ICONST (i);
573+ case DAE . DIM_BOOLEAN () then DAE . ICONST (2 );
574+ end match;
575+ end dimensionSizeConstantExp;
576+
559577public function dimensionSizeExp
560578 "Converts (extracts) a dimension to an expression.
561579 This function will fail if dimension is unknown. i.e. DIM_UNKNOWN.
Original file line number Diff line number Diff line change @@ -3352,7 +3352,7 @@ algorithm
33523352 dim_count = listLength(inDimensions);
33533353 true = (dim_int > 0 and dim_int <= dim_count);
33543354 dim = listNth(inDimensions, dim_int - 1);
3355- exp = Expression.dimensionSizeExp (dim);
3355+ exp = Expression.dimensionSizeConstantExp (dim);
33563356 prop = DAE.PROP(DAE.T_INTEGER_DEFAULT, DAE.C_CONST());
33573357 then
33583358 (SOME(exp), SOME(prop));
You can’t perform that action at this time.
0 commit comments