Changeset 8d7bef2 for src/Parser


Ignore:
Timestamp:
Mar 20, 2018, 5:12:25 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
7e4b44db
Parents:
68f9c43
Message:

First compiling build of CFA-CC with GC

Location:
src/Parser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    r68f9c43 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
     
    352352
    353353        virtual StatementNode * clone() const final { assert( false ); return nullptr; }
    354         Statement * build() const { return const_cast<StatementNode *>(this)->stmt.release(); }
     354        Statement * build() const { return stmt; }
    355355
    356356        virtual StatementNode * add_label( const std::string * name, DeclarationNode * attr = nullptr ) {
     
    364364
    365365        virtual void print( std::ostream &os, __attribute__((unused)) int indent = 0 ) const override {
    366                 os << stmt.get() << std::endl;
     366                os << stmt << std::endl;
    367367        }
    368368  private:
    369         std::unique_ptr<Statement> stmt;
     369        Statement* stmt;
    370370}; // StatementNode
    371371
  • src/Parser/StatementNode.cc

    r68f9c43 r8d7bef2  
    1616#include <cassert>                 // for assert, strict_dynamic_cast, assertf
    1717#include <list>                    // for list
    18 #include <memory>                  // for unique_ptr
    1918#include <string>                  // for string
    2019
     
    5049                agg = decl;
    5150        } // if
    52         stmt.reset( new DeclStmt( maybeMoveBuild< Declaration >(agg) ) );
     51        stmt = new DeclStmt{ maybeMoveBuild< Declaration >(agg) };
    5352} // StatementNode::StatementNode
    5453
     
    5857        for ( StatementNode * curr = prev; curr != nullptr; curr = (StatementNode *)curr->get_next() ) {
    5958                StatementNode *node = strict_dynamic_cast< StatementNode * >(curr);
    60                 assert( dynamic_cast< CaseStmt * >(node->stmt.get()) );
     59                assert( dynamic_cast< CaseStmt * >(node->stmt) );
    6160                prev = curr;
    6261        } // for
     
    6665        buildMoveList( stmt, stmts );
    6766        // splice any new Statements to end of current Statements
    68         CaseStmt * caseStmt = dynamic_cast< CaseStmt * >(node->stmt.get());
     67        CaseStmt * caseStmt = dynamic_cast< CaseStmt * >(node->stmt);
    6968        caseStmt->get_statements().splice( caseStmt->get_statements().end(), stmts );
    7069        return this;
Note: See TracChangeset for help on using the changeset viewer.