Skip to content

Commit

Permalink
Merge 41a9ff6 into 5f4a1f2
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwilliams authored May 20, 2020
2 parents 5f4a1f2 + 41a9ff6 commit 7e5cfaa
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions boa/src/builtins/string/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ use std::{
/// [[Construct]] - Creates a new instance `this`
///
/// [[Call]] - Returns a new native `string`
/// <https://tc39.es/ecma262/#sec-string-constructor-string-value>
pub fn make_string(this: &mut Value, args: &[Value], _: &mut Interpreter) -> ResultValue {
// This value is used by console.log and other routines to match Obexpecty"failed to parse argument for String method"pe
// to its Javascript Identifier (global constructor method name)
let s = args
.get(0)
.expect("failed to get StringData for make_string()")
.clone();
let s = args.get(0).unwrap_or(&Value::string("")).clone();
let length_str = s.to_string().chars().count();

this.set_field_slice("length", Value::from(length_str as i32));
Expand Down

0 comments on commit 7e5cfaa

Please sign in to comment.