@@ -360,6 +360,7 @@ public class JavaScriptEnvironment: ComponentBase {
360360 registerObjectGroup ( . jsWebAssemblyCompileOptions)
361361 registerObjectGroup ( . jsWebAssemblyModuleConstructor)
362362 registerObjectGroup ( . jsWebAssemblyGlobalConstructor)
363+ registerObjectGroup ( . jsWebAssemblyGlobalPrototype)
363364 registerObjectGroup ( . jsWebAssemblyInstanceConstructor)
364365 registerObjectGroup ( . jsWebAssemblyInstance)
365366 registerObjectGroup ( . jsWebAssemblyModule)
@@ -971,15 +972,16 @@ public extension ILType {
971972 // TODO: The first constructor argument can also be any typed array and .jsSharedArrayBuffer.
972973 static let jsWebAssemblyModuleConstructor =
973974 ILType . constructor ( [ . plain( . jsArrayBuffer) ] => . jsWebAssemblyModule)
974- + . object( ofGroup: " WebAssemblyModuleConstructor " , withProperties: [ ] ,
975+ + . object( ofGroup: " WebAssemblyModuleConstructor " , withProperties: [ " prototype " ] ,
975976 withMethods: [ " customSections " , " imports " , " exports " ] )
976977
977- static let jsWasmGlobal = ILType . object ( ofGroup: " WasmGlobal " , withProperties: [ " value " ] ,
978- withMethods: [ " valueOf " ] )
979-
980978 static let jsWebAssemblyGlobalConstructor =
981- ILType . constructor ( [ . plain( . object( ) ) , . jsAnything] => . jsWasmGlobal)
982- + . object( ofGroup: " WebAssemblyGlobalConstructor " , withProperties: [ ] , withMethods: [ ] )
979+ // We do not type the result as being part of the ObjectGroup "WasmGlobal" as that would
980+ // require to also add a WasmTypeExtension to its type. This is fine as the proper
981+ // construction of globals is done via the high-level Wasm operations and these builtins
982+ // only serve the purpose of fuzzing the API.
983+ ILType . constructor ( [ . plain( . object( ) ) , . jsAnything] => . object( withProperties: [ " value " ] , withMethods: [ " valueOf " ] ) )
984+ + . object( ofGroup: " WebAssemblyGlobalConstructor " , withProperties: [ " prototype " ] , withMethods: [ ] )
983985
984986 static let jsWebAssemblyInstance = ILType . object ( ofGroup: " WebAssembly.Instance " ,
985987 withProperties: [ " exports " ] )
@@ -1801,18 +1803,24 @@ public extension ObjectGroup {
18011803 static let jsWebAssemblyModuleConstructor = ObjectGroup (
18021804 name: " WebAssemblyModuleConstructor " ,
18031805 instanceType: . jsWebAssemblyModuleConstructor,
1804- properties: [ : ] ,
1806+ properties: [
1807+ " prototype " : . object( )
1808+ ] ,
18051809 methods: [
18061810 " customSections " : [ . plain( jsWebAssemblyModule. instanceType) , . plain( . jsString) ] => . jsArray,
18071811 " exports " : [ . plain( jsWebAssemblyModule. instanceType) ] => . jsArray,
18081812 " imports " : [ . plain( jsWebAssemblyModule. instanceType) ] => . jsArray,
18091813 ]
18101814 )
18111815
1816+ static let jsWebAssemblyGlobalPrototype = createPrototypeObjectGroup ( jsWasmGlobal)
1817+
18121818 static let jsWebAssemblyGlobalConstructor = ObjectGroup (
18131819 name: " WebAssemblyGlobalConstructor " ,
18141820 instanceType: . jsWebAssemblyGlobalConstructor,
1815- properties: [ : ] ,
1821+ properties: [
1822+ " prototype " : jsWebAssemblyGlobalPrototype. instanceType,
1823+ ] ,
18161824 methods: [ : ]
18171825 )
18181826
@@ -1866,7 +1874,7 @@ public extension ObjectGroup {
18661874 /// ObjectGroup modelling JavaScript WebAssembly Global objects.
18671875 static let jsWasmGlobal = ObjectGroup (
18681876 name: " WasmGlobal " ,
1869- instanceType: . jsWasmGlobal ,
1877+ instanceType: nil ,
18701878 properties: [
18711879 // TODO: Try using precise JS types based on the global's underlying valuetype (e.g. float for f32 and f64).
18721880 " value " : . jsAnything
0 commit comments