Ignore:
Timestamp:
Sep 6, 2016, 4:36:29 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
e76acbe
Parents:
0362d42 (diff), f04a8b81 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into tuples

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TypeData.cc

    r0362d42 r1ced874  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug 28 18:28:58 2016
    13 // Update Count     : 223
     12// Last Modified On : Mon Aug 29 22:31:53 2016
     13// Update Count     : 277
    1414//
    1515
     
    3333                break;
    3434          case Basic:
    35                 basic = new Basic_t;
     35                // basic = new Basic_t;
    3636                break;
    3737          case Array:
    38                 array = new Array_t;
    39                 array->dimension = 0;
    40                 array->isVarLen = false;
    41                 array->isStatic = false;
     38                // array = new Array_t;
     39                array.dimension = 0;
     40                array.isVarLen = false;
     41                array.isStatic = false;
    4242                break;
    4343          case Function:
    44                 function = new Function_t;
    45                 function->params = 0;
    46                 function->idList = 0;
    47                 function->oldDeclList = 0;
    48                 function->body = 0;
    49                 function->hasBody = false;
    50                 function->newStyle = false;
     44                // function = new Function_t;
     45                function.params = 0;
     46                function.idList = 0;
     47                function.oldDeclList = 0;
     48                function.body = 0;
     49                function.hasBody = false;
     50                function.newStyle = false;
    5151                break;
    5252          case Aggregate:
    53                 aggregate = new Aggregate_t;
    54                 aggregate->params = 0;
    55                 aggregate->actuals = 0;
    56                 aggregate->fields = 0;
     53                // aggregate = new Aggregate_t;
     54                aggregate.params = 0;
     55                aggregate.actuals = 0;
     56                aggregate.fields = 0;
    5757                break;
    5858          case AggregateInst:
    59                 aggInst = new AggInst_t;
    60                 aggInst->aggregate = 0;
    61                 aggInst->params = 0;
     59                // aggInst = new AggInst_t;
     60                aggInst.aggregate = 0;
     61                aggInst.params = 0;
    6262                break;
    6363          case Enum:
    64                 enumeration = new Enumeration_t;
    65                 enumeration->constants = 0;
     64                // enumeration = new Enumeration_t;
     65                enumeration.constants = 0;
    6666                break;
    6767          case Symbolic:
    6868          case SymbolicInst:
    69                 symbolic = new Symbolic_t;
    70                 symbolic->params = 0;
    71                 symbolic->actuals = 0;
    72                 symbolic->assertions = 0;
     69                // symbolic = new Symbolic_t;
     70                symbolic.params = 0;
     71                symbolic.actuals = 0;
     72                symbolic.assertions = 0;
    7373                break;
    7474          case Variable:
    75                 variable = new Variable_t;
    76                 variable->tyClass = DeclarationNode::Type;
    77                 variable->assertions = 0;
     75                // variable = new Variable_t;
     76                // variable.tyClass = DeclarationNode::Type;
     77                // variable.assertions = 0;
    7878                break;
    7979          case Tuple:
    80                 tuple = new Tuple_t;
    81                 tuple->members = 0;
     80                // tuple = new Tuple_t;
     81                tuple = nullptr;
    8282                break;
    8383          case Typeof:
    84                 typeexpr = new Typeof_t;
    85                 typeexpr->expr = 0;
     84                // typeexpr = new Typeof_t;
     85                typeexpr = nullptr;
     86                break;
     87          case Attr:
     88                // attr = new Attr_t;
     89                // attr.expr = nullptr;
     90                // attr.type = nullptr;
    8691                break;
    8792          case Builtin:
    88                 builtin = new Builtin_t;
    89                 break;
    90           case Attr:
    91                 attr = new Attr_t;
    92                 attr->expr = 0;
    93                 attr->type = 0;
     93                // builtin = new Builtin_t;
    9494                break;
    9595        } // switch
     
    107107                break;
    108108          case Basic:
    109                 delete basic;
     109                // delete basic;
    110110                break;
    111111          case Array:
    112                 delete array->dimension;
    113                 delete array;
     112                delete array.dimension;
     113                // delete array;
    114114                break;
    115115          case Function:
    116                 delete function->params;
    117                 delete function->idList;
    118                 delete function->oldDeclList;
    119                 delete function->body;
    120                 delete function;
     116                delete function.params;
     117                delete function.idList;
     118                delete function.oldDeclList;
     119                delete function.body;
     120                // delete function;
    121121                break;
    122122          case Aggregate:
    123                 delete aggregate->params;
    124                 delete aggregate->actuals;
    125                 delete aggregate->fields;
    126                 delete aggregate;
     123                delete aggregate.params;
     124                delete aggregate.actuals;
     125                delete aggregate.fields;
     126                // delete aggregate;
    127127                break;
    128128          case AggregateInst:
    129                 delete aggInst->aggregate;
    130                 delete aggInst->params;
    131                 delete aggInst;
     129                delete aggInst.aggregate;
     130                delete aggInst.params;
     131                // delete aggInst;
    132132                break;
    133133          case Enum:
    134                 delete enumeration->constants;
    135                 delete enumeration;
     134                delete enumeration.constants;
     135                // delete enumeration;
    136136                break;
    137137          case Symbolic:
    138138          case SymbolicInst:
    139                 delete symbolic->params;
    140                 delete symbolic->actuals;
    141                 delete symbolic->assertions;
    142                 delete symbolic;
     139                delete symbolic.params;
     140                delete symbolic.actuals;
     141                delete symbolic.assertions;
     142                // delete symbolic;
    143143                break;
    144144          case Variable:
    145                 delete variable->assertions;
    146                 delete variable;
     145                // delete variable.assertions;
     146                // delete variable;
    147147                break;
    148148          case Tuple:
    149                 delete tuple->members;
     149                // delete tuple->members;
    150150                delete tuple;
    151151                break;
    152152          case Typeof:
    153                 delete typeexpr->expr;
     153                // delete typeexpr->expr;
    154154                delete typeexpr;
    155155                break;
     156          case Attr:
     157                // delete attr.expr;
     158                // delete attr.type;
     159                // delete attr;
     160                break;
    156161          case Builtin:
    157                 delete builtin;
    158                 break;
    159           case Attr:
    160                 delete attr->expr;
    161                 delete attr->type;
    162                 delete attr;
     162                // delete builtin;
    163163                break;
    164164        } // switch
     
    178178                break;
    179179          case Basic:
    180                 newtype->basic->typeSpec = basic->typeSpec;
    181                 newtype->basic->modifiers = basic->modifiers;
     180                newtype->basic.typeSpec = basic.typeSpec;
     181                newtype->basic.modifiers = basic.modifiers;
    182182                break;
    183183          case Array:
    184                 newtype->array->dimension = maybeClone( array->dimension );
    185                 newtype->array->isVarLen = array->isVarLen;
    186                 newtype->array->isStatic = array->isStatic;
     184                newtype->array.dimension = maybeClone( array.dimension );
     185                newtype->array.isVarLen = array.isVarLen;
     186                newtype->array.isStatic = array.isStatic;
    187187                break;
    188188          case Function:
    189                 newtype->function->params = maybeClone( function->params );
    190                 newtype->function->idList = maybeClone( function->idList );
    191                 newtype->function->oldDeclList = maybeClone( function->oldDeclList );
    192                 newtype->function->body = maybeClone( function->body );
    193                 newtype->function->hasBody = function->hasBody;
    194                 newtype->function->newStyle = function->newStyle;
     189                newtype->function.params = maybeClone( function.params );
     190                newtype->function.idList = maybeClone( function.idList );
     191                newtype->function.oldDeclList = maybeClone( function.oldDeclList );
     192                newtype->function.body = maybeClone( function.body );
     193                newtype->function.hasBody = function.hasBody;
     194                newtype->function.newStyle = function.newStyle;
    195195                break;
    196196          case Aggregate:
    197                 newtype->aggregate->params = maybeClone( aggregate->params );
    198                 newtype->aggregate->actuals = maybeClone( aggregate->actuals );
    199                 newtype->aggregate->fields = maybeClone( aggregate->fields );
    200                 newtype->aggregate->name = aggregate->name;
    201                 newtype->aggregate->kind = aggregate->kind;
    202                 newtype->aggregate->body = aggregate->body;
     197                newtype->aggregate.params = maybeClone( aggregate.params );
     198                newtype->aggregate.actuals = maybeClone( aggregate.actuals );
     199                newtype->aggregate.fields = maybeClone( aggregate.fields );
     200                newtype->aggregate.name = aggregate.name;
     201                newtype->aggregate.kind = aggregate.kind;
     202                newtype->aggregate.body = aggregate.body;
    203203                break;
    204204          case AggregateInst:
    205                 newtype->aggInst->aggregate = maybeClone( aggInst->aggregate );
    206                 newtype->aggInst->params = maybeClone( aggInst->params );
     205                newtype->aggInst.aggregate = maybeClone( aggInst.aggregate );
     206                newtype->aggInst.params = maybeClone( aggInst.params );
    207207                break;
    208208          case Enum:
    209                 newtype->enumeration->name = enumeration->name;
    210                 newtype->enumeration->constants = maybeClone( enumeration->constants );
     209                newtype->enumeration.name = enumeration.name;
     210                newtype->enumeration.constants = maybeClone( enumeration.constants );
    211211                break;
    212212          case Symbolic:
    213213          case SymbolicInst:
    214                 newtype->symbolic->params = maybeClone( symbolic->params );
    215                 newtype->symbolic->actuals = maybeClone( symbolic->actuals );
    216                 newtype->symbolic->assertions = maybeClone( symbolic->assertions );
    217                 newtype->symbolic->isTypedef = symbolic->isTypedef;
    218                 newtype->symbolic->name = symbolic->name;
     214                newtype->symbolic.params = maybeClone( symbolic.params );
     215                newtype->symbolic.actuals = maybeClone( symbolic.actuals );
     216                newtype->symbolic.assertions = maybeClone( symbolic.assertions );
     217                newtype->symbolic.isTypedef = symbolic.isTypedef;
     218                newtype->symbolic.name = symbolic.name;
    219219                break;
    220220          case Variable:
    221                 newtype->variable->assertions = maybeClone( variable->assertions );
    222                 newtype->variable->name = variable->name;
    223                 newtype->variable->tyClass = variable->tyClass;
     221                assert( false );
     222                // newtype->variable.assertions = maybeClone( variable.assertions );
     223                // newtype->variable.name = variable.name;
     224                // newtype->variable.tyClass = variable.tyClass;
    224225                break;
    225226          case Tuple:
    226                 newtype->tuple->members = maybeClone( tuple->members );
     227                newtype->tuple = maybeClone( tuple );
    227228                break;
    228229          case Typeof:
    229                 newtype->typeexpr->expr = maybeClone( typeexpr->expr );
     230                newtype->typeexpr = maybeClone( typeexpr );
     231                break;
     232          case Attr:
     233                assert( false );
     234                // newtype->attr.expr = maybeClone( attr.expr );
     235                // newtype->attr.type = maybeClone( attr.type );
    230236                break;
    231237          case Builtin:
    232                 newtype->builtin->type = builtin->type;
    233                 break;
    234           case Attr:
    235                 newtype->attr->expr = maybeClone( attr->expr );
    236                 newtype->attr->type = maybeClone( attr->type );
     238                assert( false );
     239                // newtype->builtin = builtin;
    237240                break;
    238241        } // switch
     
    268271                break;
    269272          case Basic:
    270                 printEnums( basic->modifiers.begin(), basic->modifiers.end(), DeclarationNode::modifierName, os );
    271                 printEnums( basic->typeSpec.begin(), basic->typeSpec.end(), DeclarationNode::basicTypeName, os );
     273                printEnums( basic.modifiers.begin(), basic.modifiers.end(), DeclarationNode::modifierName, os );
     274                printEnums( basic.typeSpec.begin(), basic.typeSpec.end(), DeclarationNode::basicTypeName, os );
    272275                break;
    273276          case Array:
    274                 if ( array->isStatic ) {
     277                if ( array.isStatic ) {
    275278                        os << "static ";
    276279                } // if
    277                 if ( array->dimension ) {
     280                if ( array.dimension ) {
    278281                        os << "array of ";
    279                         array->dimension->printOneLine( os, indent );
    280                 } else if ( array->isVarLen ) {
     282                        array.dimension->printOneLine( os, indent );
     283                } else if ( array.isVarLen ) {
    281284                        os << "variable-length array of ";
    282285                } else {
     
    289292          case Function:
    290293                os << "function" << endl;
    291                 if ( function->params ) {
     294                if ( function.params ) {
    292295                        os << string( indent + 2, ' ' ) << "with parameters " << endl;
    293                         function->params->printList( os, indent + 4 );
     296                        function.params->printList( os, indent + 4 );
    294297                } else {
    295298                        os << string( indent + 2, ' ' ) << "with no parameters " << endl;
    296299                } // if
    297                 if ( function->idList ) {
     300                if ( function.idList ) {
    298301                        os << string( indent + 2, ' ' ) << "with old-style identifier list " << endl;
    299                         function->idList->printList( os, indent + 4 );
    300                 } // if
    301                 if ( function->oldDeclList ) {
     302                        function.idList->printList( os, indent + 4 );
     303                } // if
     304                if ( function.oldDeclList ) {
    302305                        os << string( indent + 2, ' ' ) << "with old-style declaration list " << endl;
    303                         function->oldDeclList->printList( os, indent + 4 );
     306                        function.oldDeclList->printList( os, indent + 4 );
    304307                } // if
    305308                os << string( indent + 2, ' ' ) << "returning ";
     
    310313                } // if
    311314                os << endl;
    312                 if ( function->hasBody ) {
     315                if ( function.hasBody ) {
    313316                        os << string( indent + 2, ' ' ) << "with body " << endl;
    314317                } // if
    315                 if ( function->body ) {
    316                         function->body->printList( os, indent + 2 );
     318                if ( function.body ) {
     319                        function.body->printList( os, indent + 2 );
    317320                } // if
    318321                break;
    319322          case Aggregate:
    320                 os << DeclarationNode::aggregateName[ aggregate->kind ] << ' ' << aggregate->name << endl;
    321                 if ( aggregate->params ) {
     323                os << DeclarationNode::aggregateName[ aggregate.kind ] << ' ' << aggregate.name << endl;
     324                if ( aggregate.params ) {
    322325                        os << string( indent + 2, ' ' ) << "with type parameters " << endl;
    323                         aggregate->params->printList( os, indent + 4 );
    324                 } // if
    325                 if ( aggregate->actuals ) {
     326                        aggregate.params->printList( os, indent + 4 );
     327                } // if
     328                if ( aggregate.actuals ) {
    326329                        os << string( indent + 2, ' ' ) << "instantiated with actual parameters " << endl;
    327                         aggregate->actuals->printList( os, indent + 4 );
    328                 } // if
    329                 if ( aggregate->fields ) {
     330                        aggregate.actuals->printList( os, indent + 4 );
     331                } // if
     332                if ( aggregate.fields ) {
    330333                        os << string( indent + 2, ' ' ) << "with members " << endl;
    331                         aggregate->fields->printList( os, indent + 4 );
    332                 } // if
    333                 if ( aggregate->body ) {
     334                        aggregate.fields->printList( os, indent + 4 );
     335                } // if
     336                if ( aggregate.body ) {
    334337                        os << string( indent + 2, ' ' ) << " with body " << endl;
    335338                } // if
    336339                break;
    337340          case AggregateInst:
    338                 if ( aggInst->aggregate ) {
     341                if ( aggInst.aggregate ) {
    339342                        os << "instance of " ;
    340                         aggInst->aggregate->print( os, indent );
     343                        aggInst.aggregate->print( os, indent );
    341344                } else {
    342345                        os << "instance of an unspecified aggregate ";
    343346                } // if
    344                 if ( aggInst->params ) {
     347                if ( aggInst.params ) {
    345348                        os << string( indent + 2, ' ' ) << "with parameters " << endl;
    346                         aggInst->params->printList( os, indent + 2 );
     349                        aggInst.params->printList( os, indent + 2 );
    347350                } // if
    348351                break;
    349352          case Enum:
    350353                os << "enumeration ";
    351                 if ( enumeration->constants ) {
     354                if ( enumeration.constants ) {
    352355                        os << "with constants" << endl;
    353                         enumeration->constants->printList( os, indent + 2 );
     356                        enumeration.constants->printList( os, indent + 2 );
    354357                } // if
    355358                break;
    356359          case SymbolicInst:
    357                 os << "instance of type " << symbolic->name;
    358                 if ( symbolic->actuals ) {
     360                os << "instance of type " << symbolic.name;
     361                if ( symbolic.actuals ) {
    359362                        os << " with parameters" << endl;
    360                         symbolic->actuals->printList( os, indent + 2 );
     363                        symbolic.actuals->printList( os, indent + 2 );
    361364                } // if
    362365                break;
    363366          case Symbolic:
    364                 if ( symbolic->isTypedef ) {
     367                if ( symbolic.isTypedef ) {
    365368                        os << "typedef definition ";
    366369                } else {
    367370                        os << "type definition ";
    368371                } // if
    369                 if ( symbolic->params ) {
     372                if ( symbolic.params ) {
    370373                        os << endl << string( indent + 2, ' ' ) << "with parameters" << endl;
    371                         symbolic->params->printList( os, indent + 2 );
    372                 } // if
    373                 if ( symbolic->assertions ) {
     374                        symbolic.params->printList( os, indent + 2 );
     375                } // if
     376                if ( symbolic.assertions ) {
    374377                        os << endl << string( indent + 2, ' ' ) << "with assertions" << endl;
    375                         symbolic->assertions->printList( os, indent + 4 );
     378                        symbolic.assertions->printList( os, indent + 4 );
    376379                        os << string( indent + 2, ' ' );
    377380                } // if
     
    382385                break;
    383386          case Variable:
    384                 os << DeclarationNode::typeClassName[ variable->tyClass ] << " variable ";
    385                 if ( variable->assertions ) {
    386                         os << endl << string( indent + 2, ' ' ) << "with assertions" << endl;
    387                         variable->assertions->printList( os, indent + 4 );
    388                         os << string( indent + 2, ' ' );
    389                 } // if
     387                // os << DeclarationNode::typeClassName[ variable.tyClass ] << " variable ";
     388                // if ( variable.assertions ) {
     389                //      os << endl << string( indent + 2, ' ' ) << "with assertions" << endl;
     390                //      variable.assertions->printList( os, indent + 4 );
     391                //      os << string( indent + 2, ' ' );
     392                // } // if
    390393                break;
    391394          case Tuple:
    392395                os << "tuple ";
    393                 if ( tuple->members ) {
     396                if ( tuple ) {
    394397                        os << "with members " << endl;
    395                         tuple->members->printList( os, indent + 2 );
     398                        tuple->printList( os, indent + 2 );
    396399                } // if
    397400                break;
    398401          case Typeof:
    399402                os << "type-of expression ";
    400                 if ( typeexpr->expr ) {
    401                         typeexpr->expr->print( os, indent + 2 );
     403                if ( typeexpr ) {
     404                        typeexpr->print( os, indent + 2 );
    402405                } // if
    403406                break;
    404407          case Attr:
    405                 os << "attribute type decl " << attr->name << " applied to ";
    406                 if ( attr->expr ) {
    407                         attr->expr->print( os, indent + 2 );
    408                 } // if
    409                 if ( attr->type ) {
    410                         attr->type->print( os, indent + 2 );
    411                 } // if
     408                // os << "attribute type decl " << attr.name << " applied to ";
     409                // if ( attr.expr ) {
     410                //      attr.expr->print( os, indent + 2 );
     411                // } // if
     412                // if ( attr.type ) {
     413                //      attr.type->print( os, indent + 2 );
     414                // } // if
    412415                break;
    413416          case Builtin:
     
    479482                return new VarArgsType( buildQualifiers( td ) );
    480483          case TypeData::Attr:
     484                assert( false );
    481485                return buildAttr( td );
    482486          case TypeData::Symbolic:
     
    494498        switch ( td->kind ) {
    495499          case TypeData::Aggregate:
    496                 if ( ! toplevel && td->aggregate->fields ) {
     500                if ( ! toplevel && td->aggregate.fields ) {
    497501                        ret = td->clone();
    498502                } // if
    499503                break;
    500504          case TypeData::Enum:
    501                 if ( ! toplevel && td->enumeration->constants ) {
     505                if ( ! toplevel && td->enumeration.constants ) {
    502506                        ret = td->clone();
    503507                } // if
    504508                break;
    505509          case TypeData::AggregateInst:
    506                 if ( td->aggInst->aggregate ) {
    507                         ret = typeextractAggregate( td->aggInst->aggregate, false );
     510                if ( td->aggInst.aggregate ) {
     511                        ret = typeextractAggregate( td->aggInst.aggregate, false );
    508512                } // if
    509513                break;
     
    535539        BasicType::Kind ret;
    536540
    537         for ( std::list< DeclarationNode::BasicType >::const_iterator i = td->basic->typeSpec.begin(); i != td->basic->typeSpec.end(); ++i ) {
     541        for ( std::list< DeclarationNode::BasicType >::const_iterator i = td->basic.typeSpec.begin(); i != td->basic.typeSpec.end(); ++i ) {
    538542                if ( ! init ) {
    539543                        init = true;
    540544                        if ( *i == DeclarationNode::Void ) {
    541                                 if ( td->basic->typeSpec.size() != 1 || ! td->basic->modifiers.empty() ) {
     545                                if ( td->basic.typeSpec.size() != 1 || ! td->basic.modifiers.empty() ) {
    542546                                        throw SemanticError( "invalid type specifier \"void\" in type: ", td );
    543547                                } else {
     
    611615        } // for
    612616
    613         for ( std::list< DeclarationNode::Modifier >::const_iterator i = td->basic->modifiers.begin(); i != td->basic->modifiers.end(); ++i ) {
     617        for ( std::list< DeclarationNode::Modifier >::const_iterator i = td->basic.modifiers.begin(); i != td->basic.modifiers.end(); ++i ) {
    614618                switch ( *i ) {
    615619                  case DeclarationNode::Long:
     
    746750        ArrayType * at;
    747751        if ( td->base ) {
    748                 at = new ArrayType( buildQualifiers( td ), typebuild( td->base ), maybeBuild< Expression >( td->array->dimension ),
    749                                                         td->array->isVarLen, td->array->isStatic );
     752                at = new ArrayType( buildQualifiers( td ), typebuild( td->base ), maybeBuild< Expression >( td->array.dimension ),
     753                                                        td->array.isVarLen, td->array.isStatic );
    750754        } else {
    751755                at = new ArrayType( buildQualifiers( td ), new BasicType( Type::Qualifiers(), BasicType::SignedInt ),
    752                                                         maybeBuild< Expression >( td->array->dimension ), td->array->isVarLen, td->array->isStatic );
     756                                                        maybeBuild< Expression >( td->array.dimension ), td->array.isVarLen, td->array.isStatic );
    753757        } // if
    754758        buildForall( td->forall, at->get_forall() );
     
    759763        assert( td->kind == TypeData::Aggregate );
    760764        AggregateDecl * at;
    761         switch ( td->aggregate->kind ) {
     765        switch ( td->aggregate.kind ) {
    762766          case DeclarationNode::Struct:
    763                 at = new StructDecl( td->aggregate->name );
    764                 buildForall( td->aggregate->params, at->get_parameters() );
     767                at = new StructDecl( td->aggregate.name );
     768                buildForall( td->aggregate.params, at->get_parameters() );
    765769                break;
    766770          case DeclarationNode::Union:
    767                 at = new UnionDecl( td->aggregate->name );
    768                 buildForall( td->aggregate->params, at->get_parameters() );
     771                at = new UnionDecl( td->aggregate.name );
     772                buildForall( td->aggregate.params, at->get_parameters() );
    769773                break;
    770774          case DeclarationNode::Trait:
    771                 at = new TraitDecl( td->aggregate->name );
    772                 buildList( td->aggregate->params, at->get_parameters() );
     775                at = new TraitDecl( td->aggregate.name );
     776                buildList( td->aggregate.params, at->get_parameters() );
    773777                break;
    774778          default:
     
    776780        } // switch
    777781
    778         buildList( td->aggregate->fields, at->get_members() );
    779         at->set_body( td->aggregate->body );
     782        buildList( td->aggregate.fields, at->get_members() );
     783        at->set_body( td->aggregate.body );
    780784
    781785        return at;
     
    786790
    787791        ReferenceToType * ret;
    788         if ( td->aggInst->aggregate->kind == TypeData::Enum ) {
    789                 ret = new EnumInstType( buildQualifiers( td ), td->aggInst->aggregate->enumeration->name );
     792        if ( td->aggInst.aggregate->kind == TypeData::Enum ) {
     793                ret = new EnumInstType( buildQualifiers( td ), td->aggInst.aggregate->enumeration.name );
    790794        } else {
    791                 assert( td->aggInst->aggregate->kind == TypeData::Aggregate );
    792                 switch ( td->aggInst->aggregate->aggregate->kind ) {
     795                assert( td->aggInst.aggregate->kind == TypeData::Aggregate );
     796                switch ( td->aggInst.aggregate->aggregate.kind ) {
    793797                  case DeclarationNode::Struct:
    794                         ret = new StructInstType( buildQualifiers( td ), td->aggInst->aggregate->aggregate->name );
     798                        ret = new StructInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name );
    795799                        break;
    796800                  case DeclarationNode::Union:
    797                         ret = new UnionInstType( buildQualifiers( td ), td->aggInst->aggregate->aggregate->name );
     801                        ret = new UnionInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name );
    798802                        break;
    799803                  case DeclarationNode::Trait:
    800                         ret = new TraitInstType( buildQualifiers( td ), td->aggInst->aggregate->aggregate->name );
     804                        ret = new TraitInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name );
    801805                        break;
    802806                  default:
     
    804808                } // switch
    805809        } // if
    806         buildList( td->aggInst->params, ret->get_parameters() );
     810        buildList( td->aggInst.params, ret->get_parameters() );
    807811        buildForall( td->forall, ret->get_forall() );
    808812        return ret;
     
    813817        NamedTypeDecl * ret;
    814818        assert( td->base );
    815         if ( td->symbolic->isTypedef ) {
     819        if ( td->symbolic.isTypedef ) {
    816820                ret = new TypedefDecl( name, sc, typebuild( td->base ) );
    817821        } else {
    818822                ret = new TypeDecl( name, sc, typebuild( td->base ), TypeDecl::Any );
    819823        } // if
    820         buildList( td->symbolic->params, ret->get_parameters() );
    821         buildList( td->symbolic->assertions, ret->get_assertions() );
     824        buildList( td->symbolic.params, ret->get_parameters() );
     825        buildList( td->symbolic.assertions, ret->get_assertions() );
    822826        return ret;
    823827} // buildSymbolic
    824828
    825829TypeDecl * buildVariable( const TypeData * td ) {
    826         assert( td->kind == TypeData::Variable );
    827         static const TypeDecl::Kind kindMap[] = { TypeDecl::Any, TypeDecl::Ftype, TypeDecl::Dtype };
    828 
    829         TypeDecl * ret = new TypeDecl( td->variable->name, DeclarationNode::NoStorageClass, 0, kindMap[ td->variable->tyClass ] );
    830         buildList( td->variable->assertions, ret->get_assertions() );
    831         return ret;
     830        assert( false );
     831        return nullptr;
     832        // assert( td->kind == TypeData::Variable );
     833        // static const TypeDecl::Kind kindMap[] = { TypeDecl::Any, TypeDecl::Ftype, TypeDecl::Dtype };
     834
     835        // TypeDecl * ret = new TypeDecl( td->variable.name, DeclarationNode::NoStorageClass, 0, kindMap[ td->variable.tyClass ] );
     836        // buildList( td->variable.assertions, ret->get_assertions() );
     837        // return ret;
    832838} // buildSymbolic
    833839
    834840EnumDecl * buildEnum( const TypeData * td ) {
    835841        assert( td->kind == TypeData::Enum );
    836         EnumDecl * ret = new EnumDecl( td->enumeration->name );
    837         buildList( td->enumeration->constants, ret->get_members() );
     842        EnumDecl * ret = new EnumDecl( td->enumeration.name );
     843        buildList( td->enumeration.constants, ret->get_members() );
    838844        std::list< Declaration * >::iterator members = ret->get_members().begin();
    839         for ( const DeclarationNode * cur = td->enumeration-> constants; cur != nullptr; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ), ++members ) {
     845        for ( const DeclarationNode * cur = td->enumeration. constants; cur != nullptr; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ), ++members ) {
    840846                if ( cur->has_enumeratorValue() ) {
    841847                        ObjectDecl * member = dynamic_cast< ObjectDecl * >(* members);
     
    848854TypeInstType * buildSymbolicInst( const TypeData * td ) {
    849855        assert( td->kind == TypeData::SymbolicInst );
    850         TypeInstType * ret = new TypeInstType( buildQualifiers( td ), td->symbolic->name, false );
    851         buildList( td->symbolic->actuals, ret->get_parameters() );
     856        TypeInstType * ret = new TypeInstType( buildQualifiers( td ), td->symbolic.name, false );
     857        buildList( td->symbolic.actuals, ret->get_parameters() );
    852858        buildForall( td->forall, ret->get_forall() );
    853859        return ret;
     
    857863        assert( td->kind == TypeData::Tuple );
    858864        TupleType * ret = new TupleType( buildQualifiers( td ) );
    859         buildTypeList( td->tuple->members, ret->get_types() );
     865        buildTypeList( td->tuple, ret->get_types() );
    860866        buildForall( td->forall, ret->get_forall() );
    861867        return ret;
     
    865871        assert( td->kind == TypeData::Typeof );
    866872        assert( td->typeexpr );
    867         assert( td->typeexpr->expr );
    868         return new TypeofType( buildQualifiers( td ), td->typeexpr->expr->build() );
     873        // assert( td->typeexpr->expr );
     874        return new TypeofType( buildQualifiers( td ), td->typeexpr->build() );
    869875} // buildTypeof
    870876
    871877AttrType * buildAttr( const TypeData * td ) {
    872         assert( td->kind == TypeData::Attr );
    873         assert( td->attr );
    874         AttrType * ret;
    875         if ( td->attr->expr ) {
    876                 ret = new AttrType( buildQualifiers( td ), td->attr->name, td->attr->expr->build() );
    877         } else {
    878                 assert( td->attr->type );
    879                 ret = new AttrType( buildQualifiers( td ), td->attr->name, td->attr->type->buildType() );
    880         } // if
    881         return ret;
     878        assert( false );
     879        return nullptr;
     880        // assert( td->kind == TypeData::Attr );
     881        // // assert( td->attr );
     882        // AttrType * ret;
     883        // if ( td->attr.expr ) {
     884        //      ret = new AttrType( buildQualifiers( td ), td->attr.name, td->attr.expr->build() );
     885        // } else {
     886        //      assert( td->attr.type );
     887        //      ret = new AttrType( buildQualifiers( td ), td->attr.name, td->attr.type->buildType() );
     888        // } // if
     889        // return ret;
    882890} // buildAttr
    883891
     
    885893        if ( td->kind == TypeData::Function ) {
    886894                FunctionDecl * decl;
    887                 if ( td->function->hasBody ) {
    888                         if ( td->function->body ) {
    889                                 Statement * stmt = td->function->body->build();
     895                if ( td->function.hasBody ) {
     896                        if ( td->function.body ) {
     897                                Statement * stmt = td->function.body->build();
    890898                                CompoundStmt * body = dynamic_cast< CompoundStmt* >( stmt );
    891899                                assert( body );
     
    898906                        decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), 0, isInline, isNoreturn );
    899907                } // if
    900                 for ( DeclarationNode * cur = td->function->idList; cur != 0; cur = dynamic_cast< DeclarationNode* >( cur->get_next() ) ) {
     908                for ( DeclarationNode * cur = td->function.idList; cur != 0; cur = dynamic_cast< DeclarationNode* >( cur->get_next() ) ) {
    901909                        if ( cur->get_name() != "" ) {
    902910                                decl->get_oldIdents().insert( decl->get_oldIdents().end(), cur->get_name() );
    903911                        } // if
    904912                } // for
    905                 buildList( td->function->oldDeclList, decl->get_oldDecls() );
     913                buildList( td->function.oldDeclList, decl->get_oldDecls() );
    906914                return decl;
    907915        } else if ( td->kind == TypeData::Aggregate ) {
     
    912920                return buildSymbolic( td, name, sc );
    913921        } else if ( td->kind == TypeData::Variable ) {
     922                assert( false );
    914923                return buildVariable( td );
    915924        } else {
     
    921930FunctionType * buildFunction( const TypeData * td ) {
    922931        assert( td->kind == TypeData::Function );
    923         bool hasEllipsis = td->function->params ? td->function->params->get_hasEllipsis() : true;
    924         if ( ! td->function->params ) hasEllipsis = ! td->function->newStyle;
     932        bool hasEllipsis = td->function.params ? td->function.params->get_hasEllipsis() : true;
     933        if ( ! td->function.params ) hasEllipsis = ! td->function.newStyle;
    925934        FunctionType * ft = new FunctionType( buildQualifiers( td ), hasEllipsis );
    926         buildList( td->function->params, ft->get_parameters() );
     935        buildList( td->function.params, ft->get_parameters() );
    927936        buildForall( td->forall, ft->get_forall() );
    928937        if ( td->base ) {
    929938                switch ( td->base->kind ) {
    930939                  case TypeData::Tuple:
    931                         buildList( td->base->tuple->members, ft->get_returnVals() );
     940                        buildList( td->base->tuple, ft->get_returnVals() );
    932941                        break;
    933942                  default:
Note: See TracChangeset for help on using the changeset viewer.