summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibJS/AST.cpp2
-rw-r--r--Libraries/LibJS/Interpreter.cpp4
-rw-r--r--Libraries/LibJS/Interpreter.h6
-rw-r--r--Libraries/LibJS/Runtime/ScriptFunction.cpp2
4 files changed, 8 insertions, 6 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp
index e52f7f00ad..cbab937bec 100644
--- a/Libraries/LibJS/AST.cpp
+++ b/Libraries/LibJS/AST.cpp
@@ -959,7 +959,7 @@ Value TryStatement::execute(Interpreter& interpreter) const
if (auto* exception = interpreter.exception()) {
if (m_handler) {
interpreter.clear_exception();
- Vector<Argument> arguments { { m_handler->parameter(), exception->value() } };
+ ArgumentVector arguments { { m_handler->parameter(), exception->value() } };
interpreter.run(m_handler->body(), move(arguments));
}
}
diff --git a/Libraries/LibJS/Interpreter.cpp b/Libraries/LibJS/Interpreter.cpp
index a4fe244427..e7fb481abb 100644
--- a/Libraries/LibJS/Interpreter.cpp
+++ b/Libraries/LibJS/Interpreter.cpp
@@ -61,7 +61,7 @@ Interpreter::~Interpreter()
{
}
-Value Interpreter::run(const Statement& statement, Vector<Argument> arguments, ScopeType scope_type)
+Value Interpreter::run(const Statement& statement, ArgumentVector arguments, ScopeType scope_type)
{
if (!statement.is_scope_node())
return statement.execute(*this);
@@ -86,7 +86,7 @@ Value Interpreter::run(const Statement& statement, Vector<Argument> arguments, S
return did_return ? m_last_value : js_undefined();
}
-void Interpreter::enter_scope(const ScopeNode& scope_node, Vector<Argument> arguments, ScopeType scope_type)
+void Interpreter::enter_scope(const ScopeNode& scope_node, ArgumentVector arguments, ScopeType scope_type)
{
HashMap<FlyString, Variable> scope_variables_with_declaration_type;
for (auto& argument : arguments) {
diff --git a/Libraries/LibJS/Interpreter.h b/Libraries/LibJS/Interpreter.h
index d37fb1e396..e0b28391e9 100644
--- a/Libraries/LibJS/Interpreter.h
+++ b/Libraries/LibJS/Interpreter.h
@@ -67,6 +67,8 @@ struct Argument {
Value value;
};
+typedef Vector<Argument, 8> ArgumentVector;
+
class Interpreter {
public:
template<typename GlobalObjectType, typename... Args>
@@ -79,7 +81,7 @@ public:
~Interpreter();
- Value run(const Statement&, Vector<Argument> = {}, ScopeType = ScopeType::Block);
+ Value run(const Statement&, ArgumentVector = {}, ScopeType = ScopeType::Block);
Object& global_object() { return *m_global_object; }
const Object& global_object() const { return *m_global_object; }
@@ -97,7 +99,7 @@ public:
void gather_roots(Badge<Heap>, HashTable<Cell*>&);
- void enter_scope(const ScopeNode&, Vector<Argument>, ScopeType);
+ void enter_scope(const ScopeNode&, ArgumentVector, ScopeType);
void exit_scope(const ScopeNode&);
Value call(Function*, Value this_value = {}, const Vector<Value>& arguments = {});
diff --git a/Libraries/LibJS/Runtime/ScriptFunction.cpp b/Libraries/LibJS/Runtime/ScriptFunction.cpp
index 524358ca33..8a30d7898b 100644
--- a/Libraries/LibJS/Runtime/ScriptFunction.cpp
+++ b/Libraries/LibJS/Runtime/ScriptFunction.cpp
@@ -48,7 +48,7 @@ ScriptFunction::~ScriptFunction()
Value ScriptFunction::call(Interpreter& interpreter)
{
auto& argument_values = interpreter.call_frame().arguments;
- Vector<Argument> arguments;
+ ArgumentVector arguments;
for (size_t i = 0; i < m_parameters.size(); ++i) {
auto name = parameters()[i];
auto value = js_undefined();