// Author:
// Raja R Harinath <rharinath@novell.com>
//
-// (C) 2006 Novell, Inc.
+// Copyright 2006 Novell, Inc.
//
using System;
using System.Reflection;
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 {
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
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 ();
{
throw new NotImplementedException ();
}
+
+ public void ErrorInvalidVariance (MemberCore mc, Variance v)
+ {
+ }
//
// MemberContainer
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 ();
}
// IMemberContainer
//
- Type IMemberContainer.Type {
+ public Type Type {
get { throw new NotImplementedException (); }
}
get { throw new NotImplementedException (); }
}
+ public Variance Variance {
+ get { throw new NotImplementedException (); }
+ }
+
MemberCache IMemberContainer.BaseCache {
get { throw new NotImplementedException (); }
}
{
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 ();
{
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 {
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 ();
}
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 ();
throw new NotImplementedException ();
}
- public override bool DefineMembers ()
- {
- throw new NotImplementedException ();
- }
-
internal static void Error_ParameterNameCollision (Location loc, string name, string collisionWith)
{
}
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)
{
}
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 ();
public class TypeInferenceContext
{
+ public Type[] InferredTypeArguments;
+
+ public void AddCommonTypeBound (Type type)
+ {
+ throw new NotImplementedException ();
+ }
+
public void ExactInference (Type u, Type v)
{
throw new NotImplementedException ();
{
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 ();
+ }
}
}