Ticket #1931: Inst.diff

File Inst.diff, 2.2 KB (added by Martin Sjölund, 13 years ago)
  • Compiler/FrontEnd/Inst.mo

     
    81688168      DAE.Dimensions dims;
    81698169      DAE.ComponentRef cr;
    81708170      DAE.Type ty;
    8171     case (_,_,_,_,DAE.DAE(dae),_,_,DAE.C_VAR(),_,_,_)
     8171    case (_,_,_,_,DAE.DAE(dae),_,_,_,_,_,_)
    81728172      equation
     8173        false = Types.isConstant(const);
    81738174        false = ClassInf.isFunctionOrRecord(inState);
    81748175        ty = Types.simplifyType(inType);
    81758176        false = Types.isExternalObject(Types.arrayElementType(ty));
     
    81788179        SOME(exp) = makeVariableBinding(ty, mod, const, pre, n, source);
    81798180        cr = ComponentReference.makeCrefIdent(n,ty,{});
    81808181        (cache,cr) = PrefixUtil.prefixCref(inCache,inEnv,inIH,pre,cr);
    8181         eq = DAE.ARRAY_EQUATION(dims, DAE.CREF(cr,ty), exp, source);
     8182        eq = Util.if_(Types.isParameter(const),DAE.INITIAL_ARRAY_EQUATION(dims, DAE.CREF(cr,ty), exp, source),DAE.ARRAY_EQUATION(dims, DAE.CREF(cr,ty), exp, source));
    81828183        // print("Creating array equation for " +& PrefixUtil.printPrefixStr(pre) +& "." +& n +& " of const " +& DAEUtil.constStr(const) +& " in classinf " +& ClassInf.printStateStr(inState) +& "\n");
    81838184      then (cache,DAE.DAE(eq::dae));
    81848185    else (inCache,inDae);
     
    85808581          PrefixUtil.prefixToCrefOpt(inPrefix), NONE(), NONE());
    85818582
    85828583        // Instantiate the components binding.
    8583         mod = Util.if_(listLength(inSubscripts) > 0 and not SCode.isParameterOrConst(vt) and not ClassInf.isFunctionOrRecord(inState) and not Types.isComplexType(Types.arrayElementType(ty)) and not Types.isExternalObject(Types.arrayElementType(ty)),DAE.NOMOD(),inMod);
     8584        mod = Util.if_(listLength(inSubscripts) > 0 and not SCode.isConstant(vt) and not ClassInf.isFunctionOrRecord(inState) and not Types.isComplexType(Types.arrayElementType(ty)) and not Types.isExternalObject(Types.arrayElementType(ty)),DAE.NOMOD(),inMod);
    85848585        opt_binding = makeVariableBinding(ty, mod, InstUtil.toConst(vt), inPrefix, inName, source);
    85858586        start = instStartBindingExp(inMod /* Yup, let's keep the start-binding. It seems sane. */, ty, vt);
    85868587