Browse Source

Change Symbol hash to u64 (#911)

pull/914/head
Halid Odat 4 years ago committed by GitHub
parent
commit
16e3d2edc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      boa/src/builtins/symbol/mod.rs
  2. 6
      boa/src/context.rs

8
boa/src/builtins/symbol/mod.rs

@ -46,7 +46,7 @@ pub struct WellKnownSymbols {
}
impl WellKnownSymbols {
pub(crate) fn new() -> (Self, u32) {
pub(crate) fn new() -> (Self, u64) {
let mut count = 0;
let async_iterator = Symbol::new(count, Some("Symbol.asyncIterator".into())).into();
@ -223,12 +223,12 @@ impl WellKnownSymbols {
#[derive(Debug, Finalize, Trace, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Symbol {
hash: u32,
hash: u64,
description: Option<RcString>,
}
impl Symbol {
pub(crate) fn new(hash: u32, description: Option<RcString>) -> Self {
pub(crate) fn new(hash: u64, description: Option<RcString>) -> Self {
Self { hash, description }
}
}
@ -300,7 +300,7 @@ impl Symbol {
}
/// Returns the `Symbol`s hash.
pub fn hash(&self) -> u32 {
pub fn hash(&self) -> u64 {
self.hash
}

6
boa/src/context.rs

@ -181,8 +181,8 @@ pub struct Context {
/// Symbol hash.
///
/// For now this is an incremented u32 number.
symbol_count: u32,
/// For now this is an incremented u64 number.
symbol_count: u64,
/// console object state.
#[cfg(feature = "console")]
@ -264,7 +264,7 @@ impl Context {
///
/// This currently is an incremented value.
#[inline]
fn generate_hash(&mut self) -> u32 {
fn generate_hash(&mut self) -> u64 {
let hash = self.symbol_count;
self.symbol_count += 1;
hash

Loading…
Cancel
Save