Exemple #1
0
        public override void EnterStructAss(LatteParser.StructAssContext context)
        {
            var expressionVisitor = new ExpressionTypeVisitor();
            var objectType        = expressionVisitor.GetFieldType(context.expr()[0], context.ID().GetText(), context.start.Line);
            var exprType          = new ExpressionTypeVisitor().Visit(context.expr()[1]);

            if (!objectType.Equals(exprType) && !IsTypeParent(exprType, objectType))
            {
                StateUtils.InterruptWithMessage(
                    context.start.Line,
                    context.ID().Symbol.Column,
                    ErrorMessages.FieldExprTypesMismatch(objectType.GetText(), context.ID().GetText()));
            }
        }
Exemple #2
0
 public StructAss(LatteParser.StructAssContext context)
 {
     IdExpr = Exprs.Utils.ExprFromExprContext(context.expr()[0]);
     Expr   = Exprs.Utils.ExprFromExprContext(context.expr()[1]);
     Id     = context.ID().GetText();
 }