Skip to content

Commit

Permalink
Remove unneeded return stmt and add more comments/docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nekevss committed Mar 9, 2023
1 parent 59ddcaf commit 3aaa136
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions boa_engine/src/vm/completion_record.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
//! An implementation of a `CompletionRecord` for Boa's VM.

use crate::{JsError, JsResult, JsValue};

/// An implementation of the ECMAScript's `CompletionRecord` [specification] for
/// Boa's VM output Completion and Result.
///
/// [specification]: https://tc39.es/ecma262/#sec-completion-record-specification-type
#[derive(Debug, Clone)]
pub(crate) enum CompletionRecord {
Normal(JsValue),
Expand All @@ -14,6 +20,11 @@ impl CompletionRecord {
}

/// This function will consume the current `CompletionRecord` and return a `JsResult<JsValue>`
// NOTE: rustc bug around evaluating destructors that prevents this from being a const function.
// Related issue(s):
// - https://github.com/rust-lang/rust-clippy/issues/4041
// - https://github.com/rust-lang/rust/issues/60964
// - https://github.com/rust-lang/rust/issues/73255
#[allow(clippy::missing_const_for_fn)]
pub(crate) fn consume(self) -> JsResult<JsValue> {
match self {
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/vm/opcode/push/class/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ impl Operation for PushClassPrototype {
context.vm.push(JsValue::Null);
Ok(CompletionType::Normal)
} else {
return Err(JsNativeError::typ()
Err(JsNativeError::typ()
.with_message("superclass must be a constructor")
.into());
.into())
}
}
}

0 comments on commit 3aaa136

Please sign in to comment.