diff options
author | Miguel de Icaza <miguel@gnome.org> | 2003-07-20 21:01:06 +0400 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2003-07-20 21:01:06 +0400 |
commit | 08d46b09cb2759b080665f7dc0dc49cdab983500 (patch) | |
tree | 25e0cdb107ec307ba6c30f22473a5c9f93acdae8 | |
parent | 35abfcdb43edd304ce999200b208e458c3d313ce (diff) |
Add generic.cs
svn path=/trunk/mcs/; revision=16446
-rw-r--r-- | mcs/mcs/generic.cs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/mcs/mcs/generic.cs b/mcs/mcs/generic.cs new file mode 100644 index 00000000000..4e66eb6cc66 --- /dev/null +++ b/mcs/mcs/generic.cs @@ -0,0 +1,56 @@ +// +// generic.cs: Support classes for generics +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) 2003 Ximian, Inc. +// +using System; +using System.Collections; + +namespace Mono.CSharp { + + // + // Tracks the constraints for a type parameter + // + class Constraints { + string type_parameter; + ArrayList constraints; + + // + // type_parameter is the identifier, constraints is an arraylist of + // Expressions (with types) or `true' for the constructor constraint. + // + public Constraints (string type_parameter, ArrayList constraints) + { + this.type_parameter = type_parameter; + this.constraints = constraints; + } + } + + // + // This type represents a generic type parameter reference. + // + // These expressions are born in a fully resolved state. + // + public class TypeParameterExpr : TypeExpr { + string type_parameter; + + public TypeParameterExpr (string type_parameter, Location l) + : base (typeof (object), l) + { + this.type_parameter = type_parameter; + } + + public override string ToString () + { + return "TypeParameter[" + type_parameter + "]"; + } + + public void Error_CannotUseAsUnmanagedType (Location loc) + { + Report.Error (-203, loc, "Can not use type parameter as unamanged type"); + } + } +} |