예제 #1
0
파일: Question.cs 프로젝트: condda/ql
 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;
 }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #7
0
        public static void AddValue(Id key, Types.Type type)
        {
            TypeToValueVisitor visitor = new TypeToValueVisitor();

            evaluator.AddValue(key, visitor.VisitValue(type));
        }
예제 #8
0
 public Values.Value VisitValue(Types.Type value)
 {
     return(Visit((dynamic)value));
 }
예제 #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;
 }
예제 #11
0
파일: Priority.cs 프로젝트: condda/ql
 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;
 }
예제 #14
0
파일: Value.cs 프로젝트: condda/ql
 public bool IsOfType(Types.Type type)
 {
     throw new NotImplementedException();
 }
예제 #15
0
 public Widget VisitValue(Types.Type value)
 {
     return(Visit((dynamic)value));
 }
예제 #16
0
 public void SetType(Types.Type type)
 {
     this.type = type;
 }
예제 #17
0
 public IdToType(Id id, Types.Type type)
 {
     this.id   = id;
     this.type = type;
 }
예제 #18
0
 public IncompatibleUnaryOperator(Unary node, Types.Type childType)
 {
     this.node      = node;
     this.childType = childType;
 }