public override object VisitImplicitFunCallExprNode(ImplicitFunCallExprNode n) { Visit(n.name); TypeSymbol funType = null; string name = ""; if (n.name is IdenExprNode) { name = (n.name as IdenExprNode).Type.Name + n.funname; 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, string.Format("Too few arguments ({0}) given, {1} expected", n.args.Count, funType.ParameterTypes.Count)); 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 object VisitImplicitFunCallExprNode(ImplicitFunCallExprNode n) { WriteLine(n.kind + " - " + n.Type.ReturnType); Indent(); WriteLine(n.fullname + ":" + n.funsig.Name); foreach (Expression c in n.args) { Visit(c); } Dedent(); return(null); }
public override object VisitImplicitFunCallExprNode(ImplicitFunCallExprNode n) { Visit(n.name); foreach (Expression e in n.args) { Visit(e); } n.name.Type = DoInfer(n.name.Type, n.args); n.fullname = n.name.Type.Name + n.funname; n.funsig = varTypes.IsInScope(TypeSymbol.MakeFunctionName(n.fullname, n.args)); n.Type = n.funsig.ReturnType; return(null); }
public override MIPSRegister VisitImplicitFunCallExprNode(ImplicitFunCallExprNode n) { return(base.VisitImplicitFunCallExprNode(n)); }
public override LLVMRegister VisitImplicitFunCallExprNode(ImplicitFunCallExprNode n) { throw new NotImplementedException(); }
public override LData VisitImplicitFunCallExprNode(ImplicitFunCallExprNode n) { return(interp.CallFunction(TypeSymbol.MakeFunctionName(n.fullname, n.args), n.args.Select(e => Visit(e)).ToArray())); }
public virtual T VisitImplicitFunCallExprNode(ImplicitFunCallExprNode n) { VisitFunCallExprNode(n); return(default(T)); }