Changeset a2dbad10


Ignore:
Timestamp:
Sep 21, 2017, 11:29:53 AM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
aaa4f93
Parents:
6ae8c92
Message:

Added compound statement constructor which takes in a statment list.
Added constant constructor for chars

Location:
src/SynTree
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/CompoundStmt.cc

    r6ae8c92 ra2dbad10  
    2929
    3030CompoundStmt::CompoundStmt( std::list<Label> labels ) : Statement( labels ) {
     31}
     32
     33CompoundStmt::CompoundStmt( std::list<Statement *> stmts ) : Statement( noLabels ), kids( stmts ) {
    3134}
    3235
  • src/SynTree/Constant.cc

    r6ae8c92 ra2dbad10  
    3232Constant Constant::from_bool( bool b ) {
    3333        return Constant( new BasicType( Type::Qualifiers(), BasicType::Bool ), b ? "1" : "0" , (unsigned long long int)b );
     34}
     35
     36Constant Constant::from_char( char c ) {
     37        return Constant( new BasicType( Type::Qualifiers(), BasicType::Char ), std::to_string( c ), (unsigned long long int)c );
    3438}
    3539
  • src/SynTree/Constant.h

    r6ae8c92 ra2dbad10  
    4040        /// generates a boolean constant of the given bool
    4141        static Constant from_bool( bool b );
     42        /// generates a char constant of the given char
     43        static Constant from_char( char c );
    4244        /// generates an integer constant of the given int
    4345        static Constant from_int( int i );
  • src/SynTree/Statement.h

    r6ae8c92 ra2dbad10  
    5454
    5555        CompoundStmt( std::list<Label> labels );
     56        CompoundStmt( std::list<Statement *> stmts );
    5657        CompoundStmt( const CompoundStmt &other );
    5758        virtual ~CompoundStmt();
Note: See TracChangeset for help on using the changeset viewer.