Skip to content
Snippets Groups Projects
Commit a4038f9a authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

function : remove bug in substituted functions

parent 09e447c7
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "dlfcn.h" #include "dlfcn.h"
#endif #endif
#include "Bindings.h" #include "Bindings.h"
function::~function() { function::~function() {
} }
...@@ -51,8 +50,7 @@ dataCacheDouble::dataCacheDouble(dataCacheMap *m, function *f): ...@@ -51,8 +50,7 @@ dataCacheDouble::dataCacheDouble(dataCacheMap *m, function *f):
m->addDataCacheDouble(this, f->isInvalitedOnElement()); m->addDataCacheDouble(this, f->isInvalitedOnElement());
_function = f; _function = f;
for(unsigned i=0; i<f->_childrenCache.size(); i++) { for(unsigned i=0; i<f->_childrenCache.size(); i++) {
m->addSecondaryCache(m->newChild()); m->addSecondaryCache(m->newChild()); }
}
_substitutions.resize(f->_substitutedFunctions.size()); _substitutions.resize(f->_substitutedFunctions.size());
for(unsigned i=0; i<f->_substitutedFunctions.size(); i++) { for(unsigned i=0; i<f->_substitutedFunctions.size(); i++) {
function::substitutedFunction s = f->_substitutedFunctions[i]; function::substitutedFunction s = f->_substitutedFunctions[i];
...@@ -92,9 +90,10 @@ dataCacheDouble &dataCacheMap::get(const function *f, dataCacheDouble *caller) { ...@@ -92,9 +90,10 @@ dataCacheDouble &dataCacheMap::get(const function *f, dataCacheDouble *caller) {
dataCacheDouble *&r = _cacheDoubleMap[f]; dataCacheDouble *&r = _cacheDoubleMap[f];
dataCacheMap *cParent = _parent; dataCacheMap *cParent = _parent;
while (cParent && r==NULL) { while (cParent && r==NULL) {
std::map<const function *, dataCacheDouble *>::iterator it = cParent->_cacheDoubleMap.find(f); /*std::map<const function *, dataCacheDouble *>::iterator it = cParent->_cacheDoubleMap.find(f);
if (it != cParent->_cacheDoubleMap.end()) { if (it != cParent->_cacheDoubleMap.end()) {*/
r = it->second; // r = it->second;
r = &_parent->get(f,caller);
for (std::set<dataCacheDouble*>::iterator dep = r->_iDependOn.begin(); dep != r->_iDependOn.end(); dep++) { for (std::set<dataCacheDouble*>::iterator dep = r->_iDependOn.begin(); dep != r->_iDependOn.end(); dep++) {
//if (_cacheDoubleMap.find((*dep)->_function) != _cacheDoubleMap.end()) { //if (_cacheDoubleMap.find((*dep)->_function) != _cacheDoubleMap.end()) {
if (&get((*dep)->_function) != *dep) { if (&get((*dep)->_function) != *dep) {
...@@ -102,7 +101,7 @@ dataCacheDouble &dataCacheMap::get(const function *f, dataCacheDouble *caller) { ...@@ -102,7 +101,7 @@ dataCacheDouble &dataCacheMap::get(const function *f, dataCacheDouble *caller) {
break; break;
} }
} }
} //}
cParent = cParent->_parent; cParent = cParent->_parent;
} }
if (r==NULL) if (r==NULL)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment