Fixed the processing of O_NOT operations.
This commit is contained in:
parent
918f76b263
commit
f49dfce302
1 changed files with 6 additions and 4 deletions
10
src/op.cc
10
src/op.cc
|
|
@ -56,8 +56,8 @@ expr_t::ptr_op_t expr_t::op_t::compile(scope_t& scope)
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
ptr_op_t lhs(left()->compile(scope));
|
ptr_op_t lhs(left()->compile(scope));
|
||||||
ptr_op_t rhs(has_right() ? (kind == O_LOOKUP ?
|
ptr_op_t rhs(kind > UNARY_OPERATORS && has_right() ?
|
||||||
right() : right()->compile(scope)) :
|
(kind == O_LOOKUP ? right() : right()->compile(scope)) :
|
||||||
ptr_op_t());
|
ptr_op_t());
|
||||||
|
|
||||||
if (lhs == left() && (! rhs || rhs == right()))
|
if (lhs == left() && (! rhs || rhs == right()))
|
||||||
|
|
@ -264,14 +264,16 @@ bool expr_t::op_t::print(std::ostream& out, const context_t& context) const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case O_NOT:
|
case O_NOT:
|
||||||
out << "!";
|
out << "!(";
|
||||||
if (left() && left()->print(out, context))
|
if (left() && left()->print(out, context))
|
||||||
found = true;
|
found = true;
|
||||||
|
out << ")";
|
||||||
break;
|
break;
|
||||||
case O_NEG:
|
case O_NEG:
|
||||||
out << "-";
|
out << "-(";
|
||||||
if (left() && left()->print(out, context))
|
if (left() && left()->print(out, context))
|
||||||
found = true;
|
found = true;
|
||||||
|
out << ")";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case O_ADD:
|
case O_ADD:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue