mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:27:45 +00:00
LibJS+Spreadsheet: Use js_string(VM&, ...) overload more
This commit is contained in:
parent
bac3c2cf6d
commit
312946059b
21 changed files with 24 additions and 24 deletions
|
@ -192,9 +192,9 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_real_cell_contents)
|
|||
return JS::js_undefined();
|
||||
|
||||
if (cell->kind() == Spreadsheet::Cell::Kind::Formula)
|
||||
return JS::js_string(vm.heap(), String::formatted("={}", cell->data()));
|
||||
return JS::js_string(vm, String::formatted("={}", cell->data()));
|
||||
|
||||
return JS::js_string(vm.heap(), cell->data());
|
||||
return JS::js_string(vm, cell->data());
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::set_real_cell_contents)
|
||||
|
|
|
@ -28,7 +28,7 @@ void ArrayBufferPrototype::initialize(GlobalObject& global_object)
|
|||
define_native_accessor(vm.names.byteLength, byte_length_getter, {}, Attribute::Configurable);
|
||||
|
||||
// 25.1.5.4 ArrayBuffer.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-arraybuffer.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), vm.names.ArrayBuffer.as_string()), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.ArrayBuffer.as_string()), Attribute::Configurable);
|
||||
}
|
||||
|
||||
ArrayBufferPrototype::~ArrayBufferPrototype()
|
||||
|
|
|
@ -71,7 +71,7 @@ void MathObject::initialize(GlobalObject& global_object)
|
|||
define_direct_property(vm.names.SQRT2, Value(M_SQRT2), 0);
|
||||
|
||||
// 21.3.1.9 Math [ @@toStringTag ], https://tc39.es/ecma262/#sec-math-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), vm.names.Math.as_string()), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.Math.as_string()), Attribute::Configurable);
|
||||
}
|
||||
|
||||
MathObject::~MathObject()
|
||||
|
|
|
@ -1027,14 +1027,14 @@ void Object::define_native_accessor(PropertyName const& property_name, Function<
|
|||
auto name = String::formatted("get {}", formatted_property_name);
|
||||
getter_function = NativeFunction::create(global_object(), name, move(getter));
|
||||
getter_function->define_direct_property(vm.names.length, Value(0), Attribute::Configurable);
|
||||
getter_function->define_direct_property(vm.names.name, js_string(vm.heap(), name), Attribute::Configurable);
|
||||
getter_function->define_direct_property(vm.names.name, js_string(vm, name), Attribute::Configurable);
|
||||
}
|
||||
FunctionObject* setter_function = nullptr;
|
||||
if (setter) {
|
||||
auto name = String::formatted("set {}", formatted_property_name);
|
||||
setter_function = NativeFunction::create(global_object(), name, move(setter));
|
||||
setter_function->define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
setter_function->define_direct_property(vm.names.name, js_string(vm.heap(), name), Attribute::Configurable);
|
||||
setter_function->define_direct_property(vm.names.name, js_string(vm, name), Attribute::Configurable);
|
||||
}
|
||||
return define_direct_accessor(property_name, getter_function, setter_function, attribute);
|
||||
}
|
||||
|
@ -1088,7 +1088,7 @@ void Object::define_native_function(PropertyName const& property_name, Function<
|
|||
}
|
||||
auto* function = NativeFunction::create(global_object(), function_name, move(native_function));
|
||||
function->define_direct_property(vm.names.length, Value(length), Attribute::Configurable);
|
||||
function->define_direct_property(vm.names.name, js_string(vm.heap(), function_name), Attribute::Configurable);
|
||||
function->define_direct_property(vm.names.name, js_string(vm, function_name), Attribute::Configurable);
|
||||
define_direct_property(property_name, function, attribute);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ void PromisePrototype::initialize(GlobalObject& global_object)
|
|||
define_native_function(vm.names.finally, finally, 1, attr);
|
||||
|
||||
// 27.2.5.5 Promise.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-promise.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), vm.names.Promise.as_string()), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.Promise.as_string()), Attribute::Configurable);
|
||||
}
|
||||
|
||||
static Promise* promise_from(VM& vm, GlobalObject& global_object)
|
||||
|
|
|
@ -40,7 +40,7 @@ void ReflectObject::initialize(GlobalObject& global_object)
|
|||
define_native_function(vm.names.setPrototypeOf, set_prototype_of, 2, attr);
|
||||
|
||||
// 28.1.14 Reflect [ @@toStringTag ], https://tc39.es/ecma262/#sec-reflect-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), vm.names.Reflect.as_string()), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.Reflect.as_string()), Attribute::Configurable);
|
||||
}
|
||||
|
||||
ReflectObject::~ReflectObject()
|
||||
|
|
|
@ -37,7 +37,7 @@ void SetPrototype::initialize(GlobalObject& global_object)
|
|||
define_direct_property(*vm.well_known_symbol_iterator(), get(vm.names.values), attr);
|
||||
|
||||
// 24.2.3.12 Set.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-set.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), vm.names.Set.as_string()), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.Set.as_string()), Attribute::Configurable);
|
||||
}
|
||||
|
||||
SetPrototype::~SetPrototype()
|
||||
|
|
|
@ -27,7 +27,7 @@ void CalendarPrototype::initialize(GlobalObject& global_object)
|
|||
auto& vm = this->vm();
|
||||
|
||||
// 12.4.2 Temporal.Calendar.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal.Calendar"), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.Calendar"), Attribute::Configurable);
|
||||
|
||||
define_native_accessor(vm.names.id, id_getter, {}, Attribute::Configurable);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ void DurationPrototype::initialize(GlobalObject& global_object)
|
|||
auto& vm = this->vm();
|
||||
|
||||
// 7.3.2 Temporal.Duration.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal.Duration"), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.Duration"), Attribute::Configurable);
|
||||
|
||||
define_native_accessor(vm.names.years, years_getter, {}, Attribute::Configurable);
|
||||
define_native_accessor(vm.names.months, months_getter, {}, Attribute::Configurable);
|
||||
|
|
|
@ -27,7 +27,7 @@ void InstantPrototype::initialize(GlobalObject& global_object)
|
|||
auto& vm = this->vm();
|
||||
|
||||
// 8.3.2 Temporal.Instant.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal.Instant"), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.Instant"), Attribute::Configurable);
|
||||
|
||||
define_native_accessor(vm.names.epochSeconds, epoch_seconds_getter, {}, Attribute::Configurable);
|
||||
define_native_accessor(vm.names.epochMilliseconds, epoch_milliseconds_getter, {}, Attribute::Configurable);
|
||||
|
|
|
@ -31,7 +31,7 @@ void Now::initialize(GlobalObject& global_object)
|
|||
auto& vm = this->vm();
|
||||
|
||||
// 2.1.1 Temporal.Now [ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal-now-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal.Now"), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.Now"), Attribute::Configurable);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.timeZone, time_zone, 0, attr);
|
||||
|
|
|
@ -26,7 +26,7 @@ void PlainDatePrototype::initialize(GlobalObject& global_object)
|
|||
auto& vm = this->vm();
|
||||
|
||||
// 3.3.2 Temporal.PlainDate.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal.PlainDate"), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.PlainDate"), Attribute::Configurable);
|
||||
|
||||
define_native_accessor(vm.names.calendar, calendar_getter, {}, Attribute::Configurable);
|
||||
define_native_accessor(vm.names.year, year_getter, {}, Attribute::Configurable);
|
||||
|
|
|
@ -27,7 +27,7 @@ void PlainDateTimePrototype::initialize(GlobalObject& global_object)
|
|||
auto& vm = this->vm();
|
||||
|
||||
// 5.3.2 Temporal.PlainDateTime.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal.PlainDateTime"), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.PlainDateTime"), Attribute::Configurable);
|
||||
|
||||
define_native_accessor(vm.names.calendar, calendar_getter, {}, Attribute::Configurable);
|
||||
define_native_accessor(vm.names.year, year_getter, {}, Attribute::Configurable);
|
||||
|
|
|
@ -27,7 +27,7 @@ void PlainTimePrototype::initialize(GlobalObject& global_object)
|
|||
auto& vm = this->vm();
|
||||
|
||||
// 4.3.2 Temporal.PlainTime.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal.PlainTime"), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.PlainTime"), Attribute::Configurable);
|
||||
|
||||
define_native_accessor(vm.names.calendar, calendar_getter, {}, Attribute::Configurable);
|
||||
define_native_accessor(vm.names.hour, hour_getter, {}, Attribute::Configurable);
|
||||
|
|
|
@ -25,7 +25,7 @@ void PlainYearMonthPrototype::initialize(GlobalObject& global_object)
|
|||
auto& vm = this->vm();
|
||||
|
||||
// 9.3.2 Temporal.PlainYearMonth.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal.PlainYearMonth"), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.PlainYearMonth"), Attribute::Configurable);
|
||||
|
||||
define_native_accessor(vm.names.calendar, calendar_getter, {}, Attribute::Configurable);
|
||||
define_native_accessor(vm.names.year, year_getter, {}, Attribute::Configurable);
|
||||
|
|
|
@ -32,7 +32,7 @@ void Temporal::initialize(GlobalObject& global_object)
|
|||
auto& vm = this->vm();
|
||||
|
||||
// 1.1.1 Temporal [ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal"), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal"), Attribute::Configurable);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_direct_property(vm.names.Now, heap().allocate<Now>(global_object, global_object), attr);
|
||||
|
|
|
@ -35,7 +35,7 @@ void TimeZonePrototype::initialize(GlobalObject& global_object)
|
|||
define_native_function(vm.names.toJSON, to_json, 0, attr);
|
||||
|
||||
// 11.4.2 Temporal.TimeZone.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal.TimeZone"), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.TimeZone"), Attribute::Configurable);
|
||||
}
|
||||
|
||||
static TimeZone* typed_this(GlobalObject& global_object)
|
||||
|
|
|
@ -30,7 +30,7 @@ void ZonedDateTimePrototype::initialize(GlobalObject& global_object)
|
|||
auto& vm = this->vm();
|
||||
|
||||
// 6.3.2 Temporal.ZonedDateTime.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), "Temporal.ZonedDateTime"), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.ZonedDateTime"), Attribute::Configurable);
|
||||
|
||||
define_native_accessor(vm.names.calendar, calendar_getter, {}, Attribute::Configurable);
|
||||
define_native_accessor(vm.names.timeZone, time_zone_getter, {}, Attribute::Configurable);
|
||||
|
|
|
@ -1110,7 +1110,7 @@ Value add(GlobalObject& global_object, Value lhs, Value rhs)
|
|||
StringBuilder builder(lhs_string.length() + rhs_string.length());
|
||||
builder.append(lhs_string);
|
||||
builder.append(rhs_string);
|
||||
return js_string(vm.heap(), builder.to_string());
|
||||
return js_string(vm, builder.to_string());
|
||||
}
|
||||
|
||||
auto lhs_numeric = lhs_primitive.to_numeric(global_object);
|
||||
|
|
|
@ -27,7 +27,7 @@ void WeakMapPrototype::initialize(GlobalObject& global_object)
|
|||
define_native_function(vm.names.set, set, 2, attr);
|
||||
|
||||
// 24.3.3.6 WeakMap.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-weakmap.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), vm.names.WeakMap.as_string()), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.WeakMap.as_string()), Attribute::Configurable);
|
||||
}
|
||||
|
||||
WeakMapPrototype::~WeakMapPrototype()
|
||||
|
|
|
@ -21,7 +21,7 @@ void WeakRefPrototype::initialize(GlobalObject& global_object)
|
|||
|
||||
define_native_function(vm.names.deref, deref, 0, Attribute::Writable | Attribute::Configurable);
|
||||
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm.heap(), vm.names.WeakRef.as_string()), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.WeakRef.as_string()), Attribute::Configurable);
|
||||
}
|
||||
|
||||
WeakRefPrototype::~WeakRefPrototype()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue