File tree 4 files changed +26
-8
lines changed
4 files changed +26
-8
lines changed Original file line number Diff line number Diff line change @@ -1064,7 +1064,7 @@ impl TryToTokens for ast::ImportFunction {
1064
1064
& self . rust_name ,
1065
1065
) ;
1066
1066
1067
- let const_name = encode:: lookup_constant_for_fn ( & self . rust_name ) ;
1067
+ let const_name = encode:: lookup_constant_for_fn ( rust_name) ;
1068
1068
let id_bytes = gen_id ( ) ;
1069
1069
1070
1070
let invocation = quote ! {
Original file line number Diff line number Diff line change @@ -12,7 +12,13 @@ use crate::Diagnostic;
12
12
13
13
pub fn lookup_constant_for_fn ( ident : & Ident ) -> Ident {
14
14
Ident :: new (
15
- & format ! ( "__WASM_BINDGEN_GENERATED_{}" , ident. to_string( ) . to_uppercase( ) ) ,
15
+ & format ! (
16
+ "__WASM_BINDGEN_GENERATED_{}" ,
17
+ ident
18
+ . to_string( )
19
+ . trim_start_matches( & "r#" )
20
+ . to_uppercase( )
21
+ ) ,
16
22
Span :: call_site ( )
17
23
)
18
24
}
Original file line number Diff line number Diff line change @@ -142,6 +142,9 @@ impl<T: Hash> fmt::Display for ShortHash<T> {
142
142
env:: var ( "CARGO_PKG_VERSION" )
143
143
. expect ( "should have CARGO_PKG_VERSION env var" )
144
144
. hash ( & mut h) ;
145
+
146
+ std:: time:: SystemTime :: now ( ) . hash ( & mut h) ;
147
+
145
148
// This may chop off 32 bits on 32-bit platforms, but that's ok, we
146
149
// just want something to mix in below anyway.
147
150
HASH . store ( h. finish ( ) as usize , SeqCst ) ;
Original file line number Diff line number Diff line change @@ -185,12 +185,21 @@ impl<'a> Context<'a> {
185
185
}
186
186
187
187
self . expose_export_map ( ) ;
188
- self . expose_add_heap_object ( ) ;
189
- self . global ( & format ! (
190
- "EXPORT_MAP[\" {}\" ] = addHeapObject({});\n " ,
191
- result. into_iter( ) . collect:: <String >( ) ,
192
- definition_name,
193
- ) ) ;
188
+ if self . config . anyref {
189
+ self . expose_add_to_anyref_table ( ) ;
190
+ self . global ( & format ! (
191
+ "EXPORT_MAP[\" {}\" ] = addToAnyrefTable({});\n " ,
192
+ result. into_iter( ) . collect:: <String >( ) ,
193
+ definition_name,
194
+ ) ) ;
195
+ } else {
196
+ self . expose_add_heap_object ( ) ;
197
+ self . global ( & format ! (
198
+ "EXPORT_MAP[\" {}\" ] = addHeapObject({});\n " ,
199
+ result. into_iter( ) . collect:: <String >( ) ,
200
+ definition_name,
201
+ ) ) ;
202
+ }
194
203
}
195
204
Ok ( ( ) )
196
205
}
You can’t perform that action at this time.
0 commit comments