Skip to content

Commit d5c1413

Browse files
committed
- Added DAE.Const to typeExp
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13034 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 119a7a6 commit d5c1413

File tree

5 files changed

+92
-75
lines changed

5 files changed

+92
-75
lines changed

Compiler/FrontEnd/Inst.mo

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ protected import HashTable;
141141
protected import HashTable5;
142142
protected import InstSection;
143143
protected import InstExtends;
144+
protected import InstUtil;
144145
protected import Interactive;
145146
protected import List;
146147
protected import Lookup;
@@ -8531,7 +8532,7 @@ algorithm
85318532
PrefixUtil.prefixToCrefOpt(inPrefix), NONE(), NONE());
85328533

85338534
// Instantiate the components binding.
8534-
opt_binding = makeVariableBinding(ty, inMod, toConst(vt), inPrefix, inName, source);
8535+
opt_binding = makeVariableBinding(ty, inMod, InstUtil.toConst(vt), inPrefix, inName, source);
85358536
start = instStartBindingExp(inMod, ty, vt);
85368537

85378538
// Add the component to the DAE.
@@ -17047,18 +17048,6 @@ algorithm
1704717048
end matchcontinue;
1704817049
end mergeClassComments;
1704917050

17050-
public function toConst
17051-
"Translates SCode.Variability to DAE.Const"
17052-
input SCode.Variability inVar;
17053-
output DAE.Const outConst;
17054-
algorithm
17055-
outConst := matchcontinue (inVar)
17056-
case(SCode.CONST()) then DAE.C_CONST();
17057-
case(SCode.PARAM()) then DAE.C_PARAM();
17058-
case _ then DAE.C_VAR();
17059-
end matchcontinue;
17060-
end toConst;
17061-
1706217051
protected function makeNonExpSubscript
1706317052
input DAE.Subscript inSubscript;
1706417053
output DAE.Subscript outSubscript;

Compiler/FrontEnd/InstSection.mo

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ protected import ExpressionDump;
6363
protected import ExpressionSimplify;
6464
protected import Flags;
6565
protected import Inst;
66+
protected import InstUtil;
6667
protected import List;
6768
protected import Lookup;
6869
protected import MetaUtil;
@@ -4077,8 +4078,8 @@ algorithm
40774078
crefExp1 = Expression.crefExp(c1_1);
40784079
crefExp2 = Expression.crefExp(c2_1);
40794080
// Evaluate constant crefs away
4080-
const1 = Inst.toConst(vt1);
4081-
const2 = Inst.toConst(vt2);
4081+
const1 = InstUtil.toConst(vt1);
4082+
const2 = InstUtil.toConst(vt2);
40824083
(cache, crefExp1, _) = Ceval.cevalIfConstant(cache, env, crefExp1, DAE.PROP(t1,const1), true, info);
40834084
(cache, crefExp2, _) = Ceval.cevalIfConstant(cache, env, crefExp2, DAE.PROP(t2,const2), true, info);
40844085
(exp,_) = ExpressionSimplify.simplify(DAE.RELATION(crefExp1,DAE.EQUAL(DAE.T_BOOL_DEFAULT),crefExp2,-1,NONE()));

Compiler/FrontEnd/InstUtil.mo

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,4 +1930,16 @@ algorithm
19301930
end match;
19311931
end typeCrefWithComponent2;
19321932

1933+
public function toConst
1934+
"Translates SCode.Variability to DAE.Const"
1935+
input SCode.Variability inVar;
1936+
output DAE.Const outConst;
1937+
algorithm
1938+
outConst := matchcontinue (inVar)
1939+
case(SCode.CONST()) then DAE.C_CONST();
1940+
case(SCode.PARAM()) then DAE.C_PARAM();
1941+
case _ then DAE.C_VAR();
1942+
end matchcontinue;
1943+
end toConst;
1944+
19331945
end InstUtil;

Compiler/FrontEnd/SCodeInst.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3562,7 +3562,7 @@ algorithm
35623562
case (InstTypes.CONDITIONAL_COMPONENT(name, cond_exp, sel, mod, prefs, env,
35633563
prefix, info), st, functions)
35643564
equation
3565-
(cond_exp, ty, st) = Typing.typeExp(cond_exp, Typing.EVAL_CONST_PARAM(),
3565+
(cond_exp, ty, _, st) = Typing.typeExp(cond_exp, Typing.EVAL_CONST_PARAM(),
35663566
Typing.CONTEXT_MODEL(), st);
35673567
(cond_exp, _) = ExpressionSimplify.simplify(cond_exp);
35683568
cond = evaluateConditionalExp(cond_exp, ty, name, info);

0 commit comments

Comments
 (0)