Skip to content

Commit

Permalink
Reset tmpTick also for each statement, and after pattern-matching
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@18028 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 6, 2013
1 parent 9179cfe commit 35a3b09
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Compiler/Template/CodegenC.tpl
Expand Up @@ -6234,7 +6234,9 @@ end extractParFors_impl;
template algStatement(DAE.Statement stmt, Context context, Text &varDecls /*BUFP*/)
"Generates an algorithm statement."
::=
let res = match stmt
match System.tmpTickIndexReserve(1, 0) /* Remember the old tmpTick */
case oldIndex
then let res = (match stmt
case s as STMT_ASSIGN(exp1=PATTERN(__)) then algStmtAssignPattern(s, context, &varDecls /*BUFD*/)
case s as STMT_ASSIGN(__) then algStmtAssign(s, context, &varDecls /*BUFD*/)
case s as STMT_ASSIGN_ARR(__) then algStmtAssignArr(s, context, &varDecls /*BUFD*/)
Expand All @@ -6254,7 +6256,8 @@ template algStatement(DAE.Statement stmt, Context context, Text &varDecls /*BUFP
case s as STMT_RETURN(__) then 'goto _return;<%\n%>'
case s as STMT_NORETCALL(__) then algStmtNoretcall(s, context, &varDecls /*BUFD*/)
case s as STMT_REINIT(__) then algStmtReinit(s, context, &varDecls /*BUFD*/)
else error(sourceInfo(), 'ALG_STATEMENT NYI')
else error(sourceInfo(), 'ALG_STATEMENT NYI'))
let () = System.tmpTickSetIndex(oldIndex,1)
<<
<%modelicaLine(getElementSourceFileInfo(getStatementSource(stmt)))%>
<%res%>
Expand Down Expand Up @@ -8894,6 +8897,7 @@ template daeExpMatchCases(list<MatchCase> cases, list<Exp> tupleAssignExps, DAE.
let &preRes = buffer ""
let &varFrees = buffer "" /*BUFF*/
let patternMatching = (c.patterns |> lhs hasindex i0 => patternMatch(lhs,'<%getTempDeclMatchInputName(inputs, prefix, startIndexInputs, i0)%>',onPatternFail,&varDeclsCaseInner,&assignments); empty)
let() = System.tmpTickSetIndex(startTmpTickIndex,1)
let stmts = (c.body |> stmt => algStatement(stmt, context, &varDeclsCaseInner); separator="\n")
let &preGuardCheck = buffer ""
let guardCheck = (match patternGuard case SOME(exp) then 'if (!<%daeExp(exp,context,&preGuardCheck,&varDeclsCaseInner)%>) <%onPatternFail%>;<%\n%>')
Expand Down

0 comments on commit 35a3b09

Please sign in to comment.