projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Initial import of the Generic MCS tree.
[mono.git]
/
mcs
/
gmcs
/
class.cs
diff --git
a/mcs/gmcs/class.cs
b/mcs/gmcs/class.cs
index 11e5b3010b204b56e954cefb3e9f5e57a143aa91..06b7a731b81420525850bbd759c6b08d31915c7f 100755
(executable)
--- a/
mcs/gmcs/class.cs
+++ b/
mcs/gmcs/class.cs
@@
-128,7
+128,7
@@
namespace Mono.CSharp {
// The parent member container and our member cache
IMemberContainer parent_container;
MemberCache member_cache;
// The parent member container and our member cache
IMemberContainer parent_container;
MemberCache member_cache;
-
+
//
// The indexer name for this class
//
//
// The indexer name for this class
//
@@
-142,11
+142,11
@@
namespace Mono.CSharp {
if (parent == null)
n = "";
if (parent == null)
n = "";
- else
+ else
n = parent.Name;
base_class_name = null;
n = parent.Name;
base_class_name = null;
-
+
//Console.WriteLine ("New class " + name + " inside " + n);
}
//Console.WriteLine ("New class " + name + " inside " + n);
}
@@
-602,6
+602,13
@@
namespace Mono.CSharp {
}
}
}
}
+ void Error_TypeParameterAsBase (TypeParameterExpr e)
+ {
+ Report.Error (
+ -213, e.Location,
+ String.Format ("Type parameter `{0}' can not be used t as a base class or interface", e.Name));
+ }
+
/// <remarks>
/// The pending methods that need to be implemented (interfaces or abstract methods)
/// </remarks>
/// <remarks>
/// The pending methods that need to be implemented (interfaces or abstract methods)
/// </remarks>
@@
-663,6
+670,12
@@
namespace Mono.CSharp {
return null;
}
return null;
}
+ if (name is TypeParameterExpr){
+ Error_TypeParameterAsBase ((TypeParameterExpr) name);
+ error = true;
+ return null;
+ }
+
Type first = name.Type;
if (first.IsClass){
Type first = name.Type;
if (first.IsClass){
@@
-786,6
+799,12
@@
namespace Mono.CSharp {
}
}
}
}
+ if (IsGeneric && (parent == TypeManager.attribute_type ||
+ parent.IsSubclassOf (TypeManager.attribute_type))){
+ Report.Error (-214, Location, "Generic type can not derive from Attribute");
+ return null;
+ }
+
if (!is_class && TypeManager.value_type == null)
throw new Exception ();
if (!is_class && TypeManager.value_type == null)
throw new Exception ();
@@
-2065,7
+2084,6
@@
namespace Mono.CSharp {
}
}
}
}
-
}
public class Class : TypeContainer {
}
public class Class : TypeContainer {
@@
-2551,6
+2569,11
@@
namespace Mono.CSharp {
RootContext.MainClass == container.TypeBuilder.FullName)){
if (IsEntryPoint (MethodBuilder, ParameterInfo)) {
if (RootContext.EntryPoint == null) {
RootContext.MainClass == container.TypeBuilder.FullName)){
if (IsEntryPoint (MethodBuilder, ParameterInfo)) {
if (RootContext.EntryPoint == null) {
+ if (container.IsGeneric){
+ Report.Error (-201, Location,
+ "Entry point can not be defined in a generic class");
+ }
+
RootContext.EntryPoint = MethodBuilder;
RootContext.EntryPointLocation = Location;
} else {
RootContext.EntryPoint = MethodBuilder;
RootContext.EntryPointLocation = Location;
} else {