pub fn from<C: DiagEmitter>(ast: Spanned<ast::UnaryOp>, ctx: C) -> Result<Spanned<UnaryOp>> {
        let op = match ast.value {
            ast::UnaryOp::Not => UnaryOp::Not,
            ast::UnaryOp::Abs => UnaryOp::Abs,
            ast::UnaryOp::Sign(ast::Sign::Pos) => UnaryOp::Pos,
            ast::UnaryOp::Sign(ast::Sign::Neg) => UnaryOp::Neg,
            ast::UnaryOp::Logical(op) => UnaryOp::Logical(op),
            ast::UnaryOp::Condition => UnaryOp::Cond,
            _ => {
                ctx.emit(DiagBuilder2::error("invalid unary operator").span(ast.span));
                return Err(());
            }
        };
        Ok(Spanned::new(op, ast.span))
    }
/// Map an AST unary operator to a HIR unary operator.
///
/// Emits an error if the operator is not a valid unary operator.
Map an AST unary operator to a HIR unary operator.
Emits an error if the operator is not a valid unary operator.
Map an AST unary operator to a HIR unary operator . Emits an error if the operator is not a valid unary operator .
pub fn from<C: DiagEmitter>(ast: Spanned<ast::UnaryOp>, ctx: C) -> Result<Spanned<UnaryOp>> {
        let op = match ast.value {
            ast::UnaryOp::Not => UnaryOp::Not,
            ast::UnaryOp::Abs => UnaryOp::Abs,
            ast::UnaryOp::Sign(ast::Sign::Pos) => UnaryOp::Pos,
            ast::UnaryOp::Sign(ast::Sign::Neg) => UnaryOp::Neg,
            ast::UnaryOp::Logical(op) => UnaryOp::Logical(op),
            ast::UnaryOp::Condition => UnaryOp::Cond,
            _ => {
                ctx.emit(DiagBuilder2::error("invalid unary operator").span(ast.span));
                return Err(());
            }
        };
        Ok(Spanned::new(op, ast.span))
    }
pub fn from < C : DiagEmitter > ( ast : Spanned < ast :: UnaryOp > , ctx : C ) -> Result < Spanned < UnaryOp > > { let op = match ast . value { ast :: UnaryOp :: Not => UnaryOp :: Not , ast :: UnaryOp :: Abs => UnaryOp :: Abs , ast :: UnaryOp :: Sign ( ast :: Sign :: Pos ) => UnaryOp :: Pos , ast :: UnaryOp :: Sign ( ast :: Sign :: Neg ) => UnaryOp :: Neg , ast :: UnaryOp :: Logical ( op ) => UnaryOp :: Logical ( op ) , ast :: UnaryOp :: Condition => UnaryOp :: Cond , _ => { ctx . emit ( DiagBuilder2 :: error ( " " ) . span ( ast . span ) ) ; return Err ( ( ) ) ; } } ; Ok ( Spanned :: new ( op , ast . span ) ) }
Map an AST unary operator to a HIR unary operator.
Map an AST unary operator to a HIR unary operator .
ast
Spanned<ast::UnaryOp>
ctx
C
ast
Spanned<ast::UnaryOp>
ctx
C