Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnikaCodes committed Jan 1, 2021
1 parent bad6be4 commit e424fdb
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 7 deletions.
7 changes: 6 additions & 1 deletion boa/src/environment/declarative_environment_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ impl EnvironmentRecordTrait for DeclarativeEnvironmentRecord {
self.env_rec.contains_key(name)
}

fn create_mutable_binding(&mut self, name: String, deletion: bool, allow_name_reuse: bool) -> Result<(), ErrorKind> {
fn create_mutable_binding(
&mut self,
name: String,
deletion: bool,
allow_name_reuse: bool,
) -> Result<(), ErrorKind> {
if !allow_name_reuse {
assert!(
!self.env_rec.contains_key(&name),
Expand Down
7 changes: 6 additions & 1 deletion boa/src/environment/environment_record_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ pub trait EnvironmentRecordTrait: Debug + Trace + Finalize {
///
/// Most variable names cannot be reused, but functions in JavaScript are allowed to have multiple
/// paraments with the same name.
fn create_mutable_binding(&mut self, name: String, deletion: bool, allow_name_reuse: bool) -> Result<(), ErrorKind>;
fn create_mutable_binding(
&mut self,
name: String,
deletion: bool,
allow_name_reuse: bool,
) -> Result<(), ErrorKind>;

/// Create a new but uninitialized immutable binding in an Environment Record.
/// The String value N is the text of the bound name.
Expand Down
7 changes: 6 additions & 1 deletion boa/src/environment/function_environment_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ impl EnvironmentRecordTrait for FunctionEnvironmentRecord {
self.env_rec.contains_key(name)
}

fn create_mutable_binding(&mut self, name: String, deletion: bool, allow_name_reuse: bool) -> Result<(), ErrorKind> {
fn create_mutable_binding(
&mut self,
name: String,
deletion: bool,
allow_name_reuse: bool,
) -> Result<(), ErrorKind> {
if !allow_name_reuse {
assert!(
!self.env_rec.contains_key(&name),
Expand Down
7 changes: 6 additions & 1 deletion boa/src/environment/global_environment_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@ impl EnvironmentRecordTrait for GlobalEnvironmentRecord {
self.object_record.has_binding(name)
}

fn create_mutable_binding(&mut self, name: String, deletion: bool, allow_name_reuse: bool) -> Result<(), ErrorKind> {
fn create_mutable_binding(
&mut self,
name: String,
deletion: bool,
allow_name_reuse: bool,
) -> Result<(), ErrorKind> {
if !allow_name_reuse && self.declarative_record.has_binding(&name) {
return Err(ErrorKind::new_type_error(format!(
"Binding already exists for {}",
Expand Down
3 changes: 2 additions & 1 deletion boa/src/environment/lexical_environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ impl LexicalEnvironment {
})
.expect("No function or global environment");

env.borrow_mut().create_mutable_binding(name, deletion, false)
env.borrow_mut()
.create_mutable_binding(name, deletion, false)
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion boa/src/environment/object_environment_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ impl EnvironmentRecordTrait for ObjectEnvironmentRecord {
}
}

fn create_mutable_binding(&mut self, name: String, deletion: bool, _allow_name_reuse: bool) -> Result<(), ErrorKind> {
fn create_mutable_binding(
&mut self,
name: String,
deletion: bool,
_allow_name_reuse: bool,
) -> Result<(), ErrorKind> {
// TODO: could save time here and not bother generating a new undefined object,
// only for it to be replace with the real value later. We could just add the name to a Vector instead
let bindings = &mut self.bindings;
Expand Down
2 changes: 1 addition & 1 deletion boa/src/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#![allow(clippy::unsafe_removed_from_name)]

pub use crate::object::GcObject;
pub use ::gc::{
pub use gc::{
custom_trace, force_collect, unsafe_empty_trace as empty_trace, Finalize, GcCellRef as Ref,
GcCellRefMut as RefMut, Trace,
};

0 comments on commit e424fdb

Please sign in to comment.