def gen_unary_expression(self,node,context):
"""
:type node:TreeNode
:type context:Context
:rtype: str
"""
operand=self.expression_handler[node[2][0]](node[2],context)
if isinstance(node[1],TreeNode):
operator=self.gen_unary_operator(node[1],context)
if operator=="&":
if isinstance(operand,Data):
ret=self.tools.lea(operand)
operand.type.is_const.append(False)
return ret
elif operator=="*":
if isinstance(operand,Data):
self.tools.mov(self.tools.getEax(),operand)
operand.name=self.tools.getNull()
operand.offset=True
operand.type.is_const.pop()
return operand
else:
if node[1]=="++":
ret=self.tools.add(operand,1)
self.tools.mov(operand,ret)
return operand
elif node[1]=="--":
self.tools.sub(operand,1)
return operand
评论列表
文章目录