示例#1
0
        public override Base VisitUnary_op([NotNull] GolangParser.Unary_opContext context)
        {
            EUnaryOp op = EUnaryOp.Unknown;

            switch (context.GetText())
            {
            case "-":
                op = EUnaryOp.Negative;
                break;

            case "+":
                op = EUnaryOp.Positive;
                break;

            case "!":
                op = EUnaryOp.Not;
                break;

            case "^":
                op = EUnaryOp.Xor;
                break;

            case "*":
                op = EUnaryOp.Dereference;
                break;

            case "&":
                op = EUnaryOp.Reference;
                break;

            case "<-":
                op = EUnaryOp.Send;
                break;
            }

            return(new UnaryOpWrapper(op));
        }
示例#2
0
 public UnaryExpression(EUnaryOp op, Expression expr)
     : base(true, 1)
 {
     Expr = expr;
     Op   = op;
 }
示例#3
0
 public UnaryOpWrapper(EUnaryOp op)
 {
     Op = op;
 }