Ignore:
Timestamp:
Jun 16, 2016, 12:24:39 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
25296a3
Parents:
f4bc57c
Message:

change Label from a string typedef to a class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/StatementNode.cc

    rf4bc57c r0f8e4ac  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // StatementNode.cc -- 
     7// StatementNode.cc --
    88//
    99// Author           : Rodolfo G. Esteves
     
    2727
    2828const char *StatementNode::StType[] = {
    29         "Exp",   "If",       "Switch", "Case",    "Default",  "Choose",   "Fallthru", 
    30         "While", "Do",       "For", 
     29        "Exp",   "If",       "Switch", "Case",    "Default",  "Choose",   "Fallthru",
     30        "While", "Do",       "For",
    3131        "Goto",  "Continue", "Break",  "Return",  "Throw",
    3232        "Try",   "Catch",    "Finally", "Asm",
     
    6262StatementNode::StatementNode( Type t, ExpressionNode *ctrl_label, StatementNode *block ) : type( t ), control( ctrl_label ), block( block ), labels( 0 ), target( 0 ), decl( 0 ), isCatchRest ( false ) {
    6363        this->control = ( t == Default ) ? 0 : control;
    64 } 
     64}
    6565
    6666StatementNode::StatementNode( Type t, string *target ) : type( t ), control( 0 ), block( 0 ), labels( 0 ), target( target ), decl( 0 ), isCatchRest ( false ) {}
     
    7474
    7575StatementNode * StatementNode::newCatchStmt( DeclarationNode *d, StatementNode *s, bool catchRestP ) {
    76         StatementNode *ret = new StatementNode( StatementNode::Catch, 0, s ); 
     76        StatementNode *ret = new StatementNode( StatementNode::Catch, 0, s );
    7777        ret->addDeclaration( d );
    7878        ret->setCatchRest( catchRestP );
     
    101101StatementNode *StatementNode::add_label( const std::string *l ) {
    102102        if ( l != 0 ) {
    103                 labels.push_front( *l ); 
     103                labels.push_front( *l );
    104104                delete l;
    105105        } // if
     
    156156                        control->print( os, indent );
    157157                        os << endl;
    158                 } else 
     158                } else
    159159                        os << string( indent, ' ' ) << "Null Statement" << endl;
    160160                break;
     
    177177                if ( block ) {
    178178                        os << string( indent + ParseNode::indent_by, ' ' ) << "Branches of execution: " << endl;
    179                         block->printList( os, indent + 2 * ParseNode::indent_by ); 
     179                        block->printList( os, indent + 2 * ParseNode::indent_by );
    180180                } // if
    181181                if ( target ) {
     
    258258          case Fallthru:
    259259                return new FallthruStmt( labs );
    260           case Case: 
     260          case Case:
    261261                return new CaseStmt( labs, maybeBuild<Expression>(get_control()), branches );
    262262          case Default:
     
    394394                os << string( indent + ParseNode::indent_by, ' ' ) << "Goto Labels:" << endl;
    395395                os << string( indent + 2 * ParseNode::indent_by, ' ' );
    396                 for ( std::list<std::string>::const_iterator i = gotolabels.begin();; ) {
     396                for ( std::list<Label>::const_iterator i = gotolabels.begin();; ) {
    397397                        os << *i;
    398398                        i++;
     
    426426}
    427427
    428 Statement *NullStmtNode::build() const { 
     428Statement *NullStmtNode::build() const {
    429429        return new NullStmt;
    430430}
Note: See TracChangeset for help on using the changeset viewer.