summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp3
-rw-r--r--src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp2
-rw-r--r--test/issues/test-issue109.scxml17
-rw-r--r--test/issues/test-issue110.scxml42
4 files changed, 61 insertions, 3 deletions
diff --git a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
index 647738a..890b8cf 100644
--- a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
@@ -227,7 +227,7 @@ std::shared_ptr<DataModelImpl> LuaDataModel::create(DataModelCallbacks* callback
}
}
} catch (luabridge::LuaException e) {
- LOG(_callbacks->getLogger(), USCXML_INFO) << e.what();
+ LOG(dm->_callbacks->getLogger(), USCXML_INFO) << e.what();
}
luabridge::getGlobalNamespace(dm->_luaState).beginClass<LuaDataModel>("DataModel").endClass();
@@ -561,7 +561,6 @@ void LuaDataModel::assign(const std::string& location, const Data& data, const s
}
-
// std::cout << Data::toJSON(evalAsData(location)) << std::endl;
}
}
diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
index e0812d0..1248205 100644
--- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
+++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
@@ -184,7 +184,7 @@ void USCXMLInvoker::invoke(const std::string& source, const Event& invokeEvent)
InterpreterImpl* invoked = _invokedInterpreter.getImpl().get();
ActionLanguage* alOrig = _callbacks->getActionLanguage();
if (alOrig != NULL) {
- ActionLanguage al = *alOrig; // invokes copy operator
+ ActionLanguage al;
// create new instances
al.execContent = alOrig->execContent.getImpl()->create(invoked);
al.delayQueue = alOrig->delayQueue.getImplDelayed()->create(invoked);
diff --git a/test/issues/test-issue109.scxml b/test/issues/test-issue109.scxml
new file mode 100644
index 0000000..bb366dd
--- /dev/null
+++ b/test/issues/test-issue109.scxml
@@ -0,0 +1,17 @@
+<scxml datamodel="lua" initial="StateShape1" name="ScxmlShape1" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
+ <datamodel>
+ <data id="VarArray">{ 0, 0, 0 }</data>
+ <data expr="1" id="Var1"/>
+ </datamodel>
+ <state id="StateShape1">
+ <onentry>
+ <assign expr="555" location="VarArray[Var1]"/>
+ </onentry>
+ <transition cond="VarArray[1]~=0" target="Pass"/>
+ <transition event="error.*" target="Fail"/>
+ <transition cond="VarArray[1]==0" target="Unknown"/>
+ </state>
+ <final id="Pass"/>
+ <final id="Fail"/>
+ <final id="Unknown"/>
+</scxml>
diff --git a/test/issues/test-issue110.scxml b/test/issues/test-issue110.scxml
new file mode 100644
index 0000000..4d50324
--- /dev/null
+++ b/test/issues/test-issue110.scxml
@@ -0,0 +1,42 @@
+<scxml datamodel="lua" initial="s0" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
+ <datamodel>
+ <data expr="1" id="Var1"/>
+ </datamodel>
+ <state id="s0">
+ <onentry>
+ <send delay="2000" event="timeout" xmlns:scxml="http://www.w3.org/2005/07/scxml"/>
+ </onentry>
+ <invoke type="http://www.w3.org/TR/scxml/">
+ <content>
+ <scxml datamodel="lua" initial="sub0" name="ScxmlShape1" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
+ <datamodel>
+ <data expr="555" id="VarXXX"/>
+ </datamodel>
+ <final id="subFinal"/>
+ <state id="sub0">
+ <transition cond="Var1==1" target="subFinal">
+ <log expr="Var1" label="Var1 is supposed to be out of scope" />
+ <send target="#_parent" event="failure"/>
+ </transition>
+ <transition target="subFinal">
+ <send target="#_parent" event="success"/>
+ </transition>
+ </state>
+ </scxml>
+ </content>
+ </invoke>
+ <transition event="success" cond="not VarXXX" target="pass"/>
+ <transition event="*" target="fail"/>
+ </state>
+ <final id="pass" xmlns:scxml="http://www.w3.org/2005/07/scxml">
+ <onentry>
+ <log expr="'pass'" label="Outcome"/>
+ <log expr="VarXXX" label="We mustn't see VarXXX here"/>
+ </onentry>
+ </final>
+ <final id="fail" xmlns:scxml="http://www.w3.org/2005/07/scxml">
+ <onentry>
+ <log expr="'fail'" label="Outcome"/>
+ </onentry>
+ </final>
+</scxml>