From 913bd173c335996393ed23cae8f103b782e49076 Mon Sep 17 00:00:00 2001 From: dehnert Date: Thu, 13 Jun 2013 11:29:09 +0200 Subject: [PATCH] Fix: local indices of variables are now treated correctly. --- src/parser/prismparser/PrismGrammar.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/parser/prismparser/PrismGrammar.cpp b/src/parser/prismparser/PrismGrammar.cpp index 992e9c039..2b59fdf5d 100644 --- a/src/parser/prismparser/PrismGrammar.cpp +++ b/src/parser/prismparser/PrismGrammar.cpp @@ -80,15 +80,19 @@ Module PrismGrammar::createModule(std::string const& name, std::vector const& lower, std::shared_ptr const& upper, std::shared_ptr const& init, std::vector& vars, std::map& varids) { uint_fast64_t id = this->state->addIntegerVariable(name); - vars.emplace_back(this->state->nextLocalIntegerVariableIndex++, id, name, lower, upper, init); - varids[name] = id; + uint_fast64_t newLocalIndex = this->state->nextLocalIntegerVariableIndex; + vars.emplace_back(newLocalIndex, id, name, lower, upper, init); + varids[name] = newLocalIndex; + ++this->state->nextLocalIntegerVariableIndex; this->state->localIntegerVariables_.add(name, name); } void PrismGrammar::createBooleanVariable(std::string const& name, std::shared_ptr const& init, std::vector& vars, std::map& varids) { uint_fast64_t id = this->state->addBooleanVariable(name); - vars.emplace_back(this->state->nextLocalIntegerVariableIndex++, id, name, init); - varids[name] = id; + uint_fast64_t newLocalIndex = this->state->nextLocalBooleanVariableIndex; + vars.emplace_back(newLocalIndex, id, name, init); + varids[name] = newLocalIndex; + ++this->state->nextLocalBooleanVariableIndex; this->state->localBooleanVariables_.add(name, name); }