1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

LibJS: Replace standalone js_string() with PrimitiveString::create()

Note that js_rope_string() has been folded into this, the old name was
misleading - it would not always create a rope string, only if both
sides are not empty strings. Use a three-argument create() overload
instead.
This commit is contained in:
Linus Groh 2022-12-06 22:17:27 +00:00
parent 5db38d7ba1
commit 525f22d018
144 changed files with 656 additions and 672 deletions

View file

@ -1538,7 +1538,7 @@ Completion UnaryExpression::execute(Interpreter& interpreter) const
case UnaryOp::Minus:
return TRY(unary_minus(vm, lhs_result));
case UnaryOp::Typeof:
return Value { js_string(vm, lhs_result.typeof()) };
return Value { PrimitiveString::create(vm, lhs_result.typeof()) };
case UnaryOp::Void:
return js_undefined();
case UnaryOp::Delete:
@ -3465,9 +3465,10 @@ Completion ImportCall::execute(Interpreter& interpreter) const
Completion StringLiteral::execute(Interpreter& interpreter) const
{
InterpreterNodeScope node_scope { interpreter, *this };
auto& vm = interpreter.vm();
// 1. Return the SV of StringLiteral as defined in 12.8.4.2.
return Value { js_string(interpreter.heap(), m_value) };
return Value { PrimitiveString::create(vm, m_value) };
}
// 13.2.3.1 Runtime Semantics: Evaluation, https://tc39.es/ecma262/#sec-literals-runtime-semantics-evaluation
@ -3627,7 +3628,7 @@ Completion TemplateLiteral::execute(Interpreter& interpreter) const
}
// 7. Return the string-concatenation of head, middle, and tail.
return Value { js_string(interpreter.heap(), string_builder.build()) };
return Value { PrimitiveString::create(vm, string_builder.build()) };
}
void TaggedTemplateLiteral::dump(int indent) const