/// <param name="name">Name of this part</param> /// <param name="generics">List of generic (type) arguments</param> /// <param name="arguments">List of ordinary arguments</param> internal RequestPart(string name, IList <GraceObject> generics, IList <GraceObject> arguments) { this.name = MethodHelper.ArityNamePart(name, arguments.Count); this.generics = generics; this.arguments = arguments; }
private GraceBlock(EvaluationContext ctx, List <Node> parameters, List <Node> body, BlockNode node) { this.parameters = parameters; this.body = body; this.node = node; lexicalScope = ctx.Memorise(); applyName = MethodHelper.ArityNamePart("apply", parameters.Count); AddMethod(applyName, null); AddMethod("spawn", null); AddMethod("asString", null); if (parameters.Count == 1) { AddMethod("match(_)", null); AddMethod("|(_)", Matching.OrMethod); AddMethod("&(_)", Matching.AndMethod); var par = parameters[0]; var first = par as ParameterNode; if (first != null && first.Type != null) { Pattern = first.Type.Evaluate(ctx); } else if (par is NumberLiteralNode || par is StringLiteralNode || par is ExplicitReceiverRequestNode) { Pattern = par.Evaluate(ctx); explicitPattern = true; var t = par.Location; var id = new IdentifierParseNode( new IdentifierToken(t.module, t.line, t.column, "_")); this.parameters = new List <Node> { new ParameterNode(t, id) }; } } }