{
if (containers != null) {
foreach (var t in containers) {
- t.PrepareEmit ();
+ try {
+ t.PrepareEmit ();
+ } catch (Exception e) {
+ if (MemberName == MemberName.Null)
+ throw;
+
+ throw new InternalErrorException (t, e);
+ }
}
}
}
public override void PrepareEmit ()
{
+ if ((caching_flags & Flags.CloseTypeCreated) != 0)
+ return;
+
foreach (var member in members) {
var pm = member as IParametersMember;
if (pm != null) {
--- /dev/null
+using System.Runtime.InteropServices;
+
+partial class C
+{
+ public static void Foo (C c, [Optional] C c2)
+ {
+ }
+}
+
+partial class C
+{
+ public static void Foo2 ([Optional] C c2)
+ {
+ }
+
+ public static void Main ()
+ {
+ }
+}
\ No newline at end of file
</method>
</type>
</test>
+ <test name="gtest-optional-21.cs">
+ <type name="C">
+ <method name="Void Foo(C, C)" attrs="150">
+ <size>2</size>
+ </method>
+ <method name="Void Foo2(C)" attrs="150">
+ <size>2</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="gtest-partial-01.cs">
<type name="B`1[U]">
<method name="Void .ctor()" attrs="6278">