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; }
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); }
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); }
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); }
public static void AddValue(Id key, Types.Type type) { TypeToValueVisitor visitor = new TypeToValueVisitor(); evaluator.AddValue(key, visitor.VisitValue(type)); }
public Values.Value VisitValue(Types.Type value) { return(Visit((dynamic)value)); }
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; }
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 bool IsOfType(Types.Type type) { throw new NotImplementedException(); }
public Widget VisitValue(Types.Type value) { return(Visit((dynamic)value)); }
public void SetType(Types.Type type) { this.type = type; }
public IdToType(Id id, Types.Type type) { this.id = id; this.type = type; }