Skip to content

Commit

Permalink
String wasn't defaulting to empty when called as String() with no arg…
Browse files Browse the repository at this point in the history
…ument
  • Loading branch information
jasonwilliams committed May 20, 2020
1 parent 63f37a2 commit ca615dd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions boa/src/builtins/string/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,14 @@ 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)
this.set_kind(ObjectKind::String);
this.set_internal_slot(
"StringData",
args.get(0)
.expect("failed to get StringData for make_string()")
.clone(),
args.get(0).unwrap_or(&Value::string("")).clone(),
);

let arg = match args.get(0) {
Expand Down

0 comments on commit ca615dd

Please sign in to comment.