mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-01 00:38:48 +00:00
LibJS: Use FlyString in PropertyKey instead of DeprecatedFlyString
This required dealing with *substantial* fallout.
This commit is contained in:
parent
fc744e3f3f
commit
46a5710238
Notes:
github-actions[bot]
2025-03-24 22:28:26 +00:00
Author: https://github.com/awesomekling
Commit: 46a5710238
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4067
Reviewed-by: https://github.com/trflynn89
110 changed files with 985 additions and 987 deletions
|
@ -18,7 +18,7 @@ namespace JS {
|
|||
GC_DEFINE_ALLOCATOR(SyntheticModule);
|
||||
|
||||
// 1.2.1 CreateSyntheticModule ( exportNames, evaluationSteps, realm, hostDefined ), https://tc39.es/proposal-json-modules/#sec-createsyntheticmodule
|
||||
SyntheticModule::SyntheticModule(Vector<DeprecatedFlyString> export_names, SyntheticModule::EvaluationFunction evaluation_steps, Realm& realm, StringView filename)
|
||||
SyntheticModule::SyntheticModule(Vector<FlyString> export_names, SyntheticModule::EvaluationFunction evaluation_steps, Realm& realm, StringView filename)
|
||||
: Module(realm, filename)
|
||||
, m_export_names(move(export_names))
|
||||
, m_evaluation_steps(move(evaluation_steps))
|
||||
|
@ -27,14 +27,14 @@ SyntheticModule::SyntheticModule(Vector<DeprecatedFlyString> export_names, Synth
|
|||
}
|
||||
|
||||
// 1.2.3.1 GetExportedNames( exportStarSet ), https://tc39.es/proposal-json-modules/#sec-smr-getexportednames
|
||||
ThrowCompletionOr<Vector<DeprecatedFlyString>> SyntheticModule::get_exported_names(VM&, Vector<Module*>)
|
||||
ThrowCompletionOr<Vector<FlyString>> SyntheticModule::get_exported_names(VM&, Vector<Module*>)
|
||||
{
|
||||
// 1. Return module.[[ExportNames]].
|
||||
return m_export_names;
|
||||
}
|
||||
|
||||
// 1.2.3.2 ResolveExport( exportName, resolveSet ), https://tc39.es/proposal-json-modules/#sec-smr-resolveexport
|
||||
ThrowCompletionOr<ResolvedBinding> SyntheticModule::resolve_export(VM&, DeprecatedFlyString const& export_name, Vector<ResolvedBinding>)
|
||||
ThrowCompletionOr<ResolvedBinding> SyntheticModule::resolve_export(VM&, FlyString const& export_name, Vector<ResolvedBinding>)
|
||||
{
|
||||
// 1. If module.[[ExportNames]] does not contain exportName, return null.
|
||||
if (!m_export_names.contains_slow(export_name))
|
||||
|
@ -123,7 +123,7 @@ ThrowCompletionOr<Promise*> SyntheticModule::evaluate(VM& vm)
|
|||
}
|
||||
|
||||
// 1.2.2 SetSyntheticModuleExport ( module, exportName, exportValue ), https://tc39.es/proposal-json-modules/#sec-setsyntheticmoduleexport
|
||||
ThrowCompletionOr<void> SyntheticModule::set_synthetic_module_export(DeprecatedFlyString const& export_name, Value export_value)
|
||||
ThrowCompletionOr<void> SyntheticModule::set_synthetic_module_export(FlyString const& export_name, Value export_value)
|
||||
{
|
||||
auto& vm = this->realm().vm();
|
||||
|
||||
|
@ -139,11 +139,11 @@ GC::Ref<SyntheticModule> SyntheticModule::create_default_export_synthetic_module
|
|||
// 1. Let closure be the a Abstract Closure with parameters (module) that captures defaultExport and performs the following steps when called:
|
||||
auto closure = [default_export = make_root(default_export)](SyntheticModule& module) -> ThrowCompletionOr<void> {
|
||||
// a. Return ? module.SetSyntheticExport("default", defaultExport).
|
||||
return module.set_synthetic_module_export("default", default_export.value());
|
||||
return module.set_synthetic_module_export("default"_fly_string, default_export.value());
|
||||
};
|
||||
|
||||
// 2. Return CreateSyntheticModule("default", closure, realm)
|
||||
return realm.heap().allocate<SyntheticModule>(Vector<DeprecatedFlyString> { "default" }, move(closure), realm, filename);
|
||||
return realm.heap().allocate<SyntheticModule>(Vector<FlyString> { "default"_fly_string }, move(closure), realm, filename);
|
||||
}
|
||||
|
||||
// 1.4 ParseJSONModule ( source ), https://tc39.es/proposal-json-modules/#sec-parse-json-module
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue