Commit 96783939 authored by 4ast's avatar 4ast

Merge pull request #23 from plumgrid/bblanco_dev

Return 0 in lookup_or_init error path
parents d550d328 d23d6995
...@@ -69,7 +69,7 @@ bool BTypeVisitor::VisitCallExpr(CallExpr *Call) { ...@@ -69,7 +69,7 @@ bool BTypeVisitor::VisitCallExpr(CallExpr *Call) {
txt += "if (!leaf) {"; txt += "if (!leaf) {";
txt += " " + update + ", " + arg0 + ", " + arg1 + ", " + map_update_policy + ");"; txt += " " + update + ", " + arg0 + ", " + arg1 + ", " + map_update_policy + ");";
txt += " leaf = " + lookup + ", " + arg0 + ");"; txt += " leaf = " + lookup + ", " + arg0 + ");";
txt += " if (!leaf) return -1;"; txt += " if (!leaf) return 0;";
txt += "}"; txt += "}";
txt += "leaf;})"; txt += "leaf;})";
} else { } else {
...@@ -137,7 +137,7 @@ bool BTypeVisitor::VisitArraySubscriptExpr(ArraySubscriptExpr *Arr) { ...@@ -137,7 +137,7 @@ bool BTypeVisitor::VisitArraySubscriptExpr(ArraySubscriptExpr *Arr) {
txt += " typeof(" + name + ".leaf) zleaf = {0};"; txt += " typeof(" + name + ".leaf) zleaf = {0};";
txt += " " + update + ", " + args + ", &zleaf, " + map_update_policy + ");"; txt += " " + update + ", " + args + ", &zleaf, " + map_update_policy + ");";
txt += " leaf = " + lookup + ", " + args + ");"; txt += " leaf = " + lookup + ", " + args + ");";
txt += " if (!leaf) return -1;"; txt += " if (!leaf) return 0;";
txt += "}"; txt += "}";
txt += "leaf;}))"; txt += "leaf;}))";
rewriter_.ReplaceText(SourceRange(Arr->getLocStart(), Arr->getLocEnd()), txt); rewriter_.ReplaceText(SourceRange(Arr->getLocStart(), Arr->getLocEnd()), txt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment