Exemplo n.º 1
0
        public AstPrinterNode Visit(WriteFunctionCall node)
        {
            var printer = new AstPrinterNode(node.ToString());

//            printer.AddChild(node.FuncIdent.Accept(this));
            foreach (var param in node.ParamList)
            {
                printer.AddChild(param.Accept(this));
            }

            return(printer);
        }
        public bool Visit(WriteFunctionCall node)
        {
            var paramTypes = new List <SymType>();

            foreach (var param in node.ParamList)
            {
                if (!WritableNodes.Contains(param.NodeType))
                {
                    throw new Exception(string.Format(
                                            "({0}, {1}) semantic error: expression '{2}' is not writable",
                                            param.Token.Line, param.Token.Column, param.ToString()));
                }

                param.Accept(this);
                paramTypes.Add(param.SymType);
            }

            node.ParamTypes = paramTypes;
            node.IsLValue   = false;
            return(true);
        }