Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    r9a705dc8 r8d7bef2  
    124124
    125125        virtual void print( std::ostream &os, __attribute__((unused)) int indent = 0 ) const override {
    126                 os << expr.get() << std::endl;
     126                os << expr << std::endl;
    127127        }
    128128        void printOneLine( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const {}
    129129
    130130        template<typename T>
    131         bool isExpressionType() const { return nullptr != dynamic_cast<T>(expr.get()); }
    132 
    133         Expression * build() const { return const_cast<ExpressionNode *>(this)->expr.release(); }
     131        bool isExpressionType() const { return nullptr != dynamic_cast<T>(expr); }
     132
     133        Expression * build() const { return expr; }
    134134  private:
    135135        bool extension = false;
    136         std::unique_ptr<Expression> expr;
     136        Expression* expr;
    137137}; // ExpressionNode
    138138
     
    179179
    180180Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node );
    181 Expression * build_keyword_cast( KeywordCastExpr::Target target, ExpressionNode * expr_node );
    182181Expression * build_virtual_cast( DeclarationNode * decl_node, ExpressionNode * expr_node );
    183182Expression * build_fieldSel( ExpressionNode * expr_node, Expression * member );
     
    247246        static DeclarationNode * newAttribute( std::string *, ExpressionNode * expr = nullptr ); // gcc attributes
    248247        static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement
    249         static DeclarationNode * newStaticAssert( ExpressionNode * condition, Expression * message );
    250248
    251249        DeclarationNode();
     
    315313        Attr_t attr;
    316314
    317         struct StaticAssert_t {
    318                 ExpressionNode * condition;
    319                 Expression * message;
    320         };
    321         StaticAssert_t assert;
    322 
    323315        BuiltinType builtin;
    324316
     
    360352
    361353        virtual StatementNode * clone() const final { assert( false ); return nullptr; }
    362         Statement * build() const { return const_cast<StatementNode *>(this)->stmt.release(); }
     354        Statement * build() const { return stmt; }
    363355
    364356        virtual StatementNode * add_label( const std::string * name, DeclarationNode * attr = nullptr ) {
     
    372364
    373365        virtual void print( std::ostream &os, __attribute__((unused)) int indent = 0 ) const override {
    374                 os << stmt.get() << std::endl;
     366                os << stmt << std::endl;
    375367        }
    376368  private:
    377         std::unique_ptr<Statement> stmt;
     369        Statement* stmt;
    378370}; // StatementNode
    379371
     
    400392
    401393Statement * build_if( IfCtl * ctl, StatementNode * then_stmt, StatementNode * else_stmt );
    402 Statement * build_switch( bool isSwitch, ExpressionNode * ctl, StatementNode * stmt );
     394Statement * build_switch( ExpressionNode * ctl, StatementNode * stmt );
    403395Statement * build_case( ExpressionNode * ctl );
    404396Statement * build_default();
Note: See TracChangeset for help on using the changeset viewer.