public void Visit(Ast.Expr.FuncCall f) { foreach (var e in f.Item.ExprList) { Visit(e); } if (f.Item.Decl == null) { return; } Ast.Stmt.Funcdef fd = (Ast.Stmt.Funcdef)f.Item.Decl.Value; // Compare param types to decl types var formalList = SeqModule.ToList(fd.Item.FormalList); var actualList = SeqModule.ToList(f.Item.ExprList); var actualAndFormal = ListModule.Zip(actualList, formalList); foreach (var af in actualAndFormal) { if (af.Item1.ActualType != af.Item2.Formal.Type) { m_errorList.Add("Type Error: Cannot use actual paramater of type " + af.Item1.ActualType + " for formal paramater of type " + af.Item2.Formal.Type); } } f.ActualType = fd.Item.Formal.Type; }
public void Visit(Ast.Expr.FuncCall f) { Option <Ast.Stmt> fd = this.m_symbolTable.Find(f.Item.Name); fd.Match(funcdef => f.Item.Decl = funcdef, () => this.m_errorList.Add("Symbol Error: No matching symbol table entry for function " + f.Item.Name)); //System.Console.WriteLine("Reference to function " + f.Item.Name + " " + f.Item.Decl); foreach (var e in f.Item.ExprList) { Visit(e); } }