Skip to content

Commit

Permalink
- Added support for plot(der(x)) type-checking
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8555 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Apr 8, 2011
1 parent 98e8aef commit da03266
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions Compiler/FrontEnd/Static.mo
Expand Up @@ -12900,26 +12900,35 @@ algorithm
list<Absyn.Exp> es;
DAE.ExpType et;
Integer i;
DAE.Exp dexp;
/* Type Name */
case (Absyn.CREF(componentRef=cr),DAE.C_TYPENAME(),_)
equation
path = Absyn.crefToPath(cr);
then DAE.CODE(Absyn.C_TYPENAME(path),DAE.ET_OTHER());
case (Absyn.CREF(componentRef=cr),DAE.C_VARIABLENAME(),_)
then DAE.CODE(Absyn.C_VARIABLENAME(cr),DAE.ET_OTHER());
case (Absyn.CREF(componentRef=cr),DAE.C_VARIABLENAMES(),info)
equation
et = DAE.ET_ARRAY(DAE.ET_OTHER(),{DAE.DIM_INTEGER(1)});
then DAE.ARRAY(et,false,{DAE.CODE(Absyn.C_VARIABLENAME(cr),DAE.ET_OTHER())});

/* Variable Names */
case (Absyn.ARRAY(es),DAE.C_VARIABLENAMES(),info)
equation
es_1 = Util.listMap2(es,elabCodeExp,DAE.C_VARIABLENAME(),info);
i = listLength(es);
et = DAE.ET_ARRAY(DAE.ET_OTHER(),{DAE.DIM_INTEGER(i)});
then DAE.ARRAY(et,false,es_1);
case (exp,DAE.C_VARIABLENAMES(),info)
equation
et = DAE.ET_ARRAY(DAE.ET_OTHER(),{DAE.DIM_INTEGER(1)});
dexp = elabCodeExp(exp,DAE.C_VARIABLENAME(),info);
then DAE.ARRAY(et,false,{dexp});

/* Variable Name */
case (Absyn.CREF(componentRef=cr),DAE.C_VARIABLENAME(),_)
then DAE.CODE(Absyn.C_VARIABLENAME(cr),DAE.ET_OTHER());
case (Absyn.CALL(Absyn.CREF_IDENT("der",{}),Absyn.FUNCTIONARGS(args={Absyn.CREF(componentRef=cr)},argNames={})),DAE.C_VARIABLENAME(),_)
then DAE.CODE(Absyn.C_EXPRESSION(exp),DAE.ET_OTHER());

case (exp,ct,info)
equation
failure(DAE.C_VARIABLENAMES() = ct);
s1 = Dump.printExpStr(exp);
s2 = Types.printCodeTypeStr(ct);
Error.addSourceMessage(Error.ELAB_CODE_EXP_FAILED, {s1,s2}, info);
Expand Down

0 comments on commit da03266

Please sign in to comment.