public void Visit(FunctionCall functionCall) { _sb.Append(functionCall.Name).Append('('); if (functionCall.Params.Any()) { foreach (Exp arg in functionCall.Params) { arg.Accept(this); _sb.Append(", "); } _sb.Remove(_sb.Length - 2, 2); } if (functionCall.Params.Count == 1) _sb.Remove(_sb.Length - 2, 2); _sb.Append(')'); }
public MethodInvocation(Id id, FunctionCall functionCall) { _id = id; _functionCall = functionCall; }
public void Visit(FunctionCall functionCall) { Level++; if (!_methInvocation) { _sb.Append("self."); } if (_methInvocation &&_visitingServer) { _noTypeFlag = false; _sb.Append("remoteMethodCall('" + functionCall.Name + ","); if (functionCall.Params.Any()) { foreach (Exp arg in functionCall.Params) { arg.Accept(this); _sb.Append(","); } } _sb.Append("')"); } else { _sb.Append(functionCall.Name).Append('('); if (functionCall.Params.Any()) { foreach (Exp arg in functionCall.Params) { arg.Accept(this); _sb.Append(", "); } _sb.Remove(_sb.Length - 2, 2); } if (functionCall.Params.Count == 1) _sb.Remove(_sb.Length - 2, 2); _sb.Append(')'); } Level--; }
public void Visit(FunctionCall functionCall) { foreach (var p in functionCall.Params) { p.Accept(this); } FuncEnv targetFunction = null; if (_env.InvokingOn == null) { if (_env.VisitPartEnv.Functions.Keys.All(fName => functionCall.Name != fName)) { throw new TypeCheckingException(functionCall.Name + " isn't defined.\n"); } targetFunction = _env.VisitPartEnv.Functions[functionCall.Name]; targetFunction.ArgsMatchParamsType(functionCall.Params); } if (_env.InvokingOn != null) { targetFunction = _env.InvokingOn.Functions[functionCall.Name]; targetFunction.ArgsMatchParamsType(functionCall.Params); } if (targetFunction != null) functionCall.SmclType = targetFunction.GetReturn(); else throw new TypeCheckingException("typechecker logic fails in functionCall visit."); }