X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fgeneric-mcs.cs;h=39227ebfd5c35f5ca82d1dd132f0458703cc6f31;hb=2eea853bba93a9f38959fbebc6ead28e2fa318b0;hp=232d0c6c3ad3c6a1f711b57968bc2a41f7628c27;hpb=0fe6ab207986019717ebce9fb836b81aa0b2b17e;p=mono.git diff --git a/mcs/mcs/generic-mcs.cs b/mcs/mcs/generic-mcs.cs index 232d0c6c3ad..39227ebfd5c 100644 --- a/mcs/mcs/generic-mcs.cs +++ b/mcs/mcs/generic-mcs.cs @@ -4,7 +4,7 @@ // Author: // Raja R Harinath // -// (C) 2006 Novell, Inc. +// Copyright 2006 Novell, Inc. // using System; using System.Reflection; @@ -13,19 +13,53 @@ using System.Collections; namespace Mono.CSharp { + public enum Variance + { + None, + Covariant, + Contravariant + } + public enum SpecialConstraint { Constructor, ReferenceType, ValueType } + + public abstract class GenericTypeParameterBuilder : Type + { + } + + public class InternalsVisibleToAttribute + { + public string AssemblyName; + } + + class ConstraintChecker + { + public static bool CheckConstraints (EmitContext ec, MethodBase a, MethodBase b, Location loc) + { + throw new NotSupportedException (); + } + } public abstract class GenericConstraints { + public bool HasConstructorConstraint { + get { throw new NotImplementedException (); } + } + public bool HasValueTypeConstraint { - get { - throw new NotImplementedException (); - } + get { throw new NotImplementedException (); } + } + + public bool HasClassConstraint { + get { throw new NotImplementedException (); } + } + + public bool HasReferenceTypeConstraint { + get { throw new NotImplementedException (); } } public abstract string TypeParameter { @@ -35,6 +69,22 @@ namespace Mono.CSharp public bool IsReferenceType { get { throw new NotSupportedException (); } } + + public bool IsValueType { + get { throw new NotSupportedException (); } + } + + public Type[] InterfaceConstraints { + get { throw new NotSupportedException (); } + } + + public Type ClassConstraint { + get { throw new NotSupportedException (); } + } + + public Type EffectiveBaseClass { + get { throw new NotSupportedException (); } + } } public class Constraints : GenericConstraints @@ -64,7 +114,7 @@ namespace Mono.CSharp public class TypeParameter : MemberCore, IMemberContainer { public TypeParameter (DeclSpace parent, DeclSpace decl, string name, - Constraints constraints, Attributes attrs, Location loc) + Constraints constraints, Attributes attrs, Variance variance, Location loc) : base (parent, new MemberName (name, loc), attrs) { throw new NotImplementedException (); @@ -74,6 +124,10 @@ namespace Mono.CSharp { throw new NotImplementedException (); } + + public void ErrorInvalidVariance (MemberCore mc, Variance v) + { + } // // MemberContainer @@ -84,8 +138,11 @@ namespace Mono.CSharp return true; } - public override void ApplyAttributeBuilder (Attribute a, - CustomAttributeBuilder cb) + public void Define (Type t) + { + } + + public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa) { throw new NotImplementedException (); } @@ -140,7 +197,7 @@ namespace Mono.CSharp // IMemberContainer // - Type IMemberContainer.Type { + public Type Type { get { throw new NotImplementedException (); } } @@ -148,6 +205,10 @@ namespace Mono.CSharp get { throw new NotImplementedException (); } } + public Variance Variance { + get { throw new NotImplementedException (); } + } + MemberCache IMemberContainer.BaseCache { get { throw new NotImplementedException (); } } @@ -171,18 +232,15 @@ namespace Mono.CSharp { throw new NotImplementedException (); } + + public void SetConstraints (GenericTypeParameterBuilder type) + { + throw new NotImplementedException (); + } } public class TypeParameterExpr : TypeExpr { - public override string Name { - get { throw new NotImplementedException (); } - } - - public override string FullName { - get { throw new NotImplementedException (); } - } - public TypeParameterExpr (TypeParameter type_parameter, Location loc) { throw new NotImplementedException (); @@ -192,16 +250,29 @@ namespace Mono.CSharp { return null; } + + public TypeParameter TypeParameter { + get { + throw new NotImplementedException (); + } + } } public class TypeParameterName : SimpleName { Attributes attributes; + Variance variance; public TypeParameterName (string name, Attributes attrs, Location loc) + : this (name, attrs, Variance.None, loc) + { + } + + public TypeParameterName (string name, Attributes attrs, Variance variance, Location loc) : base (name, loc) { attributes = attrs; + this.variance = variance; } public Attributes OptAttributes { @@ -209,39 +280,41 @@ namespace Mono.CSharp return attributes; } } + + public Variance Variance { + get { + return variance; + } + } } - public class ConstructedType : TypeExpr + public class GenericTypeExpr : TypeExpr { - public ConstructedType (FullNamedExpression fname, TypeArguments args, Location l) + public GenericTypeExpr (DeclSpace t, Location l) { throw new NotImplementedException (); } - public ConstructedType (Type t, TypeParameter[] type_params, Location l) + public GenericTypeExpr (Type t, TypeArguments args, Location l) { throw new NotImplementedException (); } - public ConstructedType (Type t, TypeArguments args, Location l) + protected override TypeExpr DoResolveAsTypeStep (IResolveContext ec) { throw new NotImplementedException (); } - public override string Name { - get { throw new NotImplementedException (); } + public bool CheckConstraints (IResolveContext ec) + { + throw new NotImplementedException (); } - public override string FullName { + public TypeArguments TypeArguments { get { throw new NotImplementedException (); } } - protected override TypeExpr DoResolveAsTypeStep (IResolveContext ec) - { - throw new NotImplementedException (); - } - - public bool CheckConstraints (IResolveContext ec) + public bool VerifyVariantTypeParameters (IResolveContext rc) { throw new NotImplementedException (); } @@ -250,7 +323,7 @@ namespace Mono.CSharp public class GenericMethod : DeclSpace { public GenericMethod (NamespaceEntry ns, DeclSpace parent, MemberName name, - Expression return_type, Parameters parameters) + Expression return_type, ParametersCompiled parameters) : base (ns, parent, name, null) { throw new NotImplementedException (); @@ -277,11 +350,6 @@ namespace Mono.CSharp throw new NotImplementedException (); } - public override bool DefineMembers () - { - throw new NotImplementedException (); - } - internal static void Error_ParameterNameCollision (Location loc, string name, string collisionWith) { } @@ -308,31 +376,18 @@ namespace Mono.CSharp public class TypeArguments { - public readonly Location Location; ArrayList args; - //Type[] atypes; - int dimension; - //bool has_type_args; - //bool created; - public TypeArguments (Location loc) + public TypeArguments () { args = new ArrayList (); - this.Location = loc; } - public TypeArguments (Location loc, params Expression[] types) + public TypeArguments (params Expression[] types) { - this.Location = loc; - this.args = new ArrayList (types); + args = new ArrayList (types); } - public TypeArguments (int dimension, Location loc) - { - this.dimension = dimension; - this.Location = loc; - } - public void Add (Expression type) { } @@ -352,17 +407,10 @@ namespace Mono.CSharp public int Count { get { - if (dimension > 0) - return dimension; - else - return args.Count; + return args.Count; } } - public bool IsUnbound { - get { throw new NotImplementedException (); } - } - public TypeParameterName[] GetDeclarations () { throw new NotImplementedException (); @@ -381,6 +429,13 @@ namespace Mono.CSharp public class TypeInferenceContext { + public Type[] InferredTypeArguments; + + public void AddCommonTypeBound (Type type) + { + throw new NotImplementedException (); + } + public void ExactInference (Type u, Type v) { throw new NotImplementedException (); @@ -390,5 +445,28 @@ namespace Mono.CSharp { throw new NotImplementedException (); } + + public bool FixAllTypes () + { + return false; + } + } + + partial class TypeManager + { + public static Variance CheckTypeVariance (Type type, Variance v, MemberCore mc) + { + return v; + } + + public static bool IsVariantOf (Type a, Type b) + { + return false; + } + + public static TypeContainer LookupGenericTypeContainer (Type t) + { + throw new NotImplementedException (); + } } }