From b5a4d12fa328f69d4dfba9bf57ac289935877649 Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 25 Oct 2014 16:52:22 +0200 Subject: Compiler for assignments. --- AST.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'AST.h') diff --git a/AST.h b/AST.h index db6637ae..856c222e 100644 --- a/AST.h +++ b/AST.h @@ -402,13 +402,17 @@ private: class Expression: public Statement { public: - Expression(Location const& _location): Statement(_location) {} + Expression(Location const& _location): Statement(_location), m_isLvalue(false) {} std::shared_ptr const& getType() const { return m_type; } + bool isLvalue() const { return m_isLvalue; } protected: //! Inferred type of the expression, only filled after a call to checkTypeRequirements(). std::shared_ptr m_type; + //! Whether or not this expression is an lvalue, i.e. something that can be assigned to. + //! This is set during calls to @a checkTypeRequirements() + bool m_isLvalue; }; /// @} @@ -492,6 +496,9 @@ public: virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; + Expression& getExpression() const { return *m_expression; } + std::vector> const& getArguments() const { return m_arguments; } + /// Returns true if this is not an actual function call, but an explicit type conversion /// or constructor call. bool isTypeConversion() const; -- cgit