summaryrefslogtreecommitdiff
path: root/Libraries/LibJS
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-09-27 20:03:42 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-27 20:26:58 +0200
commit591b7b7031844a3807d9ee1338f979fba1e1a78b (patch)
tree4abca03c1ccbfdadc9bff6f6991f2ff79c9aa4d3 /Libraries/LibJS
parentadf0a537aff6da0519a140e69a5d26228aa65855 (diff)
downloadserenity-591b7b7031844a3807d9ee1338f979fba1e1a78b.zip
LibJS: Remove js_string(Interpreter&, ...)
Diffstat (limited to 'Libraries/LibJS')
-rw-r--r--Libraries/LibJS/AST.cpp6
-rw-r--r--Libraries/LibJS/Runtime/PrimitiveString.cpp8
-rw-r--r--Libraries/LibJS/Runtime/PrimitiveString.h1
-rw-r--r--Libraries/LibJS/Runtime/RegExpObject.cpp2
-rw-r--r--Libraries/LibJS/Runtime/StringPrototype.cpp2
5 files changed, 6 insertions, 13 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp
index 394ff8a9f7..5002901df4 100644
--- a/Libraries/LibJS/AST.cpp
+++ b/Libraries/LibJS/AST.cpp
@@ -1513,7 +1513,7 @@ Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_o
auto& str_to_spread = key.as_string().string();
for (size_t i = 0; i < str_to_spread.length(); i++) {
- object->define_property(i, js_string(interpreter, str_to_spread.substring(i, 1)));
+ object->define_property(i, js_string(interpreter.heap(), str_to_spread.substring(i, 1)));
if (interpreter.exception())
return {};
}
@@ -1613,7 +1613,7 @@ Value MemberExpression::execute(Interpreter& interpreter, GlobalObject& global_o
Value StringLiteral::execute(Interpreter& interpreter, GlobalObject&) const
{
- return js_string(interpreter, m_value);
+ return js_string(interpreter.heap(), m_value);
}
Value NumericLiteral::execute(Interpreter&, GlobalObject&) const
@@ -1706,7 +1706,7 @@ Value TemplateLiteral::execute(Interpreter& interpreter, GlobalObject& global_ob
string_builder.append(string);
}
- return js_string(interpreter, string_builder.build());
+ return js_string(interpreter.heap(), string_builder.build());
}
void TaggedTemplateLiteral::dump(int indent) const
diff --git a/Libraries/LibJS/Runtime/PrimitiveString.cpp b/Libraries/LibJS/Runtime/PrimitiveString.cpp
index e4cfa1aea6..2aeb74e914 100644
--- a/Libraries/LibJS/Runtime/PrimitiveString.cpp
+++ b/Libraries/LibJS/Runtime/PrimitiveString.cpp
@@ -24,9 +24,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibJS/Heap/Heap.h>
-#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/PrimitiveString.h>
+#include <LibJS/Runtime/VM.h>
namespace JS {
@@ -46,11 +45,6 @@ PrimitiveString* js_string(Heap& heap, String string)
return heap.allocate_without_global_object<PrimitiveString>(move(string));
}
-PrimitiveString* js_string(Interpreter& interpreter, String string)
-{
- return js_string(interpreter.heap(), move(string));
-}
-
PrimitiveString* js_string(VM& vm, String string)
{
return js_string(vm.heap(), move(string));
diff --git a/Libraries/LibJS/Runtime/PrimitiveString.h b/Libraries/LibJS/Runtime/PrimitiveString.h
index 0ed7e86a67..7b1a9d9e4d 100644
--- a/Libraries/LibJS/Runtime/PrimitiveString.h
+++ b/Libraries/LibJS/Runtime/PrimitiveString.h
@@ -45,7 +45,6 @@ private:
};
PrimitiveString* js_string(Heap&, String);
-PrimitiveString* js_string(Interpreter&, String);
PrimitiveString* js_string(VM&, String);
}
diff --git a/Libraries/LibJS/Runtime/RegExpObject.cpp b/Libraries/LibJS/Runtime/RegExpObject.cpp
index 34637e398b..b41d0a767d 100644
--- a/Libraries/LibJS/Runtime/RegExpObject.cpp
+++ b/Libraries/LibJS/Runtime/RegExpObject.cpp
@@ -52,7 +52,7 @@ RegExpObject::~RegExpObject()
Value RegExpObject::to_string() const
{
- return js_string(interpreter(), String::format("/%s/%s", content().characters(), flags().characters()));
+ return js_string(heap(), String::format("/%s/%s", content().characters(), flags().characters()));
}
}
diff --git a/Libraries/LibJS/Runtime/StringPrototype.cpp b/Libraries/LibJS/Runtime/StringPrototype.cpp
index 4b4e8c211f..e903d5df47 100644
--- a/Libraries/LibJS/Runtime/StringPrototype.cpp
+++ b/Libraries/LibJS/Runtime/StringPrototype.cpp
@@ -61,7 +61,7 @@ static String ak_string_from(VM& vm, GlobalObject& global_object)
}
StringPrototype::StringPrototype(GlobalObject& global_object)
- : StringObject(*js_string(interpreter(), String::empty()), *global_object.object_prototype())
+ : StringObject(*js_string(global_object.heap(), String::empty()), *global_object.object_prototype())
{
}