@@ -3220,80 +3220,12 @@ algorithm
32203220 BackendDAE . EqSystem syst;
32213221 BackendDAE . Shared shared ;
32223222
3223- // handle partial models
3224- case (cache,env,className,(st as Interactive . SYMBOLTABLE (ast = p)),msg)
3225- equation
3226- ptot = Dependency . getTotalProgram(className,p);
3227- // see if class is partial
3228- Absyn . CLASS (partialPrefix = partialPrefix as true , finalPrefix = finalPrefix, encapsulatedPrefix = encapsulatedPrefix, restriction = restriction, info = info) =
3229- Interactive . getPathedClassInProgram(className, p);
3230- // this case should not handle functions so here we check anything but functions!
3231- false = listMember(restriction, {Absyn . R_FUNCTION ()});
3232- Error . clearMessages() "Clear messages" ;
3233- Print . clearErrorBuf() "Clear error buffer" ;
3234- classNameStr = Absyn . pathString(className);
3235- /* this part is not needed anymore as when checkModel is active you can normally instantiate partial classes
3236- I leave it here as we might use it in some other part
3237- // add a non-partial class to ptot with the same flags (final, encapsulated) and same restriction but instead of partial make it non-partial.
3238- Absyn.PROGRAM(classes, within_, globalBuildTimes) = ptot;
3239- classNameStr_dummy = classNameStr +& "_$_non_partial";
3240- // make a dummy class part containing an element definition as extends given-for-check-partial-class;
3241- dummyClassPart =
3242- Absyn.PUBLIC({
3243- Absyn.ELEMENTITEM(
3244- Absyn.ELEMENT(false, NONE(), Absyn.NOT_INNER_OUTER(), "extends",
3245- Absyn.EXTENDS(className, {}, NONE()), // extend the given-for-check partial class
3246- info, NONE())
3247- )});
3248- dummyClass = Absyn.CLASS(classNameStr_dummy,
3249- false,
3250- finalPrefix,
3251- encapsulatedPrefix,
3252- restriction,
3253- Absyn.PARTS({dummyClassPart}, NONE()),
3254- info);
3255- // add the dummy class to the program
3256- ptot = Absyn.PROGRAM(dummyClass::classes, within_, globalBuildTimes);
3257- */
3258- // translate the program
3259- p_1 = SCodeUtil . translateAbsyn2SCode(ptot);
3260-
3261- // UnitParserExt.clear();
3262- // UnitAbsynBuilder.registerUnits(ptot);
3263- // UnitParserExt.commit();
3264-
3265- // instantiate the partial class nomally as it works during checkModel.
3266- (cache, env, _, dae) = Inst . instantiateClass(inCache, InnerOuter . emptyInstHierarchy, p_1, className);
3267-
3268- dae = DAEUtil . transformationsBeforeBackend(cache,dae);
3269- // adrpo: do not store instantiated class as we don't use it later!
3270- // ic_1 = Interactive.addInstantiatedClass(ic, Interactive.INSTCLASS(className,dae,env));
3271- funcs = Env . getFunctionTree(cache);
3272- (dlow as BackendDAE . DAE ({syst},shared )) = BackendDAECreate . lower(dae, funcs, false ) "no dummy state" ;
3273- Debug . fcall("dumpdaelow" , BackendDump . dump, dlow);
3274- eqns = BackendEquation . daeEqns(syst);
3275- eqnSize = BackendDAEUtil . equationSize(eqns);
3276- vars = BackendVariable . daeVars(syst);
3277- varSize = BackendVariable . varsSize(vars);
3278- (eqnSize,varSize) = subtractDummy(vars,eqnSize,varSize);
3279- (m,_) = BackendDAEUtil . incidenceMatrix(syst,shared , BackendDAE . NORMAL ());
3280- simpleEqnSize = BackendDAEOptimize . countSimpleEquations(dlow,m);
3281- eqnSizeStr = intString(eqnSize);
3282- varSizeStr = intString(varSize);
3283- simpleEqnSizeStr = intString(simpleEqnSize);
3284-
3285- warnings = Error . printMessagesStr();
3286- retStr= stringAppendList({"Check of " ,classNameStr," completed successfully. \n\n " ,warnings," \n Class " ,classNameStr," has " ,eqnSizeStr," equation(s) and " ,
3287- varSizeStr," variable(s). \n " ,simpleEqnSizeStr," of these are trivial equation(s). \n " });
3288- then
3289- (cache,Values . STRING (retStr),st);
3290-
32913223 // handle normal models
32923224 case (cache,env,className,(st as Interactive . SYMBOLTABLE (ast = p)),msg)
32933225 equation
32943226 ptot = Dependency . getTotalProgram(className,p);
3295- // non-partial non- functions
3296- Absyn . CLASS (partialPrefix = false , restriction = restriction) = Interactive . getPathedClassInProgram(className, p);
3227+ // non-functions
3228+ Absyn . CLASS (partialPrefix = _ , restriction = restriction) = Interactive . getPathedClassInProgram(className, p);
32973229 // this case should not handle functions so here we check anything but functions!
32983230 false = listMember(restriction, {Absyn . R_FUNCTION ()});
32993231 Error . clearMessages() "Clear messages" ;
@@ -3304,8 +3236,7 @@ algorithm
33043236 // UnitAbsynBuilder.registerUnits(ptot);
33053237 // UnitParserExt.commit();
33063238
3307- (cache, env, _, dae) =
3308- Inst . instantiateClass(inCache, InnerOuter . emptyInstHierarchy, p_1, className);
3239+ (cache, env, _, dae) = Inst . instantiateClass(inCache, InnerOuter . emptyInstHierarchy, p_1, className);
33093240 dae = DAEUtil . transformationsBeforeBackend(cache, dae);
33103241 // adrpo: do not store instantiated class as we don't use it later!
33113242 // ic_1 = Interactive.addInstantiatedClass(ic, Interactive.INSTCLASS(className,dae,env));
@@ -3344,8 +3275,7 @@ algorithm
33443275 // UnitAbsynBuilder.registerUnits(ptot);
33453276 // UnitParserExt.commit();
33463277
3347- (cache, env, _) =
3348- Inst . instantiateFunctionImplicit(inCache, InnerOuter . emptyInstHierarchy, p_1, className);
3278+ (cache, env, _) = Inst . instantiateFunctionImplicit(inCache, InnerOuter . emptyInstHierarchy, p_1, className);
33493279
33503280 // adrpo: do not store instantiated class as we don't use it later!
33513281 // ic_1 = Interactive.addInstantiatedClass(ic, Interactive.INSTCLASS(className,dae,env));
@@ -3362,8 +3292,7 @@ algorithm
33623292 classNameStr = Absyn . pathString(className);
33633293 errorMsg = Error . printMessagesStr();
33643294 strEmpty = (stringCompare("" ,errorMsg)== 0 );
3365- errorMsg = Util . if_(strEmpty,"Internal error, check of model failed with no error message." ,errorMsg);
3366- // errorMsg = errorMsg +& selectIfNotEmpty("Error Buffer:\n", Print.getErrorString());
3295+ errorMsg = Util . if_(strEmpty,"Internal error! Check of: " +& classNameStr +& " failed with no error message." , errorMsg);
33673296 then
33683297 (cache,Values . STRING (errorMsg),st);
33693298
@@ -3815,7 +3744,7 @@ algorithm
38153744 print("Checking: " +& Dump . unparseClassAttributesStr(c) +& " " +& Absyn . pathString(className) +& "... " );
38163745 t1 = clock();
38173746 OptManager . setOption("checkModel" , true );
3818- (_,Values . STRING (str),_) = checkModel(cache , env, className, st, msg);
3747+ (_,Values . STRING (str),_) = checkModel(Env . emptyCache() , env, className, st, msg);
38193748 OptManager . setOption("checkModel" , false );
38203749 t2 = clock(); elapsedTime = t2 -. t1; s = realString(elapsedTime);
38213750 print (s +& " seconds -> " +& failOrSuccess(str) +& " \n\t " );
0 commit comments