From da0715aba96b85a6df23854960ebb3382fa0cf1f Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 4 Apr 2020 21:21:19 +0200 Subject: [PATCH] LibJS: Rename WhileStatement::predicate() => body() This name matches other parsers. --- Libraries/LibJS/AST.cpp | 4 ++-- Libraries/LibJS/AST.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index ce9bc94267..1b4cd0d76b 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -166,7 +166,7 @@ Value IfStatement::execute(Interpreter& interpreter) const Value WhileStatement::execute(Interpreter& interpreter) const { Value last_value = js_undefined(); - while (m_predicate->execute(interpreter).to_boolean()) { + while (m_test->execute(interpreter).to_boolean()) { if (interpreter.exception()) return {}; last_value = interpreter.run(*m_body); @@ -564,7 +564,7 @@ void WhileStatement::dump(int indent) const print_indent(indent); printf("While\n"); - predicate().dump(indent + 1); + test().dump(indent + 1); body().dump(indent + 1); } diff --git a/Libraries/LibJS/AST.h b/Libraries/LibJS/AST.h index 2d412196e1..2b7e3aeb1d 100644 --- a/Libraries/LibJS/AST.h +++ b/Libraries/LibJS/AST.h @@ -238,13 +238,13 @@ private: class WhileStatement : public Statement { public: - WhileStatement(NonnullRefPtr predicate, NonnullRefPtr body) - : m_predicate(move(predicate)) + WhileStatement(NonnullRefPtr test, NonnullRefPtr body) + : m_test(move(test)) , m_body(move(body)) { } - const Expression& predicate() const { return *m_predicate; } + const Expression& test() const { return *m_test; } const ScopeNode& body() const { return *m_body; } virtual Value execute(Interpreter&) const override; @@ -253,7 +253,7 @@ public: private: virtual const char* class_name() const override { return "WhileStatement"; } - NonnullRefPtr m_predicate; + NonnullRefPtr m_test; NonnullRefPtr m_body; };