diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-23 16:51:52 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-23 16:51:52 +0300 |
commit | 5b246024eb964756df6e8bc6ae527f259643c38f (patch) | |
tree | 7895fabe1720e6b6d597e83e2edcd3b6b47cd1ec /src/analysis/expression.cpp | |
parent | 14f3039f4e8a41e31a2e10a79076461650776530 (diff) | |
download | paranucker-5b246024eb964756df6e8bc6ae527f259643c38f.tar.gz paranucker-5b246024eb964756df6e8bc6ae527f259643c38f.tar.bz2 paranucker-5b246024eb964756df6e8bc6ae527f259643c38f.tar.xz paranucker-5b246024eb964756df6e8bc6ae527f259643c38f.zip |
Move TRUTH_ANDIF_EXPR analysis into shared function.
Diffstat (limited to 'src/analysis/expression.cpp')
-rw-r--r-- | src/analysis/expression.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/analysis/expression.cpp b/src/analysis/expression.cpp index 8ebb783..a9fb275 100644 --- a/src/analysis/expression.cpp +++ b/src/analysis/expression.cpp @@ -185,23 +185,19 @@ void analyseTruthOrIfExpr(TruthOrIfExprNode *node, const WalkItem &wi, WalkItem Log::dumpWI(node, "wo out ", wo); } -void analyseTruthAndIfExpr(TruthAndIfExprNode *node, const WalkItem &wi, WalkItem &wo) +void analyseAndCondition(Node *node, Node *node1, Node *node2, const WalkItem &wi, WalkItem &wo) { - // need two args for check - if (node->args.size() < 2 || command == FindArgs) - return; - Log::dumpWI(node, "wo in ", wo); WalkItem wo1 = wo; WalkItem wo2 = wo; - walkTree(node->args[0], wi, wo1); + walkTree(node1, wi, wo1); Log::dumpWI(node, "wo1 ", wo1); WalkItem wi2 = wi; removeCheckNullVarsSet(wi2, wo1.checkedNonNullVars); wi2.checkNullVars.insert(wo1.checkedNullVars.begin(), wo1.checkedNullVars.end()); Log::dumpWI(node, "wi2 ", wi2); - walkTree(node->args[1], wi2, wo2); + walkTree(node2, wi2, wo2); Log::dumpWI(node, "wo2 ", wo2); wo.stopWalking = true; @@ -223,6 +219,15 @@ void analyseTruthAndIfExpr(TruthAndIfExprNode *node, const WalkItem &wi, WalkIte Log::dumpWI(node, "wo out ", wo); } +void analyseTruthAndIfExpr(TruthAndIfExprNode *node, const WalkItem &wi, WalkItem &wo) +{ + // need two args for check + if (node->args.size() < 2 || command == FindArgs) + return; + + analyseAndCondition(node, node->args[0], node->args[1], wi, wo); +} + // args[0] condition // args[1] true expr // args[2] false expr |