+ base.ApplyAttributeBuilder (a, cb, pa);
+ }
+
+ protected override bool CheckBase ()
+ {
+ flags |= MethodAttributes.Virtual;
+
+ if (!base.CheckBase ())
+ return false;
+
+ if (Parent.PartialContainer.BaseCache == null)
+ return true;
+
+ Type base_type = Parent.PartialContainer.BaseCache.Container.Type;
+ if (base_type != null && Block != null) {
+ MethodGroupExpr method_expr = Expression.MethodLookup (Parent.TypeBuilder, base_type, MetadataName, Location);
+ if (method_expr == null)
+ throw new NotImplementedException ();
+
+ method_expr.IsBase = true;
+ method_expr.InstanceExpression = new CompilerGeneratedThis (Parent.TypeBuilder, Location);
+
+ ToplevelBlock new_block = new ToplevelBlock (Block.StartLocation);
+ new_block.EndLocation = Block.EndLocation;
+
+ Block finaly_block = new ExplicitBlock (new_block, Location, Location);
+ Block try_block = new Block (new_block, block);
+
+ //
+ // 0-size arguments to avoid CS0250 error
+ // TODO: Should use AddScopeStatement or something else which emits correct
+ // debugger scope
+ //
+ finaly_block.AddStatement (new StatementExpression (new Invocation (method_expr, new Arguments (0))));
+ new_block.AddStatement (new TryFinally (try_block, finaly_block, Location));
+
+ block = new_block;
+ }
+
+ return true;