fn generate_unary(&mut self, ast: &Ast, node: NodeId) -> Result<ExpressionResult, Error> {
      let (left, _) = ast.node_pair(node);
      self.generate_node(ast, left, Expression::Used)?;
      match ast.kind(node) {
         NodeKind::Negate => self.chunk.emit(Opcode::Negate),
         NodeKind::Not => self.chunk.emit(Opcode::Not),
         _ => unreachable!(),
      };
      Ok(ExpressionResult::Present)
   }
/// Generates code for a unary operator.
Generates code for a unary operator.
Generates code for a unary operator .
fn generate_unary(&mut self, ast: &Ast, node: NodeId) -> Result<ExpressionResult, Error> {
      let (left, _) = ast.node_pair(node);
      self.generate_node(ast, left, Expression::Used)?;
      match ast.kind(node) {
         NodeKind::Negate => self.chunk.emit(Opcode::Negate),
         NodeKind::Not => self.chunk.emit(Opcode::Not),
         _ => unreachable!(),
      };
      Ok(ExpressionResult::Present)
   }
fn generate_unary ( & mut self , ast : & Ast , node : NodeId ) -> Result < ExpressionResult , Error > { let ( left , _ ) = ast . node_pair ( node ) ; self . generate_node ( ast , left , Expression :: Used ) ? ; match ast . kind ( node ) { NodeKind :: Negate => self . chunk . emit ( Opcode :: Negate ) , NodeKind :: Not => self . chunk . emit ( Opcode :: Not ) , _ => unreachable ! ( ) , } ; Ok ( ExpressionResult :: Present ) }
Generates code for a unary operator.
Generates code for a unary operator .
&mut self
ast
&Ast
node
NodeId