protected MethodCollection(string[] methodNames, Type projectionType, Type aggregateType) { _validArgumentTypes.Add(typeof(CancellationToken)); MethodNames.AddRange(methodNames); ProjectionType = projectionType; AggregateType = aggregateType; projectionType.GetMethods(flags()) .Where(x => MethodNames.Contains(x.Name)) .Where(x => !x.HasAttribute <MartenIgnoreAttribute>()) .Each(method => addMethodSlot(method, false)); if (aggregateType != null) { aggregateType.GetMethods(flags()) .Where(x => MethodNames.Contains(x.Name)) .Where(x => !x.HasAttribute <MartenIgnoreAttribute>()) .Each(method => addMethodSlot(method, true)); } IsAsync = Methods.Select(x => x.Method).OfType <MethodInfo>().Any(x => x.IsAsync()); LambdaName = methodNames.First(); }
/// <summary> /// MethodClass -> ClassName.IdT(Params) /// </summary> private void MethodCall(Class classEntry) { ClassName(); Match(Tokens.PeriodT); if ((classEntry != null && classEntry.methodNames.Contains(Lexeme)) || MethodNames.Contains(Lexeme)) { string methodName = Lexeme; Match(Tokens.IdT); Match(Tokens.LParenT); Params(); Match(Tokens.RParenT); tacGenerator.GenerateLineOfTAC($"call {methodName}"); } else { ErrorHandler.LogError($"The class \"{classEntry.lexeme}\" does not contain the method \"{Lexeme}\""); } }
protected MethodCollection(string[] methodNames, Type projectionType, Type aggregateType) { _validArgumentTypes.Add(typeof(CancellationToken)); MethodNames.AddRange(methodNames); ProjectionType = projectionType; Methods = projectionType.GetMethods(flags()) .Where(x => MethodNames.Contains(x.Name)) .Where(x => !x.HasAttribute <MartenIgnoreAttribute>()) .Select(x => new MethodSlot(x, aggregateType) { HandlerType = projectionType }).ToList(); AggregateType = aggregateType; if (aggregateType != null) { var aggregateSlots = aggregateType.GetMethods(flags()) .Where(x => MethodNames.Contains(x.Name)) .Where(x => !x.HasAttribute <MartenIgnoreAttribute>()) .Select(x => new MethodSlot(x, aggregateType) { HandlerType = aggregateType, DeclaredByAggregate = true }); Methods.AddRange(aggregateSlots); } IsAsync = Methods.Select(x => x.Method).OfType <MethodInfo>().Any(x => x.IsAsync()); LambdaName = methodNames.First(); }