diff options
author | Linus Groh <mail@linusgroh.de> | 2020-10-04 15:18:52 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-10-04 19:22:02 +0200 |
commit | 123f98201e2447b6628487a5a753d4bcd840d554 (patch) | |
tree | 7677a87d16a06f41becb0e46f21a647602d2bbe9 /Libraries/LibJS/AST.cpp | |
parent | 2e2571743b4612cbec6fd7037375abe3f43af380 (diff) | |
download | serenity-123f98201e2447b6628487a5a753d4bcd840d554.zip |
LibJS: Use String::formatted() in various other places
Diffstat (limited to 'Libraries/LibJS/AST.cpp')
-rw-r--r-- | Libraries/LibJS/AST.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index 6a0e1ed026..7ea7dedb55 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -78,7 +78,7 @@ static void update_function_name(Value& value, const FlyString& name) static String get_function_name(GlobalObject& global_object, Value value) { if (value.is_symbol()) - return String::format("[%s]", value.as_symbol().description().characters()); + return String::formatted("[{}]", value.as_symbol().description()); if (value.is_string()) return value.as_string().string(); return value.to_string(global_object); @@ -743,9 +743,9 @@ Value ClassExpression::execute(Interpreter& interpreter, GlobalObject& global_ob String accessor_name = [&] { switch (method.kind()) { case ClassMethod::Kind::Getter: - return String::format("get %s", get_function_name(global_object, key).characters()); + return String::formatted("get {}", get_function_name(global_object, key)); case ClassMethod::Kind::Setter: - return String::format("set %s", get_function_name(global_object, key).characters()); + return String::formatted("set {}", get_function_name(global_object, key)); default: ASSERT_NOT_REACHED(); } @@ -1538,9 +1538,9 @@ Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_o String name = get_function_name(global_object, key); if (property.type() == ObjectProperty::Type::Getter) { - name = String::format("get %s", name.characters()); + name = String::formatted("get {}", name); } else if (property.type() == ObjectProperty::Type::Setter) { - name = String::format("set %s", name.characters()); + name = String::formatted("set {}", name); } update_function_name(value, name); @@ -1597,9 +1597,9 @@ String MemberExpression::to_string_approximation() const if (m_object->is_identifier()) object_string = static_cast<const Identifier&>(*m_object).string(); if (is_computed()) - return String::format("%s[<computed>]", object_string.characters()); + return String::formatted("{}[<computed>]", object_string); ASSERT(m_property->is_identifier()); - return String::format("%s.%s", object_string.characters(), static_cast<const Identifier&>(*m_property).string().characters()); + return String::formatted("{}.{}", object_string, static_cast<const Identifier&>(*m_property).string()); } Value MemberExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const |