Skip to content

Commit

Permalink
Rename boa::Result to JsResult (#1493)
Browse files Browse the repository at this point in the history
* Rename `boa::Result` to `JsResult`

* fix vm/mod.rs

* rustfmt
  • Loading branch information
bartlomieju authored Aug 24, 2021
1 parent 59c56c5 commit 42d8f20
Show file tree
Hide file tree
Showing 84 changed files with 784 additions and 616 deletions.
8 changes: 4 additions & 4 deletions boa/examples/classes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use boa::{
class::{Class, ClassBuilder},
gc::{Finalize, Trace},
property::Attribute,
Context, JsValue, Result,
Context, JsResult, JsValue,
};

// We create a new struct that is going to represent a person.
Expand All @@ -26,7 +26,7 @@ struct Person {
// or any function that matches that signature.
impl Person {
/// This function says hello
fn say_hello(this: &JsValue, _: &[JsValue], context: &mut Context) -> Result<JsValue> {
fn say_hello(this: &JsValue, _: &[JsValue], context: &mut Context) -> JsResult<JsValue> {
// We check if this is an object.
if let Some(object) = this.as_object() {
// If it is we downcast the type to type `Person`.
Expand Down Expand Up @@ -57,7 +57,7 @@ impl Class for Person {
const LENGTH: usize = 2;

// This is what is called when we do `new Person()`
fn constructor(_this: &JsValue, args: &[JsValue], context: &mut Context) -> Result<Self> {
fn constructor(_this: &JsValue, args: &[JsValue], context: &mut Context) -> JsResult<Self> {
// We get the first argument. If it is unavailable we get `undefined`. And, then call `to_string()`.
//
// This is equivalent to `String(arg)`.
Expand All @@ -81,7 +81,7 @@ impl Class for Person {
}

/// This is where the object is intitialized.
fn init(class: &mut ClassBuilder) -> Result<()> {
fn init(class: &mut ClassBuilder) -> JsResult<()> {
// we add a inheritable method `sayHello` with length `0` the amount of args it takes.
//
// This function is added to `Person.prototype.sayHello()`
Expand Down
4 changes: 2 additions & 2 deletions boa/src/builtins/array/array_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
object::{GcObject, ObjectData},
property::PropertyDescriptor,
symbol::WellKnownSymbols,
BoaProfiler, Context, Result,
BoaProfiler, Context, JsResult,
};

#[derive(Debug, Clone, Finalize, Trace)]
Expand Down Expand Up @@ -68,7 +68,7 @@ impl ArrayIterator {
/// - [ECMA reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
pub(crate) fn next(this: &JsValue, _: &[JsValue], context: &mut Context) -> Result<JsValue> {
pub(crate) fn next(this: &JsValue, _: &[JsValue], context: &mut Context) -> JsResult<JsValue> {
if let JsValue::Object(ref object) = this {
let mut object = object.borrow_mut();
if let Some(array_iterator) = object.as_array_iterator_mut() {
Expand Down
Loading

0 comments on commit 42d8f20

Please sign in to comment.