Skip to content

Commit f9d4851

Browse files
DanShadersgmta
authored andcommitted
LibCpp: Add some missing accessors to AST nodes
1 parent 14a86c8 commit f9d4851

File tree

1 file changed

+6
-1
lines changed
  • Userland/Libraries/LibCpp

1 file changed

+6
-1
lines changed

Userland/Libraries/LibCpp/AST.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ class FunctionDefinition : public ASTNode {
343343
}
344344

345345
virtual Vector<NonnullRefPtr<Declaration const>> declarations() const override;
346-
Vector<NonnullRefPtr<Statement const>> const& statements() { return m_statements; }
346+
Vector<NonnullRefPtr<Statement const>> const& statements() const { return m_statements; }
347347
void add_statement(NonnullRefPtr<Statement const>&& statement) { m_statements.append(move(statement)); }
348348

349349
private:
@@ -504,6 +504,8 @@ class NumericLiteral : public Expression {
504504
{
505505
}
506506

507+
StringView value() const { return m_value; }
508+
507509
private:
508510
StringView m_value;
509511
};
@@ -825,6 +827,8 @@ class BlockStatement final : public Statement {
825827

826828
void add_statement(NonnullRefPtr<Statement const>&& statement) { m_statements.append(move(statement)); }
827829

830+
Vector<NonnullRefPtr<Statement const>> const& statements() const { return m_statements; }
831+
828832
private:
829833
Vector<NonnullRefPtr<Statement const>> m_statements;
830834
};
@@ -856,6 +860,7 @@ class IfStatement : public Statement {
856860
void set_then_statement(RefPtr<Statement const>&& then) { m_then = move(then); }
857861
void set_else_statement(RefPtr<Statement const>&& _else) { m_else = move(_else); }
858862

863+
Expression const* predicate() const { return m_predicate.ptr(); }
859864
Statement const* then_statement() const { return m_then.ptr(); }
860865
Statement const* else_statement() const { return m_else.ptr(); }
861866

0 commit comments

Comments
 (0)