Exemplo n.º 1
0
        public override void EnterRet(LatteParser.RetContext context)
        {
            var func     = _environment.CurrentFunction;
            var exprType = new ExpressionTypeVisitor().Visit(context.expr());

            if (!func.Type.Equals(exprType))
            {
                _errorState.AddErrorMessage(new ErrorMessage(
                                                context.start.Line,
                                                context.start.Column,
                                                ErrorMessages.WrongReturn(
                                                    exprType.ToString(),
                                                    func.Type.ToString(),
                                                    func.Id)));
            }
        }
Exemplo n.º 2
0
 public Ret(LatteParser.RetContext context)
 {
     Expr = Exprs.Utils.ExprFromExprContext(context.expr());
 }