Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename boa::Result to JsResult #1493

Merged
merged 4 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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