Changeset f855545


Ignore:
Timestamp:
Nov 2, 2018, 7:46:19 AM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer
Children:
c45b304
Parents:
30ee9ef
Message:

more basetypeof changes

Location:
src/Parser
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r30ee9ef rf855545  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 20 14:56:54 2018
    13 // Update Count     : 1107
     12// Last Modified On : Thu Nov  1 20:54:26 2018
     13// Update Count     : 1108
    1414//
    1515
     
    402402}
    403403
    404 DeclarationNode * DeclarationNode::newTypeof( ExpressionNode * expr ) {
    405         DeclarationNode * newnode = new DeclarationNode;
    406         newnode->type = new TypeData( TypeData::Typeof );
     404DeclarationNode * DeclarationNode::newTypeof( ExpressionNode * expr, bool basetypeof ) {
     405        DeclarationNode * newnode = new DeclarationNode;
     406        newnode->type = new TypeData( basetypeof ? TypeData::Basetypeof : TypeData::Typeof );
    407407        newnode->type->typeexpr = expr;
    408408        return newnode;
  • src/Parser/ParseNode.h

    r30ee9ef rf855545  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug  4 09:39:40 2018
    13 // Update Count     : 853
     12// Last Modified On : Thu Nov  1 20:54:53 2018
     13// Update Count     : 854
    1414//
    1515
     
    249249        static DeclarationNode * newBitfield( ExpressionNode * size );
    250250        static DeclarationNode * newTuple( DeclarationNode * members );
    251         static DeclarationNode * newTypeof( ExpressionNode * expr );
     251        static DeclarationNode * newTypeof( ExpressionNode * expr, bool basetypeof = false );
    252252        static DeclarationNode * newAttr( const std::string *, ExpressionNode * expr ); // @ attributes
    253253        static DeclarationNode * newAttr( const std::string *, DeclarationNode * type ); // @ attributes
  • src/Parser/TypeData.cc

    r30ee9ef rf855545  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 20 14:39:31 2018
    13 // Update Count     : 622
     12// Last Modified On : Thu Nov  1 20:56:14 2018
     13// Update Count     : 623
    1414//
    1515
     
    9696                break;
    9797          case Typeof:
     98          case Basetypeof:
    9899                // typeexpr = new Typeof_t;
    99100                typeexpr = nullptr;
     
    166167                break;
    167168          case Typeof:
     169          case Basetypeof:
    168170                // delete typeexpr->expr;
    169171                delete typeexpr;
     
    245247                break;
    246248          case Typeof:
     249          case Basetypeof:
    247250                newtype->typeexpr = maybeClone( typeexpr );
    248251                break;
     
    419422                } // if
    420423                break;
     424          case Basetypeof:
     425                os << "base-";
     426                __attribute__((fallthrough));
    421427          case Typeof:
    422428                os << "type-of expression ";
     
    457463          case Tuple:
    458464          case Typeof:
     465          case Basetypeof:
    459466          case Builtin:
    460467                assertf(false, "Tried to get leaf name from kind without a name: %d", kind);
     
    535542                return buildTuple( td );
    536543          case TypeData::Typeof:
     544          case TypeData::Basetypeof:
    537545                return buildTypeof( td );
    538546          case TypeData::Builtin:
     
    929937
    930938TypeofType * buildTypeof( const TypeData * td ) {
    931         assert( td->kind == TypeData::Typeof );
     939        assert( td->kind == TypeData::Typeof || td->kind == TypeData::Basetypeof );
    932940        assert( td->typeexpr );
    933941        // assert( td->typeexpr->expr );
    934         return new TypeofType( buildQualifiers( td ), td->typeexpr->build() );
     942        return new TypeofType( td->kind == TypeData::Basetypeof ? Type::Qualifiers{} : buildQualifiers( td ), td->typeexpr->build() );
    935943} // buildTypeof
    936944
  • src/Parser/TypeData.h

    r30ee9ef rf855545  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 20 13:56:40 2018
    13 // Update Count     : 195
     12// Last Modified On : Thu Nov  1 20:56:46 2018
     13// Update Count     : 196
    1414//
    1515
     
    2727struct TypeData {
    2828        enum Kind { Basic, Pointer, Reference, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
    29                                 SymbolicInst, Tuple, Typeof, Builtin, GlobalScope, Qualified, Unknown };
     29                                SymbolicInst, Tuple, Typeof, Basetypeof, Builtin, GlobalScope, Qualified, Unknown };
    3030
    3131        struct Aggregate_t {
Note: See TracChangeset for help on using the changeset viewer.