public override Lazy <object> VisitPostfixUnaryExpression( QuestScriptParser.PostfixUnaryExpressionContext context) { var type = _scriptEnvironmentBuilder.TypeInferenceVisitor.Visit(context.expr); if (!TypeUtil.IsNumeric(type)) { _scriptEnvironmentBuilder.Errors.Add(new UnexpectedTypeException(context, ObjectType.Integer, type, context.expr, "Expected the incremented expression to be numeric, but it wasn't.")); return(new Lazy <object>(() => null)); } dynamic GetValueOfExpression(ParserRuleContext expr) { return(expr.Accept(this).Value.GetValueOrLazyValue()); } switch (context.op.Text) { case "++": return(new Lazy <object>(() => { var plusplus = GetValueOfExpression(context.expr); return (object)++plusplus; })); case "--": return(new Lazy <object>(() => { var minusminus = GetValueOfExpression(context.expr); return (object)--minusminus; })); } return(base.VisitPostfixUnaryExpression(context)); }
public override ObjectType VisitPostfixUnaryExpression(QuestScriptParser.PostfixUnaryExpressionContext context) { return(context.expr.Accept(this)); }