Changeset 8f6f47d7


Ignore:
Timestamp:
Aug 29, 2016, 5:39:26 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, 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:
28307be
Parents:
b542bfb
Message:

more refactoring of parser code

Location:
src/Parser
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rb542bfb r8f6f47d7  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug 28 22:12:44 2016
    13 // Update Count     : 278
     12// Last Modified On : Mon Aug 29 15:55:12 2016
     13// Update Count     : 311
    1414//
    1515
     
    129129
    130130        newnode->type = new TypeData( TypeData::Function );
    131         newnode->type->function->params = param;
    132         newnode->type->function->newStyle = newStyle;
    133         newnode->type->function->body = body;
     131        newnode->type->function.params = param;
     132        newnode->type->function.newStyle = newStyle;
     133        newnode->type->function.body = body;
    134134        typedefTable.addToEnclosingScope( newnode->name, TypedefTable::ID );
    135135
    136136        if ( body ) {
    137                 newnode->type->function->hasBody = true;
     137                newnode->type->function.hasBody = true;
    138138        } // if
    139139
     
    175175        DeclarationNode *newnode = new DeclarationNode;
    176176        newnode->type = new TypeData( TypeData::Basic );
    177         newnode->type->basic->typeSpec.push_back( bt );
     177        newnode->type->basic.typeSpec.push_back( bt );
    178178        return newnode;
    179179} // DeclarationNode::newBasicType
     
    182182        DeclarationNode *newnode = new DeclarationNode;
    183183        newnode->type = new TypeData( TypeData::Basic );
    184         newnode->type->basic->modifiers.push_back( mod );
     184        newnode->type->basic.modifiers.push_back( mod );
    185185        return newnode;
    186186} // DeclarationNode::newModifier
    187187
    188 DeclarationNode * DeclarationNode::newBuiltinType( BuiltinType bt ) {
    189         DeclarationNode *newnode = new DeclarationNode;
    190         newnode->type = new TypeData( TypeData::Builtin );
    191         newnode->type->builtin->type = bt;
    192         return newnode;
    193 } // DeclarationNode::newBuiltinType
    194 
    195188DeclarationNode * DeclarationNode::newFromTypedef( std::string *name ) {
    196189        DeclarationNode *newnode = new DeclarationNode;
    197190        newnode->type = new TypeData( TypeData::SymbolicInst );
    198         newnode->type->symbolic->name = assign_strptr( name );
    199         newnode->type->symbolic->isTypedef = true;
    200         newnode->type->symbolic->params = 0;
     191        newnode->type->symbolic.name = assign_strptr( name );
     192        newnode->type->symbolic.isTypedef = true;
     193        newnode->type->symbolic.params = 0;
    201194        return newnode;
    202195} // DeclarationNode::newFromTypedef
     
    205198        DeclarationNode *newnode = new DeclarationNode;
    206199        newnode->type = new TypeData( TypeData::Aggregate );
    207         newnode->type->aggregate->kind = kind;
    208         newnode->type->aggregate->name = assign_strptr( name );
    209         if ( newnode->type->aggregate->name == "" ) {           // anonymous aggregate ?
    210                 newnode->type->aggregate->name = anonymous.newName();
    211         } // if
    212         newnode->type->aggregate->actuals = actuals;
    213         newnode->type->aggregate->fields = fields;
    214         newnode->type->aggregate->body = body;
     200        newnode->type->aggregate.kind = kind;
     201        newnode->type->aggregate.name = assign_strptr( name );
     202        if ( newnode->type->aggregate.name == "" ) {            // anonymous aggregate ?
     203                newnode->type->aggregate.name = anonymous.newName();
     204        } // if
     205        newnode->type->aggregate.actuals = actuals;
     206        newnode->type->aggregate.fields = fields;
     207        newnode->type->aggregate.body = body;
    215208        return newnode;
    216209} // DeclarationNode::newAggregate
     
    220213        newnode->name = assign_strptr( name );
    221214        newnode->type = new TypeData( TypeData::Enum );
    222         newnode->type->enumeration->name = newnode->name;
    223         if ( newnode->type->enumeration->name == "" ) {         // anonymous enumeration ?
    224                 newnode->type->enumeration->name = DeclarationNode::anonymous.newName();
    225         } // if
    226         newnode->type->enumeration->constants = constants;
     215        newnode->type->enumeration.name = newnode->name;
     216        if ( newnode->type->enumeration.name == "" ) {          // anonymous enumeration ?
     217                newnode->type->enumeration.name = DeclarationNode::anonymous.newName();
     218        } // if
     219        newnode->type->enumeration.constants = constants;
    227220        return newnode;
    228221} // DeclarationNode::newEnum
     
    245238        DeclarationNode *newnode = new DeclarationNode;
    246239        newnode->type = new TypeData( TypeData::SymbolicInst );
    247         newnode->type->symbolic->name = assign_strptr( name );
    248         newnode->type->symbolic->isTypedef = false;
    249         newnode->type->symbolic->actuals = params;
     240        newnode->type->symbolic.name = assign_strptr( name );
     241        newnode->type->symbolic.isTypedef = false;
     242        newnode->type->symbolic.actuals = params;
    250243        return newnode;
    251244} // DeclarationNode::newFromTypeGen
     
    255248        newnode->name = assign_strptr( name );
    256249        newnode->type = new TypeData( TypeData::Variable );
    257         newnode->type->variable->tyClass = tc;
    258         newnode->type->variable->name = newnode->name;
     250        newnode->type->variable.tyClass = tc;
     251        newnode->type->variable.name = newnode->name;
    259252        return newnode;
    260253} // DeclarationNode::newTypeParam
     
    263256        DeclarationNode *newnode = new DeclarationNode;
    264257        newnode->type = new TypeData( TypeData::Aggregate );
    265         newnode->type->aggregate->kind = Trait;
    266         newnode->type->aggregate->params = params;
    267         newnode->type->aggregate->fields = asserts;
    268         newnode->type->aggregate->name = assign_strptr( name );
     258        newnode->type->aggregate.kind = Trait;
     259        newnode->type->aggregate.params = params;
     260        newnode->type->aggregate.fields = asserts;
     261        newnode->type->aggregate.name = assign_strptr( name );
    269262        return newnode;
    270263} // DeclarationNode::newTrait
     
    273266        DeclarationNode *newnode = new DeclarationNode;
    274267        newnode->type = new TypeData( TypeData::AggregateInst );
    275         newnode->type->aggInst->aggregate = new TypeData( TypeData::Aggregate );
    276         newnode->type->aggInst->aggregate->aggregate->kind = Trait;
    277         newnode->type->aggInst->aggregate->aggregate->name = assign_strptr( name );
    278         newnode->type->aggInst->params = params;
     268        newnode->type->aggInst.aggregate = new TypeData( TypeData::Aggregate );
     269        newnode->type->aggInst.aggregate->aggregate.kind = Trait;
     270        newnode->type->aggInst.aggregate->aggregate.name = assign_strptr( name );
     271        newnode->type->aggInst.params = params;
    279272        return newnode;
    280273} // DeclarationNode::newTraitUse
     
    284277        newnode->name = assign_strptr( name );
    285278        newnode->type = new TypeData( TypeData::Symbolic );
    286         newnode->type->symbolic->isTypedef = false;
    287         newnode->type->symbolic->params = typeParams;
    288         newnode->type->symbolic->name = newnode->name;
     279        newnode->type->symbolic.isTypedef = false;
     280        newnode->type->symbolic.params = typeParams;
     281        newnode->type->symbolic.name = newnode->name;
    289282        return newnode;
    290283} // DeclarationNode::newTypeDecl
     
    299292        DeclarationNode *newnode = new DeclarationNode;
    300293        newnode->type = new TypeData( TypeData::Array );
    301         newnode->type->array->dimension = size;
    302         newnode->type->array->isStatic = isStatic;
    303         if ( newnode->type->array->dimension == 0 || newnode->type->array->dimension->isExpressionType<ConstantExpr *>() ) {
    304                 newnode->type->array->isVarLen = false;
     294        newnode->type->array.dimension = size;
     295        newnode->type->array.isStatic = isStatic;
     296        if ( newnode->type->array.dimension == 0 || newnode->type->array.dimension->isExpressionType<ConstantExpr *>() ) {
     297                newnode->type->array.isVarLen = false;
    305298        } else {
    306                 newnode->type->array->isVarLen = true;
     299                newnode->type->array.isVarLen = true;
    307300        } // if
    308301        return newnode->addQualifiers( qualifiers );
     
    312305        DeclarationNode *newnode = new DeclarationNode;
    313306        newnode->type = new TypeData( TypeData::Array );
    314         newnode->type->array->dimension = 0;
    315         newnode->type->array->isStatic = false;
    316         newnode->type->array->isVarLen = true;
     307        newnode->type->array.dimension = 0;
     308        newnode->type->array.isStatic = false;
     309        newnode->type->array.isVarLen = true;
    317310        return newnode->addQualifiers( qualifiers );
    318311}
     
    327320        DeclarationNode *newnode = new DeclarationNode;
    328321        newnode->type = new TypeData( TypeData::Tuple );
    329         newnode->type->tuple->members = members;
     322        newnode->type->tuple = members;
    330323        return newnode;
    331324}
     
    334327        DeclarationNode *newnode = new DeclarationNode;
    335328        newnode->type = new TypeData( TypeData::Typeof );
    336         newnode->type->typeexpr->expr = expr;
    337         return newnode;
    338 }
     329        newnode->type->typeexpr = expr;
     330        return newnode;
     331}
     332
     333DeclarationNode * DeclarationNode::newBuiltinType( BuiltinType bt ) {
     334        DeclarationNode *newnode = new DeclarationNode;
     335        newnode->type = new TypeData( TypeData::Builtin );
     336        newnode->builtin = bt;
     337        return newnode;
     338} // DeclarationNode::newBuiltinType
    339339
    340340DeclarationNode *DeclarationNode::newAttr( std::string *name, ExpressionNode *expr ) {
    341341        DeclarationNode *newnode = new DeclarationNode;
    342342        newnode->type = new TypeData( TypeData::Attr );
    343         newnode->type->attr->name = assign_strptr( name );
    344         newnode->type->attr->expr = expr;
     343        newnode->type->attr.name = assign_strptr( name );
     344        newnode->type->attr.expr = expr;
    345345        return newnode;
    346346}
     
    349349        DeclarationNode *newnode = new DeclarationNode;
    350350        newnode->type = new TypeData( TypeData::Attr );
    351         newnode->type->attr->name = assign_strptr( name );
    352         newnode->type->attr->type = type;
     351        newnode->type->attr.name = assign_strptr( name );
     352        newnode->type->attr.type = type;
    353353        return newnode;
    354354}
     
    407407                                } else {
    408408                                        if ( type->kind == TypeData::Aggregate ) {
    409                                                 type->aggregate->params = q->type->forall;
     409                                                type->aggregate.params = q->type->forall;
    410410                                                // change implicit typedef from TYPEDEFname to TYPEGENname
    411                                                 typedefTable.changeKind( type->aggregate->name, TypedefTable::TG );
     411                                                typedefTable.changeKind( type->aggregate.name, TypedefTable::TG );
    412412                                        } else {
    413413                                                type->forall = q->type->forall;
     
    457457                                if ( src->kind != TypeData::Unknown ) {
    458458                                        assert( src->kind == TypeData::Basic );
    459                                         dst->basic->modifiers.splice( dst->basic->modifiers.end(), src->basic->modifiers );
    460                                         dst->basic->typeSpec.splice( dst->basic->typeSpec.end(), src->basic->typeSpec );
     459                                        dst->basic.modifiers.splice( dst->basic.modifiers.end(), src->basic.modifiers );
     460                                        dst->basic.typeSpec.splice( dst->basic.typeSpec.end(), src->basic.typeSpec );
    461461                                } // if
    462462                                break;
     
    466466                                  case TypeData::Enum:
    467467                                        dst->base = new TypeData( TypeData::AggregateInst );
    468                                         dst->base->aggInst->aggregate = src;
     468                                        dst->base->aggInst.aggregate = src;
    469469                                        if ( src->kind == TypeData::Aggregate ) {
    470                                                 dst->base->aggInst->params = maybeClone( src->aggregate->actuals );
     470                                                dst->base->aggInst.params = maybeClone( src->aggregate.actuals );
    471471                                        } // if
    472472                                        dst->base->qualifiers |= src->qualifiers;
     
    495495                                if ( o->type->kind == TypeData::Aggregate || o->type->kind == TypeData::Enum ) {
    496496                                        type = new TypeData( TypeData::AggregateInst );
    497                                         type->aggInst->aggregate = o->type;
     497                                        type->aggInst.aggregate = o->type;
    498498                                        if ( o->type->kind == TypeData::Aggregate ) {
    499                                                 type->aggInst->params = maybeClone( o->type->aggregate->actuals );
     499                                                type->aggInst.params = maybeClone( o->type->aggregate.actuals );
    500500                                        } // if
    501501                                        type->qualifiers |= o->type->qualifiers;
     
    523523DeclarationNode *DeclarationNode::addTypedef() {
    524524        TypeData *newtype = new TypeData( TypeData::Symbolic );
    525         newtype->symbolic->params = 0;
    526         newtype->symbolic->isTypedef = true;
    527         newtype->symbolic->name = name;
     525        newtype->symbolic.params = 0;
     526        newtype->symbolic.isTypedef = true;
     527        newtype->symbolic.name = name;
    528528        newtype->base = type;
    529529        type = newtype;
     
    535535        switch ( type->kind ) {
    536536          case TypeData::Symbolic:
    537                 if ( type->symbolic->assertions ) {
    538                         type->symbolic->assertions->appendList( assertions );
     537                if ( type->symbolic.assertions ) {
     538                        type->symbolic.assertions->appendList( assertions );
    539539                } else {
    540                         type->symbolic->assertions = assertions;
     540                        type->symbolic.assertions = assertions;
    541541                } // if
    542542                break;
    543543          case TypeData::Variable:
    544                 if ( type->variable->assertions ) {
    545                         type->variable->assertions->appendList( assertions );
     544                if ( type->variable.assertions ) {
     545                        type->variable.assertions->appendList( assertions );
    546546                } else {
    547                         type->variable->assertions = assertions;
     547                        type->variable.assertions = assertions;
    548548                } // if
    549549                break;
     
    574574        assert( type );
    575575        assert( type->kind == TypeData::Function );
    576         assert( type->function->body == 0 );
    577         type->function->body = body;
    578         type->function->hasBody = true;
     576        assert( type->function.body == 0 );
     577        type->function.body = body;
     578        type->function.hasBody = true;
    579579        return this;
    580580}
     
    583583        assert( type );
    584584        assert( type->kind == TypeData::Function );
    585         assert( type->function->oldDeclList == 0 );
    586         type->function->oldDeclList = list;
     585        assert( type->function.oldDeclList == 0 );
     586        type->function.oldDeclList = list;
    587587        return this;
    588588}
     
    630630                          case TypeData::Enum:
    631631                                p->type->base = new TypeData( TypeData::AggregateInst );
    632                                 p->type->base->aggInst->aggregate = type;
     632                                p->type->base->aggInst.aggregate = type;
    633633                                if ( type->kind == TypeData::Aggregate ) {
    634                                         p->type->base->aggInst->params = maybeClone( type->aggregate->actuals );
     634                                        p->type->base->aggInst.params = maybeClone( type->aggregate.actuals );
    635635                                } // if
    636636                                p->type->base->qualifiers |= type->qualifiers;
     
    667667                          case TypeData::Enum:
    668668                                lastArray->base = new TypeData( TypeData::AggregateInst );
    669                                 lastArray->base->aggInst->aggregate = type;
     669                                lastArray->base->aggInst.aggregate = type;
    670670                                if ( type->kind == TypeData::Aggregate ) {
    671                                         lastArray->base->aggInst->params = maybeClone( type->aggregate->actuals );
     671                                        lastArray->base->aggInst.params = maybeClone( type->aggregate.actuals );
    672672                                } // if
    673673                                lastArray->base->qualifiers |= type->qualifiers;
     
    687687DeclarationNode *DeclarationNode::addParamList( DeclarationNode *params ) {
    688688        TypeData *ftype = new TypeData( TypeData::Function );
    689         ftype->function->params = params;
     689        ftype->function.params = params;
    690690        setBase( type, ftype );
    691691        return this;
     
    697697                        type->base = addIdListToType( type->base, ids );
    698698                } else {
    699                         type->function->idList = ids;
     699                        type->function.idList = ids;
    700700                } // if
    701701                return type;
    702702        } else {
    703703                TypeData *newtype = new TypeData( TypeData::Function );
    704                 newtype->function->idList = ids;
     704                newtype->function.idList = ids;
    705705                return newtype;
    706706        } // if
     
    727727        if ( newnode->type->kind == TypeData::AggregateInst ) {
    728728                // don't duplicate members
    729                 if ( newnode->type->aggInst->aggregate->kind == TypeData::Enum ) {
    730                         delete newnode->type->aggInst->aggregate->enumeration->constants;
    731                         newnode->type->aggInst->aggregate->enumeration->constants = 0;
     729                if ( newnode->type->aggInst.aggregate->kind == TypeData::Enum ) {
     730                        delete newnode->type->aggInst.aggregate->enumeration.constants;
     731                        newnode->type->aggInst.aggregate->enumeration.constants = 0;
    732732                } else {
    733                         assert( newnode->type->aggInst->aggregate->kind == TypeData::Aggregate );
    734                         delete newnode->type->aggInst->aggregate->aggregate->fields;
    735                         newnode->type->aggInst->aggregate->aggregate->fields = 0;
     733                        assert( newnode->type->aggInst.aggregate->kind == TypeData::Aggregate );
     734                        delete newnode->type->aggInst.aggregate->aggregate.fields;
     735                        newnode->type->aggInst.aggregate->aggregate.fields = 0;
    736736                } // if
    737737        } // if
     
    753753                        if ( newType->kind == TypeData::AggregateInst ) {
    754754                                // don't duplicate members
    755                                 if ( newType->aggInst->aggregate->kind == TypeData::Enum ) {
    756                                         delete newType->aggInst->aggregate->enumeration->constants;
    757                                         newType->aggInst->aggregate->enumeration->constants = 0;
     755                                if ( newType->aggInst.aggregate->kind == TypeData::Enum ) {
     756                                        delete newType->aggInst.aggregate->enumeration.constants;
     757                                        newType->aggInst.aggregate->enumeration.constants = 0;
    758758                                } else {
    759                                         assert( newType->aggInst->aggregate->kind == TypeData::Aggregate );
    760                                         delete newType->aggInst->aggregate->aggregate->fields;
    761                                         newType->aggInst->aggregate->aggregate->fields = 0;
     759                                        assert( newType->aggInst.aggregate->kind == TypeData::Aggregate );
     760                                        delete newType->aggInst.aggregate->aggregate.fields;
     761                                        newType->aggInst.aggregate->aggregate.fields = 0;
    762762                                } // if
    763763                        } // if
     
    909909        switch ( type->kind ) {
    910910          case TypeData::Enum:
    911                 return new EnumInstType( buildQualifiers( type ), type->enumeration->name );
     911                return new EnumInstType( buildQualifiers( type ), type->enumeration.name );
    912912          case TypeData::Aggregate: {
    913913                  ReferenceToType *ret;
    914                   switch ( type->aggregate->kind ) {
     914                  switch ( type->aggregate.kind ) {
    915915                        case DeclarationNode::Struct:
    916                           ret = new StructInstType( buildQualifiers( type ), type->aggregate->name );
     916                          ret = new StructInstType( buildQualifiers( type ), type->aggregate.name );
    917917                          break;
    918918                        case DeclarationNode::Union:
    919                           ret = new UnionInstType( buildQualifiers( type ), type->aggregate->name );
     919                          ret = new UnionInstType( buildQualifiers( type ), type->aggregate.name );
    920920                          break;
    921921                        case DeclarationNode::Trait:
    922                           ret = new TraitInstType( buildQualifiers( type ), type->aggregate->name );
     922                          ret = new TraitInstType( buildQualifiers( type ), type->aggregate.name );
    923923                          break;
    924924                        default:
    925925                          assert( false );
    926926                  } // switch
    927                   buildList( type->aggregate->actuals, ret->get_parameters() );
     927                  buildList( type->aggregate.actuals, ret->get_parameters() );
    928928                  return ret;
    929929          }
    930930          case TypeData::Symbolic: {
    931                   TypeInstType *ret = new TypeInstType( buildQualifiers( type ), type->symbolic->name, false );
    932                   buildList( type->symbolic->actuals, ret->get_parameters() );
     931                  TypeInstType *ret = new TypeInstType( buildQualifiers( type ), type->symbolic.name, false );
     932                  buildList( type->symbolic.actuals, ret->get_parameters() );
    933933                  return ret;
    934934          }
  • src/Parser/ParseNode.h

    rb542bfb r8f6f47d7  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug 28 21:14:51 2016
    13 // Update Count     : 575
     12// Last Modified On : Mon Aug 29 10:19:01 2016
     13// Update Count     : 579
    1414//
    1515
     
    290290        // bool buildFuncSpecifier( StorageClass key ) const;
    291291
     292        BuiltinType builtin;
     293
    292294        TypeData *type;
    293295        std::string name;
  • src/Parser/TypeData.cc

    rb542bfb r8f6f47d7  
    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 15:54:55 2016
     13// Update Count     : 266
    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;
    8686                break;
    8787          case Builtin:
    88                 builtin = new Builtin_t;
     88                // builtin = new Builtin_t;
    8989                break;
    9090          case Attr:
    91                 attr = new Attr_t;
    92                 attr->expr = 0;
    93                 attr->type = 0;
     91                // attr = new Attr_t;
     92                attr.expr = nullptr;
     93                attr.type = nullptr;
    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;
    156156          case Builtin:
    157                 delete builtin;
     157                // delete builtin;
    158158                break;
    159159          case Attr:
    160                 delete attr->expr;
    161                 delete attr->type;
    162                 delete attr;
     160                delete attr.expr;
     161                delete attr.type;
     162                // delete attr;
    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                newtype->variable.assertions = maybeClone( variable.assertions );
     222                newtype->variable.name = variable.name;
     223                newtype->variable.tyClass = variable.tyClass;
    224224                break;
    225225          case Tuple:
    226                 newtype->tuple->members = maybeClone( tuple->members );
     226                newtype->tuple = maybeClone( tuple );
    227227                break;
    228228          case Typeof:
    229                 newtype->typeexpr->expr = maybeClone( typeexpr->expr );
     229                newtype->typeexpr = maybeClone( typeexpr );
    230230                break;
    231231          case Builtin:
    232                 newtype->builtin->type = builtin->type;
     232                // newtype->builtin = builtin;
    233233                break;
    234234          case Attr:
    235                 newtype->attr->expr = maybeClone( attr->expr );
    236                 newtype->attr->type = maybeClone( attr->type );
     235                newtype->attr.expr = maybeClone( attr.expr );
     236                newtype->attr.type = maybeClone( attr.type );
    237237                break;
    238238        } // switch
     
    268268                break;
    269269          case Basic:
    270                 printEnums( basic->modifiers.begin(), basic->modifiers.end(), DeclarationNode::modifierName, os );
    271                 printEnums( basic->typeSpec.begin(), basic->typeSpec.end(), DeclarationNode::basicTypeName, os );
     270                printEnums( basic.modifiers.begin(), basic.modifiers.end(), DeclarationNode::modifierName, os );
     271                printEnums( basic.typeSpec.begin(), basic.typeSpec.end(), DeclarationNode::basicTypeName, os );
    272272                break;
    273273          case Array:
    274                 if ( array->isStatic ) {
     274                if ( array.isStatic ) {
    275275                        os << "static ";
    276276                } // if
    277                 if ( array->dimension ) {
     277                if ( array.dimension ) {
    278278                        os << "array of ";
    279                         array->dimension->printOneLine( os, indent );
    280                 } else if ( array->isVarLen ) {
     279                        array.dimension->printOneLine( os, indent );
     280                } else if ( array.isVarLen ) {
    281281                        os << "variable-length array of ";
    282282                } else {
     
    289289          case Function:
    290290                os << "function" << endl;
    291                 if ( function->params ) {
     291                if ( function.params ) {
    292292                        os << string( indent + 2, ' ' ) << "with parameters " << endl;
    293                         function->params->printList( os, indent + 4 );
     293                        function.params->printList( os, indent + 4 );
    294294                } else {
    295295                        os << string( indent + 2, ' ' ) << "with no parameters " << endl;
    296296                } // if
    297                 if ( function->idList ) {
     297                if ( function.idList ) {
    298298                        os << string( indent + 2, ' ' ) << "with old-style identifier list " << endl;
    299                         function->idList->printList( os, indent + 4 );
    300                 } // if
    301                 if ( function->oldDeclList ) {
     299                        function.idList->printList( os, indent + 4 );
     300                } // if
     301                if ( function.oldDeclList ) {
    302302                        os << string( indent + 2, ' ' ) << "with old-style declaration list " << endl;
    303                         function->oldDeclList->printList( os, indent + 4 );
     303                        function.oldDeclList->printList( os, indent + 4 );
    304304                } // if
    305305                os << string( indent + 2, ' ' ) << "returning ";
     
    310310                } // if
    311311                os << endl;
    312                 if ( function->hasBody ) {
     312                if ( function.hasBody ) {
    313313                        os << string( indent + 2, ' ' ) << "with body " << endl;
    314314                } // if
    315                 if ( function->body ) {
    316                         function->body->printList( os, indent + 2 );
     315                if ( function.body ) {
     316                        function.body->printList( os, indent + 2 );
    317317                } // if
    318318                break;
    319319          case Aggregate:
    320                 os << DeclarationNode::aggregateName[ aggregate->kind ] << ' ' << aggregate->name << endl;
    321                 if ( aggregate->params ) {
     320                os << DeclarationNode::aggregateName[ aggregate.kind ] << ' ' << aggregate.name << endl;
     321                if ( aggregate.params ) {
    322322                        os << string( indent + 2, ' ' ) << "with type parameters " << endl;
    323                         aggregate->params->printList( os, indent + 4 );
    324                 } // if
    325                 if ( aggregate->actuals ) {
     323                        aggregate.params->printList( os, indent + 4 );
     324                } // if
     325                if ( aggregate.actuals ) {
    326326                        os << string( indent + 2, ' ' ) << "instantiated with actual parameters " << endl;
    327                         aggregate->actuals->printList( os, indent + 4 );
    328                 } // if
    329                 if ( aggregate->fields ) {
     327                        aggregate.actuals->printList( os, indent + 4 );
     328                } // if
     329                if ( aggregate.fields ) {
    330330                        os << string( indent + 2, ' ' ) << "with members " << endl;
    331                         aggregate->fields->printList( os, indent + 4 );
    332                 } // if
    333                 if ( aggregate->body ) {
     331                        aggregate.fields->printList( os, indent + 4 );
     332                } // if
     333                if ( aggregate.body ) {
    334334                        os << string( indent + 2, ' ' ) << " with body " << endl;
    335335                } // if
    336336                break;
    337337          case AggregateInst:
    338                 if ( aggInst->aggregate ) {
     338                if ( aggInst.aggregate ) {
    339339                        os << "instance of " ;
    340                         aggInst->aggregate->print( os, indent );
     340                        aggInst.aggregate->print( os, indent );
    341341                } else {
    342342                        os << "instance of an unspecified aggregate ";
    343343                } // if
    344                 if ( aggInst->params ) {
     344                if ( aggInst.params ) {
    345345                        os << string( indent + 2, ' ' ) << "with parameters " << endl;
    346                         aggInst->params->printList( os, indent + 2 );
     346                        aggInst.params->printList( os, indent + 2 );
    347347                } // if
    348348                break;
    349349          case Enum:
    350350                os << "enumeration ";
    351                 if ( enumeration->constants ) {
     351                if ( enumeration.constants ) {
    352352                        os << "with constants" << endl;
    353                         enumeration->constants->printList( os, indent + 2 );
     353                        enumeration.constants->printList( os, indent + 2 );
    354354                } // if
    355355                break;
    356356          case SymbolicInst:
    357                 os << "instance of type " << symbolic->name;
    358                 if ( symbolic->actuals ) {
     357                os << "instance of type " << symbolic.name;
     358                if ( symbolic.actuals ) {
    359359                        os << " with parameters" << endl;
    360                         symbolic->actuals->printList( os, indent + 2 );
     360                        symbolic.actuals->printList( os, indent + 2 );
    361361                } // if
    362362                break;
    363363          case Symbolic:
    364                 if ( symbolic->isTypedef ) {
     364                if ( symbolic.isTypedef ) {
    365365                        os << "typedef definition ";
    366366                } else {
    367367                        os << "type definition ";
    368368                } // if
    369                 if ( symbolic->params ) {
     369                if ( symbolic.params ) {
    370370                        os << endl << string( indent + 2, ' ' ) << "with parameters" << endl;
    371                         symbolic->params->printList( os, indent + 2 );
    372                 } // if
    373                 if ( symbolic->assertions ) {
     371                        symbolic.params->printList( os, indent + 2 );
     372                } // if
     373                if ( symbolic.assertions ) {
    374374                        os << endl << string( indent + 2, ' ' ) << "with assertions" << endl;
    375                         symbolic->assertions->printList( os, indent + 4 );
     375                        symbolic.assertions->printList( os, indent + 4 );
    376376                        os << string( indent + 2, ' ' );
    377377                } // if
     
    382382                break;
    383383          case Variable:
    384                 os << DeclarationNode::typeClassName[ variable->tyClass ] << " variable ";
    385                 if ( variable->assertions ) {
     384                os << DeclarationNode::typeClassName[ variable.tyClass ] << " variable ";
     385                if ( variable.assertions ) {
    386386                        os << endl << string( indent + 2, ' ' ) << "with assertions" << endl;
    387                         variable->assertions->printList( os, indent + 4 );
     387                        variable.assertions->printList( os, indent + 4 );
    388388                        os << string( indent + 2, ' ' );
    389389                } // if
     
    391391          case Tuple:
    392392                os << "tuple ";
    393                 if ( tuple->members ) {
     393                if ( tuple ) {
    394394                        os << "with members " << endl;
    395                         tuple->members->printList( os, indent + 2 );
     395                        tuple->printList( os, indent + 2 );
    396396                } // if
    397397                break;
    398398          case Typeof:
    399399                os << "type-of expression ";
    400                 if ( typeexpr->expr ) {
    401                         typeexpr->expr->print( os, indent + 2 );
     400                if ( typeexpr ) {
     401                        typeexpr->print( os, indent + 2 );
    402402                } // if
    403403                break;
    404404          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 );
     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 );
    411411                } // if
    412412                break;
     
    494494        switch ( td->kind ) {
    495495          case TypeData::Aggregate:
    496                 if ( ! toplevel && td->aggregate->fields ) {
     496                if ( ! toplevel && td->aggregate.fields ) {
    497497                        ret = td->clone();
    498498                } // if
    499499                break;
    500500          case TypeData::Enum:
    501                 if ( ! toplevel && td->enumeration->constants ) {
     501                if ( ! toplevel && td->enumeration.constants ) {
    502502                        ret = td->clone();
    503503                } // if
    504504                break;
    505505          case TypeData::AggregateInst:
    506                 if ( td->aggInst->aggregate ) {
    507                         ret = typeextractAggregate( td->aggInst->aggregate, false );
     506                if ( td->aggInst.aggregate ) {
     507                        ret = typeextractAggregate( td->aggInst.aggregate, false );
    508508                } // if
    509509                break;
     
    535535        BasicType::Kind ret;
    536536
    537         for ( std::list< DeclarationNode::BasicType >::const_iterator i = td->basic->typeSpec.begin(); i != td->basic->typeSpec.end(); ++i ) {
     537        for ( std::list< DeclarationNode::BasicType >::const_iterator i = td->basic.typeSpec.begin(); i != td->basic.typeSpec.end(); ++i ) {
    538538                if ( ! init ) {
    539539                        init = true;
    540540                        if ( *i == DeclarationNode::Void ) {
    541                                 if ( td->basic->typeSpec.size() != 1 || ! td->basic->modifiers.empty() ) {
     541                                if ( td->basic.typeSpec.size() != 1 || ! td->basic.modifiers.empty() ) {
    542542                                        throw SemanticError( "invalid type specifier \"void\" in type: ", td );
    543543                                } else {
     
    611611        } // for
    612612
    613         for ( std::list< DeclarationNode::Modifier >::const_iterator i = td->basic->modifiers.begin(); i != td->basic->modifiers.end(); ++i ) {
     613        for ( std::list< DeclarationNode::Modifier >::const_iterator i = td->basic.modifiers.begin(); i != td->basic.modifiers.end(); ++i ) {
    614614                switch ( *i ) {
    615615                  case DeclarationNode::Long:
     
    746746        ArrayType * at;
    747747        if ( td->base ) {
    748                 at = new ArrayType( buildQualifiers( td ), typebuild( td->base ), maybeBuild< Expression >( td->array->dimension ),
    749                                                         td->array->isVarLen, td->array->isStatic );
     748                at = new ArrayType( buildQualifiers( td ), typebuild( td->base ), maybeBuild< Expression >( td->array.dimension ),
     749                                                        td->array.isVarLen, td->array.isStatic );
    750750        } else {
    751751                at = new ArrayType( buildQualifiers( td ), new BasicType( Type::Qualifiers(), BasicType::SignedInt ),
    752                                                         maybeBuild< Expression >( td->array->dimension ), td->array->isVarLen, td->array->isStatic );
     752                                                        maybeBuild< Expression >( td->array.dimension ), td->array.isVarLen, td->array.isStatic );
    753753        } // if
    754754        buildForall( td->forall, at->get_forall() );
     
    759759        assert( td->kind == TypeData::Aggregate );
    760760        AggregateDecl * at;
    761         switch ( td->aggregate->kind ) {
     761        switch ( td->aggregate.kind ) {
    762762          case DeclarationNode::Struct:
    763                 at = new StructDecl( td->aggregate->name );
    764                 buildForall( td->aggregate->params, at->get_parameters() );
     763                at = new StructDecl( td->aggregate.name );
     764                buildForall( td->aggregate.params, at->get_parameters() );
    765765                break;
    766766          case DeclarationNode::Union:
    767                 at = new UnionDecl( td->aggregate->name );
    768                 buildForall( td->aggregate->params, at->get_parameters() );
     767                at = new UnionDecl( td->aggregate.name );
     768                buildForall( td->aggregate.params, at->get_parameters() );
    769769                break;
    770770          case DeclarationNode::Trait:
    771                 at = new TraitDecl( td->aggregate->name );
    772                 buildList( td->aggregate->params, at->get_parameters() );
     771                at = new TraitDecl( td->aggregate.name );
     772                buildList( td->aggregate.params, at->get_parameters() );
    773773                break;
    774774          default:
     
    776776        } // switch
    777777
    778         buildList( td->aggregate->fields, at->get_members() );
    779         at->set_body( td->aggregate->body );
     778        buildList( td->aggregate.fields, at->get_members() );
     779        at->set_body( td->aggregate.body );
    780780
    781781        return at;
     
    786786
    787787        ReferenceToType * ret;
    788         if ( td->aggInst->aggregate->kind == TypeData::Enum ) {
    789                 ret = new EnumInstType( buildQualifiers( td ), td->aggInst->aggregate->enumeration->name );
     788        if ( td->aggInst.aggregate->kind == TypeData::Enum ) {
     789                ret = new EnumInstType( buildQualifiers( td ), td->aggInst.aggregate->enumeration.name );
    790790        } else {
    791                 assert( td->aggInst->aggregate->kind == TypeData::Aggregate );
    792                 switch ( td->aggInst->aggregate->aggregate->kind ) {
     791                assert( td->aggInst.aggregate->kind == TypeData::Aggregate );
     792                switch ( td->aggInst.aggregate->aggregate.kind ) {
    793793                  case DeclarationNode::Struct:
    794                         ret = new StructInstType( buildQualifiers( td ), td->aggInst->aggregate->aggregate->name );
     794                        ret = new StructInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name );
    795795                        break;
    796796                  case DeclarationNode::Union:
    797                         ret = new UnionInstType( buildQualifiers( td ), td->aggInst->aggregate->aggregate->name );
     797                        ret = new UnionInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name );
    798798                        break;
    799799                  case DeclarationNode::Trait:
    800                         ret = new TraitInstType( buildQualifiers( td ), td->aggInst->aggregate->aggregate->name );
     800                        ret = new TraitInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name );
    801801                        break;
    802802                  default:
     
    804804                } // switch
    805805        } // if
    806         buildList( td->aggInst->params, ret->get_parameters() );
     806        buildList( td->aggInst.params, ret->get_parameters() );
    807807        buildForall( td->forall, ret->get_forall() );
    808808        return ret;
     
    813813        NamedTypeDecl * ret;
    814814        assert( td->base );
    815         if ( td->symbolic->isTypedef ) {
     815        if ( td->symbolic.isTypedef ) {
    816816                ret = new TypedefDecl( name, sc, typebuild( td->base ) );
    817817        } else {
    818818                ret = new TypeDecl( name, sc, typebuild( td->base ), TypeDecl::Any );
    819819        } // if
    820         buildList( td->symbolic->params, ret->get_parameters() );
    821         buildList( td->symbolic->assertions, ret->get_assertions() );
     820        buildList( td->symbolic.params, ret->get_parameters() );
     821        buildList( td->symbolic.assertions, ret->get_assertions() );
    822822        return ret;
    823823} // buildSymbolic
     
    827827        static const TypeDecl::Kind kindMap[] = { TypeDecl::Any, TypeDecl::Ftype, TypeDecl::Dtype };
    828828
    829         TypeDecl * ret = new TypeDecl( td->variable->name, DeclarationNode::NoStorageClass, 0, kindMap[ td->variable->tyClass ] );
    830         buildList( td->variable->assertions, ret->get_assertions() );
     829        TypeDecl * ret = new TypeDecl( td->variable.name, DeclarationNode::NoStorageClass, 0, kindMap[ td->variable.tyClass ] );
     830        buildList( td->variable.assertions, ret->get_assertions() );
    831831        return ret;
    832832} // buildSymbolic
     
    834834EnumDecl * buildEnum( const TypeData * td ) {
    835835        assert( td->kind == TypeData::Enum );
    836         EnumDecl * ret = new EnumDecl( td->enumeration->name );
    837         buildList( td->enumeration->constants, ret->get_members() );
     836        EnumDecl * ret = new EnumDecl( td->enumeration.name );
     837        buildList( td->enumeration.constants, ret->get_members() );
    838838        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 ) {
     839        for ( const DeclarationNode * cur = td->enumeration. constants; cur != nullptr; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ), ++members ) {
    840840                if ( cur->has_enumeratorValue() ) {
    841841                        ObjectDecl * member = dynamic_cast< ObjectDecl * >(* members);
     
    848848TypeInstType * buildSymbolicInst( const TypeData * td ) {
    849849        assert( td->kind == TypeData::SymbolicInst );
    850         TypeInstType * ret = new TypeInstType( buildQualifiers( td ), td->symbolic->name, false );
    851         buildList( td->symbolic->actuals, ret->get_parameters() );
     850        TypeInstType * ret = new TypeInstType( buildQualifiers( td ), td->symbolic.name, false );
     851        buildList( td->symbolic.actuals, ret->get_parameters() );
    852852        buildForall( td->forall, ret->get_forall() );
    853853        return ret;
     
    857857        assert( td->kind == TypeData::Tuple );
    858858        TupleType * ret = new TupleType( buildQualifiers( td ) );
    859         buildTypeList( td->tuple->members, ret->get_types() );
     859        buildTypeList( td->tuple, ret->get_types() );
    860860        buildForall( td->forall, ret->get_forall() );
    861861        return ret;
     
    865865        assert( td->kind == TypeData::Typeof );
    866866        assert( td->typeexpr );
    867         assert( td->typeexpr->expr );
    868         return new TypeofType( buildQualifiers( td ), td->typeexpr->expr->build() );
     867        // assert( td->typeexpr->expr );
     868        return new TypeofType( buildQualifiers( td ), td->typeexpr->build() );
    869869} // buildTypeof
    870870
    871871AttrType * buildAttr( const TypeData * td ) {
    872872        assert( td->kind == TypeData::Attr );
    873         assert( td->attr );
     873        // assert( td->attr );
    874874        AttrType * ret;
    875         if ( td->attr->expr ) {
    876                 ret = new AttrType( buildQualifiers( td ), td->attr->name, td->attr->expr->build() );
     875        if ( td->attr.expr ) {
     876                ret = new AttrType( buildQualifiers( td ), td->attr.name, td->attr.expr->build() );
    877877        } else {
    878                 assert( td->attr->type );
    879                 ret = new AttrType( buildQualifiers( td ), td->attr->name, td->attr->type->buildType() );
     878                assert( td->attr.type );
     879                ret = new AttrType( buildQualifiers( td ), td->attr.name, td->attr.type->buildType() );
    880880        } // if
    881881        return ret;
     
    885885        if ( td->kind == TypeData::Function ) {
    886886                FunctionDecl * decl;
    887                 if ( td->function->hasBody ) {
    888                         if ( td->function->body ) {
    889                                 Statement * stmt = td->function->body->build();
     887                if ( td->function.hasBody ) {
     888                        if ( td->function.body ) {
     889                                Statement * stmt = td->function.body->build();
    890890                                CompoundStmt * body = dynamic_cast< CompoundStmt* >( stmt );
    891891                                assert( body );
     
    898898                        decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), 0, isInline, isNoreturn );
    899899                } // if
    900                 for ( DeclarationNode * cur = td->function->idList; cur != 0; cur = dynamic_cast< DeclarationNode* >( cur->get_next() ) ) {
     900                for ( DeclarationNode * cur = td->function.idList; cur != 0; cur = dynamic_cast< DeclarationNode* >( cur->get_next() ) ) {
    901901                        if ( cur->get_name() != "" ) {
    902902                                decl->get_oldIdents().insert( decl->get_oldIdents().end(), cur->get_name() );
    903903                        } // if
    904904                } // for
    905                 buildList( td->function->oldDeclList, decl->get_oldDecls() );
     905                buildList( td->function.oldDeclList, decl->get_oldDecls() );
    906906                return decl;
    907907        } else if ( td->kind == TypeData::Aggregate ) {
     
    921921FunctionType * buildFunction( const TypeData * td ) {
    922922        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;
     923        bool hasEllipsis = td->function.params ? td->function.params->get_hasEllipsis() : true;
     924        if ( ! td->function.params ) hasEllipsis = ! td->function.newStyle;
    925925        FunctionType * ft = new FunctionType( buildQualifiers( td ), hasEllipsis );
    926         buildList( td->function->params, ft->get_parameters() );
     926        buildList( td->function.params, ft->get_parameters() );
    927927        buildForall( td->forall, ft->get_forall() );
    928928        if ( td->base ) {
    929929                switch ( td->base->kind ) {
    930930                  case TypeData::Tuple:
    931                         buildList( td->base->tuple->members, ft->get_returnVals() );
     931                        buildList( td->base->tuple, ft->get_returnVals() );
    932932                        break;
    933933                  default:
  • src/Parser/TypeData.h

    rb542bfb r8f6f47d7  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug 28 22:39:00 2016
    13 // Update Count     : 85
     12// Last Modified On : Mon Aug 29 15:54:00 2016
     13// Update Count     : 106
    1414//
    1515
     
    7979        };
    8080
    81         struct Tuple_t {
    82                 DeclarationNode * members;
    83         };
     81        // struct Tuple_t {
     82        //      DeclarationNode * members;
     83        // };
    8484 
    85         struct Typeof_t {
    86                 ExpressionNode * expr;
    87         };
     85        // struct Typeof_t {
     86        //      ExpressionNode * expr;
     87        // };
    8888
    89         struct Builtin_t {
    90                 DeclarationNode::BuiltinType type;
    91         };
     89        // struct Builtin_t {
     90        //      DeclarationNode::BuiltinType type;
     91        // };
    9292
    9393        struct Attr_t {
     
    102102        DeclarationNode * forall;
    103103
    104         union {
    105                 Basic_t * basic;
    106                 Aggregate_t * aggregate;
    107                 AggInst_t * aggInst;
    108                 Array_t * array;
    109                 Enumeration_t * enumeration;
    110                 Function_t * function;
    111                 Symbolic_t * symbolic;
    112                 Variable_t * variable;
    113                 Tuple_t * tuple;
    114                 Typeof_t * typeexpr;
    115                 Attr_t * attr;
    116                 Builtin_t * builtin;
    117         };
     104                Basic_t basic;
     105                Aggregate_t aggregate;
     106                AggInst_t aggInst;
     107                Array_t array;
     108                Enumeration_t enumeration;
     109                Function_t function;
     110                Symbolic_t symbolic;
     111                Variable_t variable;
     112                DeclarationNode * tuple;
     113                ExpressionNode * typeexpr;
     114                Attr_t attr;
     115                // DeclarationNode::BuiltinType builtin;
    118116
    119117        TypeData( Kind k = Unknown );
Note: See TracChangeset for help on using the changeset viewer.