This commit was manufactured by cvs2svn to create branch 'mono-1-0'.
[mono.git] / mcs / mcs / generic.cs
1 //
2 // generic.cs: Support classes for generics
3 //
4 // Author:
5 //   Miguel de Icaza (miguel@ximian.com)
6 //
7 // (C) 2003 Ximian, Inc.
8 //
9 using System;
10 using System.Collections;
11
12 namespace Mono.CSharp {
13
14         //
15         // Tracks the constraints for a type parameter
16         //
17         class Constraints {
18                 string type_parameter;
19                 ArrayList constraints;
20                 
21                 //
22                 // type_parameter is the identifier, constraints is an arraylist of
23                 // Expressions (with types) or `true' for the constructor constraint.
24                 // 
25                 public Constraints (string type_parameter, ArrayList constraints)
26                 {
27                         this.type_parameter = type_parameter;
28                         this.constraints = constraints;
29                 }
30         }
31
32         //
33         // This type represents a generic type parameter reference.
34         //
35         // These expressions are born in a fully resolved state.
36         //
37         public class TypeParameterExpr : TypeExpr {
38                 string type_parameter;
39                 
40                 public TypeParameterExpr (string type_parameter, Location l)
41                         : base (typeof (object), l)
42                 {
43                         this.type_parameter = type_parameter;
44                 }
45
46                 public override string ToString ()
47                 {
48                         return "TypeParameter[" + type_parameter + "]";
49                 }
50
51                 public void Error_CannotUseAsUnmanagedType (Location loc)
52                 {
53                         Report.Error (-203, loc, "Can not use type parameter as unamanged type");
54                 }
55         }
56 }