コード例 #1
0
        public void Visit(IfNode node)
        {
            node.Condition.Accept(this);

            node.AcceptChildren(this);

            if (node.Alternate != null)
            {
                node.AcceptSiblings(node.Alternate, this);
            }
        }
コード例 #2
0
        public LanguageType Visit(IfNode node)
        {
            var condtype = node.Condition.Accept(this);

            if (condtype != LanguageType.Int && condtype != LanguageType.Time)
            {
                throw new AlangExeption(node, $"Condition in if statement is {condtype.ToLower()}, and should be either int or time");
            }
            node.AcceptChildren(this);
            node.AcceptSiblings(node.Alternate, this);
            return(LanguageType.Null);
        }