@@ -821,7 +821,7 @@ void Interpreter::enter_object_environment(Object& object)
821
821
running_execution_context ().lexical_environment = new_object_environment (object, true , old_environment);
822
822
}
823
823
824
- ThrowCompletionOr<GC::Ref<Bytecode::Executable>> compile (VM& vm, ASTNode const & node, FunctionKind kind, FlyString const & name)
824
+ ThrowCompletionOr<GC::Ref<Bytecode::Executable>> compile (VM& vm, ASTNode const & node, FunctionKind kind, Utf16FlyString const & name)
825
825
{
826
826
auto executable_result = Bytecode::Generator::generate_from_ast_node (vm, node, kind);
827
827
if (executable_result.is_error ())
@@ -1201,7 +1201,7 @@ inline ThrowCompletionOr<Value> get_global(Interpreter& interpreter, IdentifierT
1201
1201
return vm.throw_completion <ReferenceError>(ErrorType::UnknownIdentifier, identifier);
1202
1202
}
1203
1203
1204
- inline ThrowCompletionOr<void > put_by_property_key (VM& vm, Value base, Value this_value, Value value, Optional<FlyString const &> const & base_identifier, PropertyKey name, Op::PropertyKind kind, PropertyLookupCache* caches = nullptr )
1204
+ inline ThrowCompletionOr<void > put_by_property_key (VM& vm, Value base, Value this_value, Value value, Optional<Utf16FlyString const &> const & base_identifier, PropertyKey name, Op::PropertyKind kind, PropertyLookupCache* caches = nullptr )
1205
1205
{
1206
1206
// Better error message than to_object would give
1207
1207
if (vm.in_strict_mode () && base.is_nullish ())
@@ -1221,14 +1221,14 @@ inline ThrowCompletionOr<void> put_by_property_key(VM& vm, Value base, Value thi
1221
1221
case Op::PropertyKind::Getter: {
1222
1222
auto & function = value.as_function ();
1223
1223
if (is<ECMAScriptFunctionObject>(function) && static_cast <ECMAScriptFunctionObject const &>(function).name ().is_empty ())
1224
- static_cast <ECMAScriptFunctionObject*>(&function)->set_name (MUST ( String ::formatted (" get {}" , name) ));
1224
+ static_cast <ECMAScriptFunctionObject*>(&function)->set_name (Utf16String ::formatted (" get {}" , name));
1225
1225
object->define_direct_accessor (name, &function, nullptr , Attribute::Configurable | Attribute::Enumerable);
1226
1226
break ;
1227
1227
}
1228
1228
case Op::PropertyKind::Setter: {
1229
1229
auto & function = value.as_function ();
1230
1230
if (is<ECMAScriptFunctionObject>(function) && static_cast <ECMAScriptFunctionObject const &>(function).name ().is_empty ())
1231
- static_cast <ECMAScriptFunctionObject*>(&function)->set_name (MUST ( String ::formatted (" set {}" , name) ));
1231
+ static_cast <ECMAScriptFunctionObject*>(&function)->set_name (Utf16String ::formatted (" set {}" , name));
1232
1232
object->define_direct_accessor (name, nullptr , &function, Attribute::Configurable | Attribute::Enumerable);
1233
1233
break ;
1234
1234
}
@@ -1354,14 +1354,14 @@ inline Value new_function(VM& vm, FunctionNode const& function_node, Optional<Id
1354
1354
Value value;
1355
1355
1356
1356
if (!function_node.has_name ()) {
1357
- FlyString name;
1357
+ Utf16FlyString name;
1358
1358
if (lhs_name.has_value ())
1359
1359
name = vm.bytecode_interpreter ().current_executable ().get_identifier (lhs_name.value ());
1360
1360
value = function_node.instantiate_ordinary_function_expression (vm, name);
1361
1361
} else {
1362
1362
value = ECMAScriptFunctionObject::create_from_function_node (
1363
1363
function_node,
1364
- function_node.name (),
1364
+ Utf16FlyString::from_utf8 ( function_node.name () ),
1365
1365
*vm.current_realm (),
1366
1366
vm.lexical_environment (),
1367
1367
vm.running_execution_context ().private_environment );
@@ -1375,7 +1375,7 @@ inline Value new_function(VM& vm, FunctionNode const& function_node, Optional<Id
1375
1375
return value;
1376
1376
}
1377
1377
1378
- inline ThrowCompletionOr<void > put_by_value (VM& vm, Value base, Optional<FlyString const &> const & base_identifier, Value property_key_value, Value value, Op::PropertyKind kind)
1378
+ inline ThrowCompletionOr<void > put_by_value (VM& vm, Value base, Optional<Utf16FlyString const &> const & base_identifier, Value property_key_value, Value value, Op::PropertyKind kind)
1379
1379
{
1380
1380
// OPTIMIZATION: Fast path for simple Int32 indexes in array-like objects.
1381
1381
if ((kind == Op::PropertyKind::KeyValue || kind == Op::PropertyKind::DirectKeyValue)
@@ -1496,7 +1496,7 @@ struct CalleeAndThis {
1496
1496
Value this_value;
1497
1497
};
1498
1498
1499
- inline ThrowCompletionOr<CalleeAndThis> get_callee_and_this_from_environment (Bytecode::Interpreter& interpreter, FlyString const & name, EnvironmentCoordinate& cache)
1499
+ inline ThrowCompletionOr<CalleeAndThis> get_callee_and_this_from_environment (Bytecode::Interpreter& interpreter, Utf16FlyString const & name, EnvironmentCoordinate& cache)
1500
1500
{
1501
1501
auto & vm = interpreter.vm ();
1502
1502
@@ -1583,7 +1583,7 @@ inline Span<Value> argument_list_evaluation(Interpreter& interpreter, Value argu
1583
1583
return argument_values;
1584
1584
}
1585
1585
1586
- inline ThrowCompletionOr<void > create_variable (VM& vm, FlyString const & name, Op::EnvironmentMode mode, bool is_global, bool is_immutable, bool is_strict)
1586
+ inline ThrowCompletionOr<void > create_variable (VM& vm, Utf16FlyString const & name, Op::EnvironmentMode mode, bool is_global, bool is_immutable, bool is_strict)
1587
1587
{
1588
1588
if (mode == Op::EnvironmentMode::Lexical) {
1589
1589
VERIFY (!is_global);
@@ -1612,17 +1612,17 @@ inline ThrowCompletionOr<void> create_variable(VM& vm, FlyString const& name, Op
1612
1612
inline ThrowCompletionOr<ECMAScriptFunctionObject*> new_class (VM& vm, Value super_class, ClassExpression const & class_expression, Optional<IdentifierTableIndex> const & lhs_name, ReadonlySpan<Value> element_keys)
1613
1613
{
1614
1614
auto & interpreter = vm.bytecode_interpreter ();
1615
- auto name = class_expression.name ();
1616
1615
1617
1616
// NOTE: NewClass expects classEnv to be active lexical environment
1618
1617
auto * class_environment = vm.lexical_environment ();
1619
1618
vm.running_execution_context ().lexical_environment = vm.running_execution_context ().saved_lexical_environments .take_last ();
1620
1619
1621
- Optional<FlyString > binding_name;
1622
- FlyString class_name;
1620
+ Optional<Utf16FlyString > binding_name;
1621
+ Utf16FlyString class_name;
1623
1622
if (!class_expression.has_name () && lhs_name.has_value ()) {
1624
1623
class_name = interpreter.current_executable ().get_identifier (lhs_name.value ());
1625
1624
} else {
1625
+ auto name = Utf16FlyString::from_utf8 (class_expression.name ());
1626
1626
binding_name = name;
1627
1627
class_name = name;
1628
1628
}
0 commit comments