// Private Methods private static ConstraintInfo Convert2(TypeParameterConstraintSyntax src, LangParseContext context) { if (src is ConstructorConstraintSyntax) { return new ConstraintInfo { Kind = ConstraintKind.ParameterlessConstructor } } ; throw new NotSupportedException(src.GetType().ToString()); }
private static string TransformTypeConstraint(TypeParameterConstraintSyntax constraint) { if (constraint is TypeConstraintSyntax) { return(" <% " + TypeProcessor.ConvertType(constraint.As <TypeConstraintSyntax>().Type)); } else if (constraint is ClassOrStructConstraintSyntax) { if (constraint.As <ClassOrStructConstraintSyntax>().ClassOrStructKeyword.Kind() == SyntaxKind.ClassKeyword) { return(" >: Null"); } else { throw new Exception("struct type constraint not supported " + Utility.Descriptor(constraint)); } } else { throw new Exception(constraint.GetType().Name); } }