Exemplo n.º 1
0
        public void Visit(StatementUnit node)
        {
            node.Expression.Accept(this);

            DeclareNewVariable(node.Identifier, node.DataType);

            if (node.DataType.GetReturnType() != DetermineType(node.Expression))
            {
                Exceptions.Add(new TypeCheckerError(String.Format(
                                                        "Expression inside the statement declared as {0}, but resolves into type {1} instead",
                                                        node.DataType.GetReturnType(),
                                                        DetermineType(node.Expression))));
            }
        }
Exemplo n.º 2
0
        public void Visit(StatementUnit node)
        {
            ITerminalWrapper evaluatedResult = ReferenceTables.GetValueOrNull(node.Expression);

            node.Value = evaluatedResult;

            WidgetBase unitWrapper = _widgetFactory.GetWidget(node);

            unitWrapper.Visibility = _parentExpressionDidNotEvaluate ? Visibility.Collapsed : Visibility.Visible;

            int index = _elementsToDisplay.ToList().FindIndex(elem => elem.Unit.Identifier == unitWrapper.Unit.Identifier);

            if (index < 0)
            {
                _elementsToDisplay.Add(unitWrapper);
            }
            else
            {
                _elementsToDisplay[index].Visibility = unitWrapper.Visibility;
            }
        }
Exemplo n.º 3
0
 public void Visit(StatementUnit node)
 {
     _unitsToAnswers.Add(node.Text, node.Value);
 }
Exemplo n.º 4
0
 public void Visit(StatementUnit node)
 {
     node.Expression.Accept(this);
     ReferenceTables.SetReference(node.Identifier, node.Expression);
 }
Exemplo n.º 5
0
 public WidgetBase GetWidget(StatementUnit unit)
 {
     return(new StatementWidget(unit));
 }