if (TypeBuilder != null)
return TypeBuilder;
+ ec = new EmitContext (this, this, Location, null, null, ModFlags, false);
+
TypeAttributes attr = Modifiers.TypeAttr (ModFlags, IsTopLevel) |
TypeAttributes.Class | TypeAttributes.Sealed;
+ if (TypeManager.multicast_delegate_type == null && !RootContext.StdLib) {
+ TypeExpr expr = new TypeLookupExpression ("System.MulticastDelegate");
+ TypeManager.multicast_delegate_type = expr.ResolveType (ec);
+ }
+
+ if (TypeManager.multicast_delegate_type == null)
+ throw new InternalErrorException ("System.MulticastDelegate unresolved");
+
if (IsTopLevel) {
if (TypeManager.NamespaceClash (Name, Location))
return null;
{
MethodAttributes mattr;
int i;
- EmitContext ec = new EmitContext (this, this, Location, null,
- null, ModFlags, false);
+
+ if (ec == null)
+ throw new InternalErrorException ("Define called before DefineType?");
// FIXME: POSSIBLY make this static, as it is always constant
//
public override void Emit ()
{
if (OptAttributes != null) {
- EmitContext ec = new EmitContext (
- Parent, this, Location, null, null, ModFlags, false);
Parameters.LabelParameters (ec, InvokeBuilder, Location);
OptAttributes.Emit (ec, this);
}
delegate_instance_expression = ec.GetThis (loc);
if (delegate_instance_expression != null && delegate_instance_expression.Type.IsValueType)
- delegate_instance_expression = new BoxedCast (mg.InstanceExpression);
+ delegate_instance_expression = new BoxedCast (delegate_instance_expression);
method_group = mg;
eclass = ExprClass.Value;
Expression e = a.Expr;
- if (e is AnonymousMethod)
+ if (e is AnonymousMethod && RootContext.Version != LanguageVersion.ISO_1)
return ((AnonymousMethod) e).Compatible (ec, type, false);
MethodGroupExpr mg = e as MethodGroupExpr;
Type e_type = e.Type;
if (!TypeManager.IsDelegateType (e_type)) {
- e.Error_UnexpectedKind ("method", loc);
+ Report.Error (149, loc, "Method name expected");
return null;
}