Ejemplo n.º 1
0
 public Question(Id identifier,
                 Types.Type type,
                 ILabel label,
                 IExpression computation,
                 PositionInText positionInText)
     : base(positionInText)
 {
     this.Identifier  = identifier;
     this.type        = type;
     this.Label       = label;
     this.Computation = computation;
 }
Ejemplo n.º 2
0
        private INotificationManager VisitUnaryExpectedType(Unary node, Types.Type expectedType)
        {
            INotificationManager notificationManager = node.GetChildExpression().Accept(this);

            Types.Type childType = node.GetChildExpression().Accept(new ExpressionTypeCollector(idToType));

            if (childType.IsEqual(expectedType))
            {
                notificationManager.AddNotification(new IncompatibleUnaryOperator(node, childType));
            }

            return(notificationManager);
        }
        private INotificationManager Conditional_Expression_Is_BoolType(Conditional conditional)
        {
            INotificationManager notificationManager = new NotificationManager();

            Types.Type type = conditional.Condition.Accept(new ExpressionTypeCollector(identifierToType));

            if (!type.IsEqual(new Types.BoolType()))
            {
                notificationManager.AddNotification(new NonBooleanCondition(conditional.GetPosition()));
            }

            return(notificationManager);
        }
Ejemplo n.º 4
0
        private INotificationManager VisitBinaryExpectedType(Binary node, Types.Type expectedType)
        {
            INotificationManager notificationManager = new NotificationManager();

            Types.Type left  = node.Left().Accept(new ExpressionTypeCollector(idToType));
            Types.Type right = node.Right().Accept(new ExpressionTypeCollector(idToType));

            if (!(left.IsEqual(expectedType) && right.IsEqual(expectedType)))
            {
                notificationManager.AddNotification(new IncompatibleBinaryOperator(node, left, right));
            }

            return(notificationManager);
        }
Ejemplo n.º 5
0
        private INotificationManager VisitBinary(Binary node)
        {
            INotificationManager notificationManager = CollectChildrenErrors(node.Left(), node.Right());

            Types.Type left  = node.Left().Accept(new ExpressionTypeCollector(idToType));
            Types.Type right = node.Right().Accept(new ExpressionTypeCollector(idToType));

            if (!left.IsEqual(right))
            {
                notificationManager.AddNotification(new IncompatibleBinaryOperator(node, left, right));
            }

            return(notificationManager);
        }
        public INotificationManager Visit(Question question)
        {
            INotificationManager notificationManager = new NotificationManager();

            if (question.Computation != null)
            {
                notificationManager.Combine(Expression_Arguments_Are_Compatible(question.Computation));

                Types.Type type = question.Computation.Accept(new ExpressionTypeCollector(identifierToType));

                if (!type.IsEqual(question.RetrieveType()))
                {
                    notificationManager.AddNotification(new ComputedQuestionTypeConflict(question, type));
                }
            }

            return(notificationManager);
        }
Ejemplo n.º 7
0
        public static void AddValue(Id key, Types.Type type)
        {
            TypeToValueVisitor visitor = new TypeToValueVisitor();

            evaluator.AddValue(key, visitor.VisitValue(type));
        }
Ejemplo n.º 8
0
 public Values.Value VisitValue(Types.Type value)
 {
     return(Visit((dynamic)value));
 }
Ejemplo n.º 9
0
 public ComputedQuestionTypeConflict(Question node, Types.Type typeOfComputedField)
 {
     this.node = node;
     this.typeOfComputedField = typeOfComputedField;
 }
 public IncompatibleBinaryOperator(Binary node, Types.Type leftType, Types.Type rightType)
 {
     this.node      = node;
     this.rightType = rightType;
     this.leftType  = leftType;
 }
Ejemplo n.º 11
0
 public Types.Type GetCompatibleType(Types.Type rightType)
 {
     return(new Types.UndefinedType());
 }
 public IncompatibleUnaryOperator(Unary node, Types.Type childType)
 {
     this.node = node;
     this.childType = childType;
 }
 public ComputedQuestionTypeConflict(Question node, Types.Type typeOfComputedField)
 {
     this.node = node;
         this.typeOfComputedField = typeOfComputedField;
 }
Ejemplo n.º 14
0
Archivo: Value.cs Proyecto: condda/ql
 public bool IsOfType(Types.Type type)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 15
0
 public Widget VisitValue(Types.Type value)
 {
     return(Visit((dynamic)value));
 }
Ejemplo n.º 16
0
 public void SetType(Types.Type type)
 {
     this.type = type;
 }
Ejemplo n.º 17
0
 public IdToType(Id id, Types.Type type)
 {
     this.id   = id;
     this.type = type;
 }
Ejemplo n.º 18
0
 public IncompatibleUnaryOperator(Unary node, Types.Type childType)
 {
     this.node      = node;
     this.childType = childType;
 }