Browse Source

Add fast path for string concatenation (#723)

pull/725/head
João Borges 4 years ago committed by GitHub
parent
commit
3ce547d427
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      boa/src/value/operations.rs

1
boa/src/value/operations.rs

@ -11,6 +11,7 @@ impl Value {
(Self::Integer(x), Self::Rational(y)) => Self::rational(f64::from(*x) + y), (Self::Integer(x), Self::Rational(y)) => Self::rational(f64::from(*x) + y),
(Self::Rational(x), Self::Integer(y)) => Self::rational(x + f64::from(*y)), (Self::Rational(x), Self::Integer(y)) => Self::rational(x + f64::from(*y)),
(Self::String(ref x), Self::String(ref y)) => Self::string(format!("{}{}", x, y)),
(Self::String(ref x), ref y) => Self::string(format!("{}{}", x, y.to_string(ctx)?)), (Self::String(ref x), ref y) => Self::string(format!("{}{}", x, y.to_string(ctx)?)),
(ref x, Self::String(ref y)) => Self::string(format!("{}{}", x.to_string(ctx)?, y)), (ref x, Self::String(ref y)) => Self::string(format!("{}{}", x.to_string(ctx)?, y)),
(Self::BigInt(ref n1), Self::BigInt(ref n2)) => { (Self::BigInt(ref n1), Self::BigInt(ref n2)) => {

Loading…
Cancel
Save