mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +00:00
LibJS: Rename WhileStatement::predicate() => body()
This name matches other parsers.
This commit is contained in:
parent
644ff1bbfd
commit
da0715aba9
2 changed files with 6 additions and 6 deletions
|
@ -166,7 +166,7 @@ Value IfStatement::execute(Interpreter& interpreter) const
|
||||||
Value WhileStatement::execute(Interpreter& interpreter) const
|
Value WhileStatement::execute(Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
Value last_value = js_undefined();
|
Value last_value = js_undefined();
|
||||||
while (m_predicate->execute(interpreter).to_boolean()) {
|
while (m_test->execute(interpreter).to_boolean()) {
|
||||||
if (interpreter.exception())
|
if (interpreter.exception())
|
||||||
return {};
|
return {};
|
||||||
last_value = interpreter.run(*m_body);
|
last_value = interpreter.run(*m_body);
|
||||||
|
@ -564,7 +564,7 @@ void WhileStatement::dump(int indent) const
|
||||||
|
|
||||||
print_indent(indent);
|
print_indent(indent);
|
||||||
printf("While\n");
|
printf("While\n");
|
||||||
predicate().dump(indent + 1);
|
test().dump(indent + 1);
|
||||||
body().dump(indent + 1);
|
body().dump(indent + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -238,13 +238,13 @@ private:
|
||||||
|
|
||||||
class WhileStatement : public Statement {
|
class WhileStatement : public Statement {
|
||||||
public:
|
public:
|
||||||
WhileStatement(NonnullRefPtr<Expression> predicate, NonnullRefPtr<ScopeNode> body)
|
WhileStatement(NonnullRefPtr<Expression> test, NonnullRefPtr<ScopeNode> body)
|
||||||
: m_predicate(move(predicate))
|
: m_test(move(test))
|
||||||
, m_body(move(body))
|
, 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; }
|
const ScopeNode& body() const { return *m_body; }
|
||||||
|
|
||||||
virtual Value execute(Interpreter&) const override;
|
virtual Value execute(Interpreter&) const override;
|
||||||
|
@ -253,7 +253,7 @@ public:
|
||||||
private:
|
private:
|
||||||
virtual const char* class_name() const override { return "WhileStatement"; }
|
virtual const char* class_name() const override { return "WhileStatement"; }
|
||||||
|
|
||||||
NonnullRefPtr<Expression> m_predicate;
|
NonnullRefPtr<Expression> m_test;
|
||||||
NonnullRefPtr<ScopeNode> m_body;
|
NonnullRefPtr<ScopeNode> m_body;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue