Commit 4e95bdd8 authored by dbarbera's avatar dbarbera
Browse files

Added Ada code generation for not expressions with SeqOf operands

parent a7dd606d
......@@ -993,12 +993,29 @@ def _bitwise_operators(expr):
@expression.register(ogAST.ExprNot)
def _not_expression(expr):
''' Generate the code for a not expression '''
code, local_decl = [], []
expr_stmts, expr_str, expr_local = expression(expr.expr)
basic_type = find_basic_type(expr.exprType)
if basic_type.kind != 'BooleanType':
expr_payload = expr_str + string_payload(expr.expr, expr_str)
ada_string = u'(Data => (not {expr}))'.format(expr=expr_payload)
else:
ada_string = u'(not {expr})'.format(expr=expr_str)
code.extend(expr_stmts)
local_decl.extend(expr_local)
return code, unicode(ada_string), local_decl
@expression.register(ogAST.ExprNeg)
def _unary_operator(expr):
''' Generate the code for an unary expression '''
def _neg_expression(expr):
''' Generate the code for a negative expression '''
code, local_decl = [], []
expr_stmts, expr_str, expr_local = expression(expr.expr)
ada_string = u'({op} {expr})'.format(op=expr.operand, expr=expr_str)
ada_string = u'(-{expr})'.format(op=expr.operand, expr=expr_str)
code.extend(expr_stmts)
local_decl.extend(expr_local)
return code, unicode(ada_string), local_decl
......
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