diff --git a/Compiler/DAE.mo b/Compiler/DAE.mo index 111b406ec73..70995da9c9c 100644 --- a/Compiler/DAE.mo +++ b/Compiler/DAE.mo @@ -3331,24 +3331,12 @@ algorithm matchcontinue (inElementLst) local list res,lst; - Exp.ComponentRef a; - VarKind b; - VarDirection c; - VarProtection prot; - Type d; - Option e,g; - InstDims f; - Flow h; - list i; - Option dae_var_attr; - Option comment; - Absyn.InnerOuter io; - Types.Type tp; - case (VAR(componentRef = a,varible = b,variable = c,protection = prot,input_ = d,one = e,binding = f,dimension = g,value = h,flow_ = i,variableAttributesOption = dae_var_attr,absynCommentOption = comment,innerOuter=io,fullType=tp) :: lst) + Element x; + case ((x as VAR(_,_,_,_,_,_,_,_,_,_,_,_,_,_)) :: lst) equation res = getVariableList(lst); then - (VAR(a,b,c,prot,d,e,f,g,h,i,dae_var_attr,comment,io,tp) :: res); + (x :: res); case (_ :: lst) equation res = getVariableList(lst); diff --git a/Compiler/DAELow.mo b/Compiler/DAELow.mo index 6d033ef2574..b174adf9870 100644 --- a/Compiler/DAELow.mo +++ b/Compiler/DAELow.mo @@ -2070,8 +2070,8 @@ algorithm Option s; DAE.Flow t; Boolean fixed; - case (VAR(varName = a,varKind = b,varDirection = c,varType = d,bindExp = e,bindValue = f,arryDim = g,startValue = h,index = i,origVarName = j,className = k,values = SOME(DAE.VAR_ATTR_REAL(l,m,n,o,p,_,q,r)),comment = s,flow_ = t),fixed) then VAR(a,b,c,d,e,f,g,h,i,j,k, - SOME(DAE.VAR_ATTR_REAL(l,m,n,o,p,SOME(fixed),q,r)),s,t); + case (VAR(varName = a,varKind = b,varDirection = c,varType = d,bindExp = e,bindValue = f,arryDim = g,startValue = h,index = i,origVarName = j,className = k,values = SOME(DAE.VAR_ATTR_REAL(l,m,n,o,p,_,q,r)),comment = s,flow_ = t),fixed) + then VAR(a,b,c,d,e,f,g,h,i,j,k,SOME(DAE.VAR_ATTR_REAL(l,m,n,o,p,SOME(fixed),q,r)),s,t); case (VAR(varName = a,varKind = b,varDirection = c,varType = d,bindExp = e,bindValue = f,arryDim = g,startValue = h,index = i,origVarName = j,className = k,values = SOME(DAE.VAR_ATTR_INT(l,m,n,_)),comment = o,flow_ = p),fixed) local tuple, Option> m; @@ -6181,8 +6181,9 @@ algorithm Option attr; Option comment; DAE.Flow flow_; - case (VAR(varName = cr,varKind = kind,varDirection = dir,varType = tp,bindExp = bind,bindValue = v,arryDim = dim,startValue = st,index = i,origVarName = origname,className = classes,values = attr,comment = comment,flow_ = flow_),new_kind) then VAR(cr,new_kind,dir,tp,bind,v,dim,st,i,origname,classes,attr, - comment,flow_); + case (VAR(varName = cr,varKind = kind,varDirection = dir,varType = tp,bindExp = bind,bindValue = v,arryDim = dim,startValue = st, + index = i,origVarName = origname,className = classes,values = attr,comment = comment,flow_ = flow_),new_kind) + then VAR(cr,new_kind,dir,tp,bind,v,dim,st,i,origname,classes,attr,comment,flow_); end matchcontinue; end setVarKind; @@ -11971,20 +11972,11 @@ end calculateIndexes; protected function transformVariables "function: transformVariables author: PA - - Helper function to translate_dae - - - inputs: (Var list, - Exp.Exp list, - Exp.Exp list, - string /* varible prefix, \"$\" or \"\" */) - outputs: (Var list) -" + Helper function to translateDae" input list inVarLst1; input list inExpExpLst2; input list inExpExpLst3; - input String inString4; + input String inString4 "variable prefix, '$' or ''"; output list outVarLst; algorithm outVarLst:= @@ -12152,7 +12144,8 @@ algorithm Option dae_var_attr; Option comment; DAE.Flow flow_; - case ({},x,xd,y,p,dummy,ext,x_strType,xd_strType,y_strType,p_strType,dummy_strType) then ({},x,xd,y,p,dummy,ext,x_strType,xd_strType,y_strType,p_strType,dummy_strType); + case ({},x,xd,y,p,dummy,ext,x_strType,xd_strType,y_strType,p_strType,dummy_strType) + then ({},x,xd,y,p,dummy,ext,x_strType,xd_strType,y_strType,p_strType,dummy_strType); case ((VAR(varName = cr,varKind = VARIABLE(),varDirection = d,varType = DAE.STRING(),bindExp = b,bindValue = value,arryDim = dim,startValue = start,origVarName = name,className = cl,values = dae_var_attr,comment = comment,flow_ = flow_) :: vs),x,xd,y,p,dummy,ext,x_strType,xd_strType,y_strType,p_strType,dummy_strType) equation diff --git a/Compiler/Env.mo b/Compiler/Env.mo index 9a9664985c4..b301111bcee 100644 --- a/Compiler/Env.mo +++ b/Compiler/Env.mo @@ -385,7 +385,7 @@ algorithm BinTree ht_1,ht,httypes; Option id; list imps; - Env bcframes,fs,env; + Env bcframes,fs,env,remember; tuple,Exp.ComponentRef> crs; Boolean encflag; InstStatus i; @@ -400,11 +400,12 @@ algorithm (FRAME(id,ht_1,httypes,imps,bcframes,crs,encflag) :: fs); // Variable already added, perhaps from baseclass - case ((FRAME(class_1 = id,list_2 = ht,list_3 = httypes,list_4 = imps,list_5 = bcframes,current6 = crs,encapsulated_7 = encflag) :: fs),(v as Types.VAR(name = n)),c,i,env) /* environment of component */ + case (remember as (FRAME(class_1 = id,list_2 = ht,list_3 = httypes,list_4 = imps,list_5 = bcframes,current6 = crs,encapsulated_7 = encflag) :: fs), + (v as Types.VAR(name = n)),c,i,env) /* environment of component */ equation (_)= treeGet(ht, n, System.hash); then - (FRAME(id,ht,httypes,imps,bcframes,crs,encflag) :: fs); + (remember); end matchcontinue; end extendFrameV; @@ -574,7 +575,8 @@ algorithm tuple,Exp.ComponentRef> crefs; Boolean enc; Frame f; - case ((FRAME(class_1 = sid,list_2 = cls,list_3 = tps,list_4 = imps,list_5 = bc,current6 = crefs,encapsulated_7 = enc) :: fs),(f :: _)) then (FRAME(sid,cls,tps,imps,(f :: bc),crefs,enc) :: fs); /* env bc env */ + case ((FRAME(class_1 = sid,list_2 = cls,list_3 = tps,list_4 = imps,list_5 = bc,current6 = crefs,encapsulated_7 = enc) :: fs),(f :: _)) + then (FRAME(sid,cls,tps,imps,(f :: bc),crefs,enc) :: fs); /* env bc env */ end matchcontinue; end addBcFrame; @@ -1539,6 +1541,7 @@ algorithm then str; end matchcontinue; end printCacheTreeStr; + public function localOutsideConnectorFlowvars "function: localOutsideConnectorFlowvars Return the outside connector variables that are flow in the local scope. diff --git a/Compiler/Inst.mo b/Compiler/Inst.mo index 868baf17ec0..d9882e51d4d 100644 --- a/Compiler/Inst.mo +++ b/Compiler/Inst.mo @@ -3039,15 +3039,13 @@ algorithm case (env,_,_,_,_,{},_,_,_,_) then env; /* implicit inst. */ /* A component */ - case (env,mod,pre,csets,cistate,(((comp as SCode.COMPONENT(component = n,innerOuter=io,final_ = final_,replaceable_ = repl,protected_ = prot,attributes = (attr as SCode.ATTR(arrayDim = ad,flow_ = flow_,RW = acc,parameter_ = param,input_ = dir)),typeSpec = t,mod = m,baseclass = bc,this = comment)),cmod) :: xs),allcomps,eqns,instdims,impl) + case (env,mod,pre,csets,cistate, + (((comp as SCode.COMPONENT(component = n,innerOuter=io,final_ = final_,replaceable_ = repl,protected_ = prot,attributes = + (attr as SCode.ATTR(arrayDim = ad,flow_ = flow_,RW = acc,parameter_ = param,input_ = dir)),typeSpec = t,mod = m,baseclass = bc,this = comment)),cmod) :: xs), + allcomps,eqns,instdims,impl) equation - env_1 = addComponentsToEnv2(env, mod, pre, csets, cistate, - { - ( - SCode.COMPONENT(n,io,final_,repl,prot,SCode.ATTR(ad,flow_,acc,param,dir),t,m, - bc,comment),cmod)}, instdims, impl); - env_2 = addComponentsToEnv(env_1, mod, pre, csets, cistate, xs, allcomps, eqns, - instdims, impl); + env_1 = addComponentsToEnv2(env, mod, pre, csets, cistate, {(comp,cmod)}, instdims, impl); + env_2 = addComponentsToEnv(env_1, mod, pre, csets, cistate, xs, allcomps, eqns, instdims, impl); then env_2;