@@ -287,7 +287,10 @@ impl<'a> ToIdlType<'a> for AttributedType<'a> {
287
287
288
288
impl < ' a > ToIdlType < ' a > for Identifier < ' a > {
289
289
fn to_idl_type ( & self , record : & FirstPassRecord < ' a > ) -> Option < IdlType < ' a > > {
290
- if let Some ( idl_type) = record. typedefs . get ( & self . 0 ) {
290
+ if self . 0 == "DOMTimeStamp" {
291
+ // https://heycam.github.io/webidl/#DOMTimeStamp
292
+ Some ( IdlType :: UnsignedLongLong )
293
+ } else if let Some ( idl_type) = record. typedefs . get ( & self . 0 ) {
291
294
idl_type. to_idl_type ( record)
292
295
} else if record. interfaces . contains_key ( self . 0 ) {
293
296
Some ( IdlType :: Interface ( self . 0 ) )
@@ -458,8 +461,22 @@ impl<'a> IdlType<'a> {
458
461
IdlType :: UnsignedShort => Some ( ident_ty ( raw_ident ( "u16" ) ) ) ,
459
462
IdlType :: Long => Some ( ident_ty ( raw_ident ( "i32" ) ) ) ,
460
463
IdlType :: UnsignedLong => Some ( ident_ty ( raw_ident ( "u32" ) ) ) ,
461
- IdlType :: LongLong => None ,
462
- IdlType :: UnsignedLongLong => None ,
464
+
465
+ // Technically these are 64-bit numbers, but we're binding web
466
+ // APIs that don't actually have return the corresponding 64-bit
467
+ // type, `BigInt`. Instead the web basically uses floats for these
468
+ // values. We already expand these types in argument position to
469
+ // i32/f64 (convenience for i32, losslessness for f64). If we get
470
+ // here then we're looking at an un-flattened long type such as
471
+ // dictionary fields or return types. In order to generate bindings
472
+ // for these functions we just use `f64` here, which should match
473
+ // exactly what the JS web currently uses anyway.
474
+ //
475
+ // Perhaps one day we'll bind to u64/i64 here, but we need `BigInt`
476
+ // to see more usage!
477
+ IdlType :: LongLong |
478
+ IdlType :: UnsignedLongLong => Some ( ident_ty ( raw_ident ( "f64" ) ) ) ,
479
+
463
480
IdlType :: Float => Some ( ident_ty ( raw_ident ( "f32" ) ) ) ,
464
481
IdlType :: UnrestrictedFloat => Some ( ident_ty ( raw_ident ( "f32" ) ) ) ,
465
482
IdlType :: Double => Some ( ident_ty ( raw_ident ( "f64" ) ) ) ,
0 commit comments