@@ -354,6 +354,8 @@ public class JavaScriptEnvironment: ComponentBase {
354354 registerObjectGroup ( . jsWebAssemblyCompileOptions)
355355 registerObjectGroup ( . jsWebAssemblyModuleConstructor)
356356 registerObjectGroup ( . jsWebAssemblyGlobalConstructor)
357+ registerObjectGroup ( . jsWebAssemblyInstanceConstructor)
358+ registerObjectGroup ( . jsWebAssemblyInstance)
357359 registerObjectGroup ( . jsWebAssemblyModule)
358360 registerObjectGroup ( . jsWebAssembly)
359361 registerObjectGroup ( . jsWasmGlobal)
@@ -927,6 +929,13 @@ public extension ILType {
927929 ILType . constructor ( [ . plain( . object( ) ) , . jsAnything] => . jsWasmGlobal)
928930 + . object( ofGroup: " WebAssemblyGlobalConstructor " , withProperties: [ ] , withMethods: [ ] )
929931
932+ static let jsWebAssemblyInstance = ILType . object ( ofGroup: " WebAssembly.Instance " ,
933+ withProperties: [ " exports " ] )
934+
935+ static let jsWebAssemblyInstanceConstructor =
936+ ILType . constructor ( [ . plain( . jsWebAssemblyModule) , . plain( . object( ) ) ] => . jsWebAssemblyInstance)
937+ + . object( ofGroup: " WebAssemblyInstanceConstructor " , withProperties: [ " prototype " ] , withMethods: [ ] )
938+
930939 // The JavaScript WebAssembly.Table object of the given variant, i.e. FuncRef or ExternRef
931940 static let wasmTable = ILType . object ( ofGroup: " WasmTable " , withProperties: [ " length " ] , withMethods: [ " get " , " grow " , " set " ] )
932941
@@ -1704,6 +1713,8 @@ public extension ObjectGroup {
17041713 )
17051714 }
17061715
1716+ // TODO(mliedtke): We need to construct these to make code generators be able to provide
1717+ // somewhat reasonable compile options.
17071718 static let jsWebAssemblyCompileOptions = ObjectGroup (
17081719 name: " WebAssemblyCompileOptions " ,
17091720 instanceType: nil ,
@@ -1745,6 +1756,24 @@ public extension ObjectGroup {
17451756 methods: [ : ]
17461757 )
17471758
1759+ static let jsWebAssemblyInstanceConstructor = ObjectGroup (
1760+ name: " WebAssemblyInstanceConstructor " ,
1761+ instanceType: . jsWebAssemblyInstanceConstructor,
1762+ properties: [
1763+ " prototype " : . object( ) ,
1764+ ] ,
1765+ methods: [ : ]
1766+ )
1767+
1768+ static let jsWebAssemblyInstance = ObjectGroup (
1769+ name: " WebAssembly.Instance " ,
1770+ instanceType: . jsWebAssemblyInstance,
1771+ properties: [
1772+ " exports " : . object( ) ,
1773+ ] ,
1774+ methods: [ : ]
1775+ )
1776+
17481777 static let jsWebAssembly = ObjectGroup (
17491778 name: " WebAssembly " ,
17501779 instanceType: nil ,
@@ -1753,6 +1782,7 @@ public extension ObjectGroup {
17531782 " JSTag " : . object( ofGroup: " WasmTag " , withWasmType: WasmTagType ( [ . wasmExternRef] , isJSTag: true ) ) ,
17541783 " Module " : . jsWebAssemblyModuleConstructor,
17551784 " Global " : . jsWebAssemblyGlobalConstructor,
1785+ " Instance " : . jsWebAssemblyInstanceConstructor,
17561786 ] ,
17571787 overloads: [
17581788 " compile " : wasmBufferTypes. map {
0 commit comments