Added mem::safe_recursive_clone, and while it works for regex, it's actually slower then remaking it. Hmmmm, maybe because some of the stdlib is inefficent

This commit is contained in:
Nathan Braswell
2015-07-07 00:46:00 -04:00
parent 92f5c63c9a
commit f3cdea068e
9 changed files with 68 additions and 26 deletions

View File

@@ -566,7 +566,11 @@ CCodeTriple CGenerator::generate(NodeTree<ASTData>* from, NodeTree<ASTData>* enc
output.value += toAssign.postValue;
return output;
} else {
return ValueTypeToCType(children[0]->getData().valueType, generate(children[0], enclosingObject, justFuncName, enclosingFunction).oneString()) + " = " + generate(children[1], enclosingObject, true, enclosingFunction) + ";";
// we might use this address in the right hand side (recursive closures), so split it up
std::string assignTo = generate(children[0], enclosingObject, justFuncName, enclosingFunction).oneString();
output.preValue = ValueTypeToCType(children[0]->getData().valueType, assignTo) + ";\n";
output += assignTo + " = " + generate(children[1], enclosingObject, true, enclosingFunction) + ";";
return output;
}
}
case if_comp: