summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibJS/AST.cpp1
-rw-r--r--Libraries/LibJS/Interpreter.cpp21
-rw-r--r--Libraries/LibJS/Interpreter.h1
3 files changed, 0 insertions, 23 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp
index 67fab0a34c..0b1ff217c9 100644
--- a/Libraries/LibJS/AST.cpp
+++ b/Libraries/LibJS/AST.cpp
@@ -828,7 +828,6 @@ void UpdateExpression::dump(int indent) const
Value VariableDeclaration::execute(Interpreter& interpreter) const
{
for (auto& declarator : m_declarations) {
- interpreter.declare_variable(declarator.id().string(), m_declaration_kind);
if (auto* init = declarator.init()) {
auto initalizer_result = init->execute(interpreter);
if (interpreter.exception())
diff --git a/Libraries/LibJS/Interpreter.cpp b/Libraries/LibJS/Interpreter.cpp
index 5bd6404252..d79b57f2db 100644
--- a/Libraries/LibJS/Interpreter.cpp
+++ b/Libraries/LibJS/Interpreter.cpp
@@ -122,27 +122,6 @@ void Interpreter::exit_scope(const ScopeNode& scope_node)
m_unwind_until = ScopeType::None;
}
-void Interpreter::declare_variable(const FlyString& name, DeclarationKind declaration_kind)
-{
- switch (declaration_kind) {
- case DeclarationKind::Var:
- for (ssize_t i = m_scope_stack.size() - 1; i >= 0; --i) {
- auto& scope = m_scope_stack.at(i);
- if (scope.type == ScopeType::Function) {
- scope.variables.set(move(name), { js_undefined(), declaration_kind });
- return;
- }
- }
-
- global_object().put(move(name), js_undefined());
- break;
- case DeclarationKind::Let:
- case DeclarationKind::Const:
- m_scope_stack.last().variables.set(move(name), { js_undefined(), declaration_kind });
- break;
- }
-}
-
void Interpreter::set_variable(const FlyString& name, Value value, bool first_assignment)
{
for (ssize_t i = m_scope_stack.size() - 1; i >= 0; --i) {
diff --git a/Libraries/LibJS/Interpreter.h b/Libraries/LibJS/Interpreter.h
index c5427fe135..b25df3352a 100644
--- a/Libraries/LibJS/Interpreter.h
+++ b/Libraries/LibJS/Interpreter.h
@@ -96,7 +96,6 @@ public:
Optional<Value> get_variable(const FlyString& name);
void set_variable(const FlyString& name, Value, bool first_assignment = false);
- void declare_variable(const FlyString& name, DeclarationKind);
void gather_roots(Badge<Heap>, HashTable<Cell*>&);