From 3888e7122c0c83c69cd6bc58802525ddd2c0c7f9 Mon Sep 17 00:00:00 2001 From: Vishal Sodani Date: Thu, 14 Jan 2021 23:38:19 +0530 Subject: [PATCH 1/4] Fixed spelling --- boa/examples/classes.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/boa/examples/classes.rs b/boa/examples/classes.rs index 1e10e22293c..03a526ef606 100644 --- a/boa/examples/classes.rs +++ b/boa/examples/classes.rs @@ -10,7 +10,7 @@ use boa::{ // We derive `Debug`, `Trace` and `Finalize`, It automatically implements `NativeObject` // so we can pass it an object in JavaScript. // -// The fields of the sturct are not accesable by JavaScript unless accessors are created for them. +// The fields of the sturct are not accessible by JavaScript unless accessors are created for them. /// This Represents a Person. #[derive(Debug, Trace, Finalize)] struct Person { @@ -58,7 +58,7 @@ impl Class for Person { // This is what is called when we do `new Person()` fn constructor(_this: &Value, args: &[Value], context: &mut Context) -> Result { - // we get the first arguemnt of undefined if the first one is unavalable and call `to_string`. + // we get the first argument of undefined if the first one is unavailable and call `to_string`. // // This is equivalent to `String(arg)`. let name = args @@ -66,12 +66,12 @@ impl Class for Person { .cloned() .unwrap_or_default() .to_string(context)?; - // we get the second arguemnt of undefined if the first one is unavalable and call `to_u32`. + // we get the second argument of undefined if the first one is unavailable and call `to_u32`. // // This is equivalent to `arg | 0`. let age = args.get(1).cloned().unwrap_or_default().to_u32(context)?; - // we construct the the native struct `Person` + // we construct the native struct `Person` let person = Person { name: name.to_string(), age, @@ -86,7 +86,7 @@ impl Class for Person { // // This function is added to `Person.prototype.sayHello()` class.method("sayHello", 0, Self::say_hello); - // we add a static mathod `is`, and here we use a closure, but it must be converible + // we add a static mathod `is`, and here we use a closure, but it must be convertible // to a NativeFunction. it must not contain state, if it does it will give a compilation error. // // This function is added to `Person.is()` @@ -102,11 +102,11 @@ impl Class for Person { Ok(false.into()) // otherwise `false`. }); - // Add a inherited property with the value `10`, with deafault attribute. + // Add a inherited property with the value `10`, with default attribute. // (`READONLY, NON_ENUMERABLE, PERMANENT). class.property("inheritedProperty", 10, Attribute::default()); - // Add a static property with the value `"Im a static property"`, with deafault attribute. + // Add a static property with the value `"Im a static property"`, with default attribute. // (`WRITABLE, ENUMERABLE, PERMANENT`). class.static_property( "staticProperty", From 8937dd7b87fd75e9a2315f782a47ab226034e8da Mon Sep 17 00:00:00 2001 From: Vishal Sodani Date: Fri, 15 Jan 2021 10:44:56 +0530 Subject: [PATCH 2/4] Update boa/examples/classes.rs Co-authored-by: tofpie <75836434+tofpie@users.noreply.github.com> --- boa/examples/classes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boa/examples/classes.rs b/boa/examples/classes.rs index 03a526ef606..80dd6bb381a 100644 --- a/boa/examples/classes.rs +++ b/boa/examples/classes.rs @@ -10,7 +10,7 @@ use boa::{ // We derive `Debug`, `Trace` and `Finalize`, It automatically implements `NativeObject` // so we can pass it an object in JavaScript. // -// The fields of the sturct are not accessible by JavaScript unless accessors are created for them. +// The fields of the struct are not accessible by JavaScript unless accessors are created for them. /// This Represents a Person. #[derive(Debug, Trace, Finalize)] struct Person { From 02a84d728a5e9b4546b58773c8c5f2a2fb36b332 Mon Sep 17 00:00:00 2001 From: Vishal Sodani Date: Fri, 15 Jan 2021 10:47:26 +0530 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: tofpie <75836434+tofpie@users.noreply.github.com> --- boa/examples/classes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boa/examples/classes.rs b/boa/examples/classes.rs index 80dd6bb381a..67084c64031 100644 --- a/boa/examples/classes.rs +++ b/boa/examples/classes.rs @@ -58,7 +58,7 @@ impl Class for Person { // This is what is called when we do `new Person()` fn constructor(_this: &Value, args: &[Value], context: &mut Context) -> Result { - // we get the first argument of undefined if the first one is unavailable and call `to_string`. + // we get the first argument or undefined if the first one is unavailable and call `to_string`. // // This is equivalent to `String(arg)`. let name = args From cbec905bf29d5a509ab3f99d528513b478b72268 Mon Sep 17 00:00:00 2001 From: Vishal Sodani Date: Fri, 15 Jan 2021 20:48:07 +0530 Subject: [PATCH 4/4] Update classes.rs --- boa/examples/classes.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boa/examples/classes.rs b/boa/examples/classes.rs index 67084c64031..475ce17b5b9 100644 --- a/boa/examples/classes.rs +++ b/boa/examples/classes.rs @@ -58,7 +58,7 @@ impl Class for Person { // This is what is called when we do `new Person()` fn constructor(_this: &Value, args: &[Value], context: &mut Context) -> Result { - // we get the first argument or undefined if the first one is unavailable and call `to_string`. + // We get the first argument. If it is unavailable we get `undefined`. And, then call `to_string()`. // // This is equivalent to `String(arg)`. let name = args @@ -66,7 +66,7 @@ impl Class for Person { .cloned() .unwrap_or_default() .to_string(context)?; - // we get the second argument of undefined if the first one is unavailable and call `to_u32`. + // We get the second argument. If it is unavailable we get `undefined`. And, then call `to_u32`. // // This is equivalent to `arg | 0`. let age = args.get(1).cloned().unwrap_or_default().to_u32(context)?;