CheckAbstractAndExtern (block != null);
CheckProtectedModifier ();
- if (block != null && block.IsIterator)
- Iterator.CreateIterator (this, Parent.PartialContainer, ModFlags);
+ if (block != null) {
+ if (block.IsIterator)
+ Iterator.CreateIterator (this, Parent.PartialContainer, ModFlags);
+
+ if (Compiler.Settings.WriteMetadataOnly)
+ block = null;
+ }
return null;
}
public override void Emit (TypeDefinition parent)
{
- if ((method.ModFlags & (Modifiers.ABSTRACT | Modifiers.EXTERN)) == 0) {
+ if ((method.ModFlags & (Modifiers.ABSTRACT | Modifiers.EXTERN)) == 0 && !Compiler.Settings.WriteMetadataOnly) {
block = new ToplevelBlock (Compiler, ParameterInfo, Location) {
IsCompilerGenerated = true
};
var cond = new BooleanExpression (new Binary (Binary.Operator.Inequality,
new Cast (new TypeExpression (Module.Compiler.BuiltinTypes.Object, Location), new LocalVariableReference (obj1, Location), Location),
- new Cast (new TypeExpression (Module.Compiler.BuiltinTypes.Object, Location), new LocalVariableReference (obj2, Location), Location),
- Location));
+ new Cast (new TypeExpression (Module.Compiler.BuiltinTypes.Object, Location), new LocalVariableReference (obj2, Location), Location)));
var body = new ExplicitBlock (block, Location, Location);
- block.AddStatement (new Do (body, cond, Location));
+ block.AddStatement (new Do (body, cond, Location, Location));
body.AddStatement (new StatementExpression (
new SimpleAssign (new LocalVariableReference (obj2, Location), new LocalVariableReference (obj1, Location))));
if (!method_data.Define (parent.PartialContainer, method.GetFullName (MemberName)))
return null;
+ if (Compiler.Settings.WriteMetadataOnly)
+ block = null;
+
MethodBuilder mb = method_data.MethodBuilder;
Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, mb, ParameterInfo, method.ModFlags);
public override MethodBuilder Define (TypeContainer parent)
{
- parameters.Resolve (this);
+ // Disable reporting, parameters are resolved twice
+ Report.DisableReporting ();
+ try {
+ parameters.Resolve (this);
+ } finally {
+ Report.EnableReporting ();
+ }
+
return base.Define (parent);
}