mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 03:17:34 +00:00
LibJS: Make native function/property callbacks take VM, not Interpreter
More work on decoupling the general runtime from Interpreter. The goal is becoming clearer. Interpreter should be one possible way to execute code inside a VM. In the future we might have other ways :^)
This commit is contained in:
parent
1ff9d33131
commit
340a115dfe
64 changed files with 1160 additions and 1114 deletions
|
@ -43,7 +43,7 @@ DateCell::~DateCell()
|
|||
String DateCell::display(Cell& cell, const CellTypeMetadata& metadata) const
|
||||
{
|
||||
auto timestamp = js_value(cell, metadata);
|
||||
auto string = Core::DateTime::from_timestamp(timestamp.to_i32(cell.sheet->interpreter())).to_string(metadata.format.is_empty() ? "%Y-%m-%d %H:%M:%S" : metadata.format.characters());
|
||||
auto string = Core::DateTime::from_timestamp(timestamp.to_i32(cell.sheet->global_object())).to_string(metadata.format.is_empty() ? "%Y-%m-%d %H:%M:%S" : metadata.format.characters());
|
||||
|
||||
if (metadata.length >= 0)
|
||||
return string.substring(0, metadata.length);
|
||||
|
@ -53,7 +53,7 @@ String DateCell::display(Cell& cell, const CellTypeMetadata& metadata) const
|
|||
|
||||
JS::Value DateCell::js_value(Cell& cell, const CellTypeMetadata&) const
|
||||
{
|
||||
auto value = cell.js_data().to_double(cell.sheet->interpreter());
|
||||
auto value = cell.js_data().to_double(cell.sheet->global_object());
|
||||
return JS::Value(value / 1000); // Turn it to seconds
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ String NumericCell::display(Cell& cell, const CellTypeMetadata& metadata) const
|
|||
if (metadata.format.is_empty())
|
||||
string = value.to_string_without_side_effects();
|
||||
else
|
||||
string = format_double(metadata.format.characters(), value.to_double(cell.sheet->interpreter()));
|
||||
string = format_double(metadata.format.characters(), value.to_double(cell.sheet->global_object()));
|
||||
|
||||
if (metadata.length >= 0)
|
||||
return string.substring(0, metadata.length);
|
||||
|
@ -57,7 +57,7 @@ String NumericCell::display(Cell& cell, const CellTypeMetadata& metadata) const
|
|||
|
||||
JS::Value NumericCell::js_value(Cell& cell, const CellTypeMetadata&) const
|
||||
{
|
||||
return cell.js_data().to_number(cell.sheet->interpreter());
|
||||
return cell.js_data().to_number(cell.sheet->global_object());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue