Skip to content

Commit

Permalink
cargo-clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
HalidOdat committed Jun 20, 2023
1 parent 20ed799 commit 3e66d24
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions boa_engine/src/bytecompiler/jump_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ impl ByteCompiler<'_, '_> {
/// Default `JumpControlInfoKind` is `JumpControlInfoKind::Loop`
pub(crate) fn push_empty_loop_jump_control(&mut self, use_expr: bool) {
let new_info = JumpControlInfo::default().with_loop_flag(true);
self.push_contol_info(new_info, use_expr)
self.push_contol_info(new_info, use_expr);
}

pub(crate) fn current_jump_control_mut(&mut self) -> Option<&mut JumpControlInfo> {
Expand All @@ -222,7 +222,7 @@ impl ByteCompiler<'_, '_> {
self.jump_info.push(info);
}

/// Does the jump control info have the use_expr flag set to true.
/// Does the jump control info have the `use_expr` flag set to true.
///
/// See [`JumpControlInfoFlags`].
pub(crate) fn jump_control_info_has_use_expr(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/bytecompiler/statement/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl ByteCompiler<'_, '_> {
self.emit_opcode(Opcode::PushUndefined);
self.emit_opcode(Opcode::SetReturnValue);
}
self.compile_break(*node, use_expr)
self.compile_break(*node, use_expr);
}
Statement::Throw(throw) => {
self.compile_expr(throw.target(), true);
Expand Down
14 changes: 9 additions & 5 deletions boa_engine/src/vm/call_frame/env_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,18 @@ impl EnvStackEntry {
}

/// Returns calling [`EnvStackEntry`] with `kind` field of [`EnvEntryKind::Try`].
pub(crate) fn with_try_flag(mut self, fp: u32) -> Self {
pub(crate) const fn with_try_flag(mut self, fp: u32) -> Self {
self.kind = EnvEntryKind::Try { fp };
self
}

/// Returns calling [`EnvStackEntry`] with `kind` field of [`EnvEntryKind::Loop`], loop iteration set to zero
/// and iterator index set to `iterator`.
pub(crate) fn with_iterator_loop_flag(mut self, iteration_count: u64, iterator: u32) -> Self {
pub(crate) const fn with_iterator_loop_flag(
mut self,
iteration_count: u64,
iterator: u32,
) -> Self {
self.kind = EnvEntryKind::Loop {
iteration_count,
iterator: Some(iterator),
Expand All @@ -71,7 +75,7 @@ impl EnvStackEntry {

/// Returns calling [`EnvStackEntry`] with `kind` field of [`EnvEntryKind::Loop`].
/// And the loop iteration set to zero.
pub(crate) fn with_loop_flag(mut self, iteration_count: u64) -> Self {
pub(crate) const fn with_loop_flag(mut self, iteration_count: u64) -> Self {
self.kind = EnvEntryKind::Loop {
iteration_count,
iterator: None,
Expand All @@ -80,13 +84,13 @@ impl EnvStackEntry {
}

/// Returns calling [`EnvStackEntry`] with `kind` field of [`EnvEntryKind::Finally`].
pub(crate) fn with_finally_flag(mut self) -> Self {
pub(crate) const fn with_finally_flag(mut self) -> Self {
self.kind = EnvEntryKind::Finally;
self
}

/// Returns calling [`EnvStackEntry`] with `kind` field of [`EnvEntryKind::Labelled`].
pub(crate) fn with_labelled_flag(mut self) -> Self {
pub(crate) const fn with_labelled_flag(mut self) -> Self {
self.kind = EnvEntryKind::Labelled;
self
}
Expand Down

0 comments on commit 3e66d24

Please sign in to comment.