public static RubyModule/*!*/ Of(RubyContext/*!*/ context, TypeGroup/*!*/ self, int genericArity) { TypeTracker tracker = self.GetTypeForArity(genericArity); if (tracker == null) { throw RubyExceptions.CreateArgumentError(String.Format("Type group `{0}' does not contain a type of generic arity {1}", self.Name, genericArity)); } return context.GetModule(tracker.Type); }
public static RubyModule/*!*/ Of(RubyContext/*!*/ context, TypeGroup/*!*/ self, [NotNull]params object[]/*!*/ typeArgs) { TypeTracker tracker = self.GetTypeForArity(typeArgs.Length); if (tracker == null) { throw RubyExceptions.CreateArgumentError(String.Format("Invalid number of type arguments for `{0}'", self.Name)); } Type concreteType; if (typeArgs.Length > 0) { concreteType = tracker.Type.MakeGenericType(Protocols.ToTypes(context, typeArgs)); } else { concreteType = tracker.Type; } return context.GetModule(concreteType); }
private static Type/*!*/ GetNonGenericType(TypeGroup/*!*/ self) { TypeTracker type = self.GetTypeForArity(0); if (type == null) { throw RubyExceptions.CreateTypeError("type group doesn't include non-generic type"); } return type.Type; }