fn generate_return(&mut self, ast: &Ast, node: NodeId) -> Result<ExpressionResult, Error> {
      let (value, _) = ast.node_pair(node);
      // Unlike breaking out of a loop, returning is super simple, as it implies that all locals
      // are taken off the stack.
      if value == NodeId::EMPTY {
         let _ = self.generate_nil();
      } else {
         self.generate_node(ast, value, Expression::Used)?;
      }
      self.chunk.emit(Opcode::Return);
      Ok(ExpressionResult::NoReturn)
   }
/// Generates code for a `return` expression.
Generates code for a `return` expression.
Generates code for a ` return ` expression .
fn generate_return(&mut self, ast: &Ast, node: NodeId) -> Result<ExpressionResult, Error> {
      let (value, _) = ast.node_pair(node);
      // Unlike breaking out of a loop, returning is super simple, as it implies that all locals
      // are taken off the stack.
      if value == NodeId::EMPTY {
         let _ = self.generate_nil();
      } else {
         self.generate_node(ast, value, Expression::Used)?;
      }
      self.chunk.emit(Opcode::Return);
      Ok(ExpressionResult::NoReturn)
   }
fn generate_return ( & mut self , ast : & Ast , node : NodeId ) -> Result < ExpressionResult , Error > { let ( value , _ ) = ast . node_pair ( node ) ; // Unlike breaking out of a loop, returning is super simple, as it implies that all locals // are taken off the stack. if value == NodeId :: EMPTY { let _ = self . generate_nil ( ) ; } else { self . generate_node ( ast , value , Expression :: Used ) ? ; } self . chunk . emit ( Opcode :: Return ) ; Ok ( ExpressionResult :: NoReturn ) }
Generates code for a `return` expression.
Generates code for a ` return ` expression .
&mut self
ast
&Ast
node
NodeId