-
- public override string Name {
- get { return name.FullName; }
- }
-
- public override string FullName {
- get { return name.FullName; }
- }
- }
-
- public class TypeAliasExpression : TypeExpr {
- FullNamedExpression alias;
- TypeExpr texpr;
- TypeArguments args;
- string name;
-
- public TypeAliasExpression (FullNamedExpression alias, TypeArguments args, Location l)
- {
- this.alias = alias;
- this.args = args;
- loc = l;
-
- eclass = ExprClass.Type;
- if (args != null)
- name = alias.FullName + "<" + args.ToString () + ">";
- else
- name = alias.FullName;
- }
-
- public override string Name {
- get { return alias.FullName; }
- }
-
- public override string FullName {
- get { return name; }
- }
-
- protected override TypeExpr DoResolveAsTypeStep (IResolveContext ec)
- {
- texpr = alias.ResolveAsTypeTerminal (ec, false);
- if (texpr == null)
- return null;
-
- Type type = texpr.Type;
- int num_args = TypeManager.GetNumberOfTypeArguments (type);
-
- if (args != null) {
- if (num_args == 0) {
- Report.Error (308, loc,
- "The non-generic type `{0}' cannot " +
- "be used with type arguments.",
- TypeManager.CSharpName (type));
- return null;
- }
-
- ConstructedType ctype = new ConstructedType (type, args, loc);
- return ctype.ResolveAsTypeTerminal (ec, false);
- } else if (num_args > 0) {
- Report.Error (305, loc,
- "Using the generic type `{0}' " +
- "requires {1} type arguments",
- TypeManager.CSharpName (type), num_args.ToString ());
- return null;
- }
-
- return texpr;
- }
-
- public override bool CheckAccessLevel (DeclSpace ds)
- {
- return texpr.CheckAccessLevel (ds);
- }
-
- public override bool AsAccessible (DeclSpace ds)
- {
- return texpr.AsAccessible (ds);
- }
-
- public override bool IsClass {
- get { return texpr.IsClass; }
- }
-
- public override bool IsValueType {
- get { return texpr.IsValueType; }
- }
-
- public override bool IsInterface {
- get { return texpr.IsInterface; }
- }
-
- public override bool IsSealed {
- get { return texpr.IsSealed; }
- }