Changeset d9e7af7 in OpenModelica for Compiler/Script/CevalScriptBackend.mo


Ignore:
Timestamp:
2016-02-03T14:22:33+01:00 (8 years ago)
Author:
Martin Sjölund <martin.sjolund@…>
Branches:
Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
Children:
8d53fa9
Parents:
521a5df
Message:

Add a sanity check to the Modelica diff tool

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Compiler/Script/CevalScriptBackend.mo

    re2d5aa8 rd9e7af7  
    103103import Settings;
    104104import SimulationResults;
     105import StringUtil;
    105106import SymbolicJacobian;
    106107import TaskGraphResults;
     
    667668  (outCache,outValue,outInteractiveSymbolTable) := matchcontinue (inCache,inEnv,inFunctionName,inVals,inSt,msg)
    668669    local
    669       String omdev,simflags,s1,s2,s3,str,str1,str2,str3,token,varid,cmd,executable,executable1,encoding,method_str,
     670      String omdev,simflags,s1,s2,s3,s4,str,str1,str2,str3,token,varid,cmd,executable,executable1,encoding,method_str,
    670671             outputFormat_str,initfilename,pd,executableSuffixedExe,sim_call,result_file,filename_1,filename,
    671672             call,str_1,mp,pathstr,name,cname,errMsg,errorStr,
     
    714715      GlobalScript.Statements istmts;
    715716      list<GlobalScript.Statements> istmtss;
    716       Boolean have_corba, bval, anyCode, b, b1, b2, externalWindow, logX, logY, autoScale, forceOMPlot, gcc_res, omcfound, rm_res, touch_res, uname_res,  ifcpp, ifmsvc,sort, builtin, showProtected, inputConnectors, outputConnectors;
     717      Boolean have_corba, bval, anyCode, b, b1, b2, externalWindow, logX, logY, autoScale, forceOMPlot, gcc_res, omcfound, rm_res, touch_res, uname_res,  ifcpp, ifmsvc,sort, builtin, showProtected, inputConnectors, outputConnectors, sanityCheckFailed;
    717718      FCore.Cache cache;
    718719      list<GlobalScript.LoadedFile> lf;
     
    876877        SimCodeFunctionUtil.execStat("treeDiff");
    877878
     879        sanityCheckFailed := false;
     880
     881        if true then
     882          // Do a sanity check
     883          s3 := Dump.unparseStr(Parser.parsestring(s2));
     884          s4 := Dump.unparseStr(Parser.parsestring(printActual(treeDiffs, SimpleModelicaParser.parseTreeNodeStr)));
     885          if not StringUtil.equalIgnoreSpace(s3, s4) then
     886            Error.addInternalError("After merging the strings, the semantics changed for some reason (will simply return s2):\n"+s3+"\n"+s4, sourceInfo());
     887            sanityCheckFailed := true;
     888          end if;
     889        end if;
     890
    878891        /*
    879892        diffs := diff(tokens1, tokens2, modelicaDiffTokenEq, modelicaDiffTokenWhitespace, tokenContent);
     
    893906        SimCodeFunctionUtil.execStat("diffModelicaFileListings filter diff 2");
    894907        */
    895         str := matchcontinue Absyn.pathLastIdent(path)
     908        str := if sanityCheckFailed then s2 else matchcontinue Absyn.pathLastIdent(path)
    896909          case "plain" then printActual(treeDiffs, SimpleModelicaParser.parseTreeNodeStr);
    897910          case "color" then printDiffTerminalColor(treeDiffs, SimpleModelicaParser.parseTreeNodeStr);
Note: See TracChangeset for help on using the changeset viewer.