missing.AddRange (m);
}
+ if (Arity > 0) {
+ foreach (var tp in GenericDefinition.TypeParameters) {
+ var m = tp.GetMissingDependencies ();
+
+ if (m == null)
+ continue;
+
+ if (missing == null)
+ missing = new List<TypeSpec> ();
+
+ missing.AddRange (m);
+ }
+ }
+
return missing;
}
block = (ToplevelBlock) block.ConvertToAsyncTask (this, Parent.PartialContainer, parameters, ReturnType, Location);
ModFlags |= Modifiers.DEBUGGER_HIDDEN;
}
+
+ if (Compiler.Settings.WriteMetadataOnly)
+ block = null;
}
if ((ModFlags & Modifiers.STATIC) == 0)
}
}
- base.Emit ();
-
+ if (block != null && block.StateMachine != null) {
+ var psm = block.StateMachine is IteratorStorey ?
+ Module.PredefinedAttributes.IteratorStateMachine :
+ Module.PredefinedAttributes.AsyncStateMachine;
+
+ psm.EmitAttribute (MethodBuilder, block.StateMachine);
+ }
+
if ((ModFlags & Modifiers.METHOD_EXTENSION) != 0)
Module.PredefinedAttributes.Extension.EmitAttribute (MethodBuilder);
+
+ base.Emit ();
} catch {
Console.WriteLine ("Internal compiler error at {0}: exception caught while emitting {1}",
Location, MethodBuilder);
base_ctor = ConstructorLookup (ec, type, ref argument_list, loc);
}
- // TODO MemberCache: Does it work for inflated types ?
- if (base_ctor == caller_builder.Spec){
+ if (base_ctor != null && base_ctor.MemberDefinition == caller_builder.Spec.MemberDefinition) {
ec.Report.Error (516, loc, "Constructor `{0}' cannot call itself",
caller_builder.GetSignatureForError ());
}
Parent.MemberCache.AddMember (spec);
- // It's here only to report an error
- if (block != null && block.IsIterator) {
- member_type = Compiler.BuiltinTypes.Void;
- Iterator.CreateIterator (this, Parent.PartialContainer, ModFlags);
+ if (block != null) {
+ // It's here only to report an error
+ if (block.IsIterator) {
+ member_type = Compiler.BuiltinTypes.Void;
+ Iterator.CreateIterator (this, Parent.PartialContainer, ModFlags);
+ }
+
+ if (Compiler.Settings.WriteMetadataOnly)
+ block = null;
}
return true;
BlockContext bc = new BlockContext (this, block, Compiler.BuiltinTypes.Void);
bc.Set (ResolveContext.Options.ConstructorScope);
- //
- // If we use a "this (...)" constructor initializer, then
- // do not emit field initializers, they are initialized in the other constructor
- //
- if (!(Initializer is ConstructorThisInitializer))
- Parent.PartialContainer.ResolveFieldInitializers (bc);
-
if (block != null) {
+ //
+ // If we use a "this (...)" constructor initializer, then
+ // do not emit field initializers, they are initialized in the other constructor
+ //
+ if (!(Initializer is ConstructorThisInitializer))
+ Parent.PartialContainer.ResolveFieldInitializers (bc);
+
if (!IsStatic) {
if (Initializer == null) {
if (Parent.PartialContainer.Kind == MemberKind.Struct) {
//
if ((flags & MethodAttributes.MemberAccessMask) != MethodAttributes.Public) {
implementing = null;
- } else if (optional && (container.Interfaces == null || Array.IndexOf (container.Interfaces, implementing.DeclaringType) < 0)) {
+ } else if (optional && (container.Interfaces == null || !container.Definition.Interfaces.Contains (implementing.DeclaringType))) {
//
// We are not implementing interface when base class already implemented it
//
return true;
}
+ public override bool Define ()
+ {
+ base.Define ();
+
+ if (Compiler.Settings.WriteMetadataOnly)
+ block = null;
+
+ return true;
+ }
+
public override void Emit()
{
var base_type = Parent.PartialContainer.BaseType;
if (!base.Define ())
return false;
- if (block != null && block.IsIterator) {
- //
- // Current method is turned into automatically generated
- // wrapper which creates an instance of iterator
- //
- Iterator.CreateIterator (this, Parent.PartialContainer, ModFlags);
- ModFlags |= Modifiers.DEBUGGER_HIDDEN;
+ if (block != null) {
+ if (block.IsIterator) {
+ //
+ // Current method is turned into automatically generated
+ // wrapper which creates an instance of iterator
+ //
+ Iterator.CreateIterator (this, Parent.PartialContainer, ModFlags);
+ ModFlags |= Modifiers.DEBUGGER_HIDDEN;
+ }
+
+ if (Compiler.Settings.WriteMetadataOnly)
+ block = null;
}
// imlicit and explicit operator of same types are not allowed