Browse Source

Make lifetime of return of init static to remove to_string

pull/587/head
joshwd36 4 years ago
parent
commit
064d8bc352
  1. 2
      boa/src/builtins/array/mod.rs
  2. 2
      boa/src/builtins/bigint/mod.rs
  3. 2
      boa/src/builtins/boolean/mod.rs
  4. 2
      boa/src/builtins/console/mod.rs
  5. 2
      boa/src/builtins/error/mod.rs
  6. 2
      boa/src/builtins/error/range.rs
  7. 2
      boa/src/builtins/error/reference.rs
  8. 2
      boa/src/builtins/error/syntax.rs
  9. 2
      boa/src/builtins/error/type.rs
  10. 2
      boa/src/builtins/function/mod.rs
  11. 2
      boa/src/builtins/global_this/mod.rs
  12. 2
      boa/src/builtins/infinity/mod.rs
  13. 2
      boa/src/builtins/json/mod.rs
  14. 2
      boa/src/builtins/map/mod.rs
  15. 2
      boa/src/builtins/math/mod.rs
  16. 1
      boa/src/builtins/mod.rs
  17. 2
      boa/src/builtins/nan/mod.rs
  18. 2
      boa/src/builtins/number/mod.rs
  19. 2
      boa/src/builtins/object/mod.rs
  20. 2
      boa/src/builtins/regexp/mod.rs
  21. 2
      boa/src/builtins/string/mod.rs
  22. 2
      boa/src/builtins/symbol/mod.rs
  23. 2
      boa/src/builtins/undefined/mod.rs

2
boa/src/builtins/array/mod.rs

@ -1114,7 +1114,7 @@ impl Array {
/// Initialise the `Array` object on the global object.
#[inline]
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

2
boa/src/builtins/bigint/mod.rs

@ -200,7 +200,7 @@ impl BigInt {
/// Initialise the `BigInt` object on the global object.
#[inline]
pub fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

2
boa/src/builtins/boolean/mod.rs

@ -98,7 +98,7 @@ impl Boolean {
/// Initialise the `Boolean` object on the global object.
#[inline]
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

2
boa/src/builtins/console/mod.rs

@ -489,7 +489,7 @@ impl Console {
/// Initialise the `console` object on the global object.
#[inline]
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

2
boa/src/builtins/error/mod.rs

@ -76,7 +76,7 @@ impl Error {
/// Initialise the global object with the `Error` object.
#[inline]
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

2
boa/src/builtins/error/range.rs

@ -62,7 +62,7 @@ impl RangeError {
/// Initialise the global object with the `RangeError` object.
#[inline]
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

2
boa/src/builtins/error/reference.rs

@ -60,7 +60,7 @@ impl ReferenceError {
}
/// Initialise the global object with the `ReferenceError` object.
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

2
boa/src/builtins/error/syntax.rs

@ -64,7 +64,7 @@ impl SyntaxError {
/// Initialise the global object with the `SyntaxError` object.
#[inline]
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

2
boa/src/builtins/error/type.rs

@ -68,7 +68,7 @@ impl TypeError {
/// Initialise the global object with the `RangeError` object.
#[inline]
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

2
boa/src/builtins/function/mod.rs

@ -533,7 +533,7 @@ where
/// Initialise the `Function` object on the global object.
#[inline]
pub fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event("function", "init");
let prototype = Value::new_object(Some(global));

2
boa/src/builtins/global_this/mod.rs

@ -24,7 +24,7 @@ impl GlobalThis {
/// Initialize the `globalThis` property on the global object.
#[inline]
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

2
boa/src/builtins/infinity/mod.rs

@ -24,7 +24,7 @@ impl Infinity {
/// Initialize the `Infinity` property on the global object.
#[inline]
pub(crate) fn init(_interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(_interpreter: &mut Interpreter) -> (&'static str, Value) {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");
(Self::NAME, Value::from(f64::INFINITY))

2
boa/src/builtins/json/mod.rs

@ -172,7 +172,7 @@ impl Json {
/// Initialise the `JSON` object on the global object.
#[inline]
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");
let json = Value::new_object(Some(global));

2
boa/src/builtins/map/mod.rs

@ -284,7 +284,7 @@ impl Map {
}
/// Initialise the `Map` object on the global object.
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

2
boa/src/builtins/math/mod.rs

@ -697,7 +697,7 @@ impl Math {
/// Initialise the `Math` object on the global object.
#[inline]
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

1
boa/src/builtins/mod.rs

@ -75,7 +75,6 @@ pub fn init(interpreter: &mut Interpreter) {
for init in &globals {
let (name, value) = init(interpreter);
let name = name.to_string();
let global = &interpreter.realm.global_obj;
match global {
Value::Object(ref global_object) => {

2
boa/src/builtins/nan/mod.rs

@ -25,7 +25,7 @@ impl NaN {
/// Initialize the `NaN` property on the global object.
#[inline]
pub(crate) fn init(_interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(_interpreter: &mut Interpreter) -> (&'static str, Value) {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");
(Self::NAME, Value::from(f64::NAN))

2
boa/src/builtins/number/mod.rs

@ -727,7 +727,7 @@ impl Number {
/// Initialise the `Number` object on the global object.
#[inline]
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

2
boa/src/builtins/object/mod.rs

@ -577,7 +577,7 @@ pub fn property_is_enumerable(this: &Value, args: &[Value], ctx: &mut Interprete
/// Initialise the `Object` object on the global object.
#[inline]
pub fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event("object", "init");

2
boa/src/builtins/regexp/mod.rs

@ -492,7 +492,7 @@ impl RegExp {
/// Initialise the `RegExp` object on the global object.
#[inline]
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

2
boa/src/builtins/string/mod.rs

@ -1023,7 +1023,7 @@ impl String {
/// Initialise the `String` object on the global object.
#[inline]
pub(crate) fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let global = &interpreter.realm.global_obj;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

2
boa/src/builtins/symbol/mod.rs

@ -100,7 +100,7 @@ impl Symbol {
/// Initialise the `Symbol` object on the global object.
#[inline]
pub fn init(interpreter: &mut Interpreter) -> (&str, Value) {
pub fn init(interpreter: &mut Interpreter) -> (&'static str, Value) {
let symbol_async_iterator = Symbol(
Some("Symbol.asyncIterator".into()),
interpreter.generate_hash(),

2
boa/src/builtins/undefined/mod.rs

@ -24,7 +24,7 @@ impl Undefined {
/// Initialize the `undefined` property on the global object.
#[inline]
pub(crate) fn init(_interpreter: &mut Interpreter) -> (&str, Value) {
pub(crate) fn init(_interpreter: &mut Interpreter) -> (&'static str, Value) {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");
(Self::NAME, Value::undefined())

Loading…
Cancel
Save