File tree 4 files changed +24
-1
lines changed
4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -1162,6 +1162,14 @@ impl ToTokens for ast::ImportStatic {
1162
1162
} ;
1163
1163
} )
1164
1164
. to_tokens ( into) ;
1165
+
1166
+ Descriptor (
1167
+ & shim_name,
1168
+ quote ! {
1169
+ <#ty as WasmDescribe >:: describe( ) ;
1170
+ } ,
1171
+ )
1172
+ . to_tokens ( into) ;
1165
1173
}
1166
1174
}
1167
1175
Original file line number Diff line number Diff line change @@ -1049,6 +1049,11 @@ impl<'a> Context<'a> {
1049
1049
None => return Ok ( ( ) ) ,
1050
1050
} ;
1051
1051
1052
+ let descriptor = match self . descriptors . remove ( static_. shim ) {
1053
+ None => return Ok ( ( ) ) ,
1054
+ Some ( d) => d,
1055
+ } ;
1056
+
1052
1057
// Register the signature of this imported shim
1053
1058
bindings:: register_import (
1054
1059
self . module ,
@@ -1057,7 +1062,7 @@ impl<'a> Context<'a> {
1057
1062
Function {
1058
1063
arguments : Vec :: new ( ) ,
1059
1064
shim_idx : 0 ,
1060
- ret : Descriptor :: Anyref ,
1065
+ ret : descriptor ,
1061
1066
} ,
1062
1067
ast:: WebidlFunctionKind :: Static ,
1063
1068
) ?;
Original file line number Diff line number Diff line change @@ -105,3 +105,5 @@ exports.assert_dead_import_not_generated = function() {
105
105
exports . import_inside_function_works = function ( ) { } ;
106
106
exports . import_inside_private_module = function ( ) { } ;
107
107
exports . should_call_undefined_functions = ( ) => false ;
108
+
109
+ exports . STATIC_STRING = 'x' ;
Original file line number Diff line number Diff line change @@ -51,6 +51,9 @@ extern "C" {
51
51
fn unused_import ( ) ;
52
52
fn assert_dead_import_not_generated ( ) ;
53
53
fn should_call_undefined_functions ( ) -> bool ;
54
+
55
+
56
+ static STATIC_STRING : String ;
54
57
}
55
58
56
59
#[ wasm_bindgen]
@@ -232,3 +235,8 @@ fn undefined_function_is_ok() {
232
235
x. method ( ) ;
233
236
x. set_property ( x. property ( ) ) ;
234
237
}
238
+
239
+ #[ wasm_bindgen_test]
240
+ fn static_string_ok ( ) {
241
+ assert_eq ! ( * STATIC_STRING , "x" ) ;
242
+ }
You can’t perform that action at this time.
0 commit comments