Changeset 2c37f34 for src/SynTree


Ignore:
Timestamp:
Jun 22, 2017, 10:26:03 AM (7 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
f1a10a7
Parents:
e9a3b20b
Message:

Getting in my addition to Constant, from_bool constructor.

Location:
src/SynTree
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Constant.cc

    re9a3b20b r2c37f34  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 21 16:44:48 2017
    13 // Update Count     : 27
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Jun 22 10:11:00 2017
     13// Update Count     : 28
    1414//
    1515
     
    2929
    3030Constant::~Constant() { delete type; }
     31
     32Constant Constant::from_bool( bool b ) {
     33        return Constant( new BasicType( Type::Qualifiers(), BasicType::Bool ), b ? "1" : "0" , (unsigned long long int)b );
     34}
    3135
    3236Constant Constant::from_int( int i ) {
  • src/SynTree/Constant.h

    re9a3b20b r2c37f34  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 21 16:44:48 2017
    13 // Update Count     : 14
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Jun 22 10:13:00 2017
     13// Update Count     : 15
    1414//
    1515
     
    3333        void set_value( std::string newValue ) { rep = newValue; }
    3434
     35        /// generates a boolean constant of the given bool
     36        static Constant from_bool( bool b );
    3537        /// generates an integer constant of the given int
    3638        static Constant from_int( int i );
Note: See TracChangeset for help on using the changeset viewer.