Changes in src/Parser/ParseNode.h [8d7bef2:9a705dc8]
- File:
-
- 1 edited
-
src/Parser/ParseNode.h (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ParseNode.h
r8d7bef2 r9a705dc8 124 124 125 125 virtual void print( std::ostream &os, __attribute__((unused)) int indent = 0 ) const override { 126 os << expr << std::endl;126 os << expr.get() << std::endl; 127 127 } 128 128 void printOneLine( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const {} 129 129 130 130 template<typename T> 131 bool isExpressionType() const { return nullptr != dynamic_cast<T>(expr ); }132 133 Expression * build() const { return expr; }131 bool isExpressionType() const { return nullptr != dynamic_cast<T>(expr.get()); } 132 133 Expression * build() const { return const_cast<ExpressionNode *>(this)->expr.release(); } 134 134 private: 135 135 bool extension = false; 136 Expression*expr;136 std::unique_ptr<Expression> expr; 137 137 }; // ExpressionNode 138 138 … … 179 179 180 180 Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node ); 181 Expression * build_keyword_cast( KeywordCastExpr::Target target, ExpressionNode * expr_node ); 181 182 Expression * build_virtual_cast( DeclarationNode * decl_node, ExpressionNode * expr_node ); 182 183 Expression * build_fieldSel( ExpressionNode * expr_node, Expression * member ); … … 246 247 static DeclarationNode * newAttribute( std::string *, ExpressionNode * expr = nullptr ); // gcc attributes 247 248 static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement 249 static DeclarationNode * newStaticAssert( ExpressionNode * condition, Expression * message ); 248 250 249 251 DeclarationNode(); … … 313 315 Attr_t attr; 314 316 317 struct StaticAssert_t { 318 ExpressionNode * condition; 319 Expression * message; 320 }; 321 StaticAssert_t assert; 322 315 323 BuiltinType builtin; 316 324 … … 352 360 353 361 virtual StatementNode * clone() const final { assert( false ); return nullptr; } 354 Statement * build() const { return stmt; }362 Statement * build() const { return const_cast<StatementNode *>(this)->stmt.release(); } 355 363 356 364 virtual StatementNode * add_label( const std::string * name, DeclarationNode * attr = nullptr ) { … … 364 372 365 373 virtual void print( std::ostream &os, __attribute__((unused)) int indent = 0 ) const override { 366 os << stmt << std::endl;374 os << stmt.get() << std::endl; 367 375 } 368 376 private: 369 Statement*stmt;377 std::unique_ptr<Statement> stmt; 370 378 }; // StatementNode 371 379 … … 392 400 393 401 Statement * build_if( IfCtl * ctl, StatementNode * then_stmt, StatementNode * else_stmt ); 394 Statement * build_switch( ExpressionNode * ctl, StatementNode * stmt );402 Statement * build_switch( bool isSwitch, ExpressionNode * ctl, StatementNode * stmt ); 395 403 Statement * build_case( ExpressionNode * ctl ); 396 404 Statement * build_default();
Note:
See TracChangeset
for help on using the changeset viewer.