@@ -9,7 +9,7 @@ namespace WebAssembly;
99/// </summary>
1010static class AssemblyBuilder
1111{
12- public static TExport CreateInstance < TExport > ( string name , WebAssemblyValueType ? @return , params Instruction [ ] code )
12+ public static TExport CreateInstance < TExport > ( string name , WebAssemblyValueType ? @return , Instruction [ ] code , Action < Module > ? configure )
1313 where TExport : class
1414 {
1515 Assert . IsNotNull ( name ) ;
@@ -37,6 +37,8 @@ public static TExport CreateInstance<TExport>(string name, WebAssemblyValueType?
3737 Code = code
3838 } ) ;
3939
40+ configure ? . Invoke ( module ) ;
41+
4042 var compiled = module . ToInstance < TExport > ( ) ;
4143
4244 Assert . IsNotNull ( compiled ) ;
@@ -45,7 +47,13 @@ public static TExport CreateInstance<TExport>(string name, WebAssemblyValueType?
4547 return compiled . Exports ;
4648 }
4749
48- public static TExport CreateInstance < TExport > ( string name , WebAssemblyValueType ? @return , IList < WebAssemblyValueType > parameters , params Instruction [ ] code )
50+ public static TExport CreateInstance < TExport > ( string name , WebAssemblyValueType ? @return , params Instruction [ ] code )
51+ where TExport : class
52+ {
53+ return CreateInstance < TExport > ( name , @return , code , null ) ;
54+ }
55+
56+ public static TExport CreateInstance < TExport > ( string name , WebAssemblyValueType ? @return , IList < WebAssemblyValueType > parameters , Instruction [ ] code , Action < Module > ? configure )
4957 where TExport : class
5058 {
5159 Assert . IsNotNull ( name ) ;
@@ -75,6 +83,8 @@ public static TExport CreateInstance<TExport>(string name, WebAssemblyValueType?
7583 Code = code
7684 } ) ;
7785
86+ configure ? . Invoke ( module ) ;
87+
7888 var compiled = module . ToInstance < TExport > ( ) ;
7989
8090 Assert . IsNotNull ( compiled ) ;
@@ -83,6 +93,12 @@ public static TExport CreateInstance<TExport>(string name, WebAssemblyValueType?
8393 return compiled . Exports ;
8494 }
8595
96+ public static TExport CreateInstance < TExport > ( string name , WebAssemblyValueType ? @return , IList < WebAssemblyValueType > parameters , params Instruction [ ] code )
97+ where TExport : class
98+ {
99+ return CreateInstance < TExport > ( name , @return , parameters , code , null ) ;
100+ }
101+
86102 private static readonly Dictionary < System . Type , WebAssemblyValueType > map = new ( 4 )
87103 {
88104 { typeof ( int ) , WebAssemblyValueType . Int32 } ,
0 commit comments