Exemplo n.º 1
0
 public override void Visit(FuncCallStmtNode node)
 {
     node.Id.Accept(this);
     Console.Write("(");
     node.ActualParameters?.ForEach(x => {
         if (node.ActualParameters.IndexOf(x) != 0)
         {
             Console.Write(", ");
         }
         x.Accept(this);
     });
     Console.Write(")");
 }
 public override void Visit(FuncCallStmtNode node)
 {
     node.Id.Accept(this);
     CSharpString.Append("(");
     node.ActualParameters?.ForEach(x => {
         if (node.ActualParameters.IndexOf(x) != 0)
         {
             CSharpString.Append(", ");
         }
         x.Accept(this);
     });
     CSharpString.Append(");");
     PrettyPrintNewLine();
 }
Exemplo n.º 3
0
        private void FuncCallStmt(FuncCallStmtNode node)
        {
            node.name = RequiredToken(Tag.ID);
            RequiredToken(Tag.DL_LPAR);

            if (!TagIs(Tag.DL_RPAR))
            {
                do
                {
                    if (next.Tag == Tag.DL_COM)
                    {
                        Move();
                    }
                    var child = new ExprNode();
                    node.args.Add(child);
                    Expr(child);
                } while (next.Tag == Tag.DL_COM);
            }

            RequiredToken(Tag.DL_RPAR);

            if (node.args.Count != SymbolTable.FindFun(node.name).parasType.Count)
            {
                new Error().PrintErrMsg();
            }
            else
            {
                var argList  = node.args;
                var paraList = SymbolTable.FindFun(node.name).parasType;
                for (int i = 0; i < argList.Count; i++)
                {
                    if (argList[i].Type() != paraList[i])
                    {
                        if (!Utils.IsNumType(argList[i].Type()) || !Utils.IsNumType(paraList[i]))
                        {
                            new TypeMismatchError(argList[i].Type(), paraList[i]).PrintErrMsg();
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
 internal abstract void Visit(FuncCallStmtNode node);
Exemplo n.º 5
0
 public abstract void Visit(FuncCallStmtNode node);