public override object VisitFunCallStmtNode(FunCallStmtNode n) { Visit(n.name); TypeSymbol funType = null; string name = ""; if (n.name is IdenExprNode) { name = (n.name as IdenExprNode).name; name = TypeSymbol.MakeFunctionName(name, n.args); funType = varTypes.IsInScope(name); } else { funType = n.name.Type; } semanticChecker.CheckAndReport(funType != null, n.sourceLoc, $"Undeclared Function {name}"); n.name.Type = funType; if (funType != null) { semanticChecker.CheckAndReport(n.args.Count <= funType.ParameterTypes.Count, n.sourceLoc, string.Format("Too many arguments {0} given, {1} expected", n.args.Count, funType.ParameterTypes.Count)); semanticChecker.CheckAndReport(n.args.Count >= funType.ParameterTypes.Count, n.sourceLoc, "Too few arguments"); for (int i = 0; i < Math.Min(funType.ParameterTypes.Count, n.args.Count); i++) { Visit(n.args[i]); semanticChecker.CheckAndReport(funType.ParameterTypes[i].Match(n.args[i].Type), n.sourceLoc, "argument mismatch: " + (i + 1)); } } return(null); }
public override object VisitFunCallStmtNode(FunCallStmtNode n) { Visit(n.name); foreach (Expression e in n.args) { Visit(e); } n.name.Type = DoInfer(n.name.Type, n.args); return(null); }
public virtual T VisitFunCallStmtNode(FunCallStmtNode n) { T a = n.name.Accept(this); for (int i = 0; i < n.args.Count; i++) { n.args[i].Accept(this); } return(default(T)); }
public object VisitFunCallStmtNode(FunCallStmtNode n) { WriteLine(n.kind); Indent(); Visit(n.name); foreach (Expression c in n.args) { Visit(c); } Dedent(); return(null); }
public override LData VisitFunCallStmtNode(FunCallStmtNode n) { if (n.name is IdenExprNode) { var paras = n.args.Select(e => Visit(e)).ToArray(); interp.CallFunction((n.name as IdenExprNode).Type.FunctionName, paras); } else { // ??? i don't know yet ... this concerns function pointers, and i honestly don't know how to do them elegantly // @TODO: Probably has to be done inside TypeSymbol } return(null); }
public override MIPSRegister VisitFunCallStmtNode(FunCallStmtNode n) { return(base.VisitFunCallStmtNode(n)); }
public override LLVMRegister VisitFunCallStmtNode(FunCallStmtNode n) { throw new NotImplementedException(); }