Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rfa4805f rce8c12f  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 12:34:05 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:27:00 2017
    13 // Update Count     : 1019
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Mar 17 15:46:33 2017
     13// Update Count     : 1018
    1414//
    1515
     
    5757        variable.tyClass = NoTypeClass;
    5858        variable.assertions = nullptr;
    59         variable.initializer = nullptr;
    6059
    6160//      attr.name = nullptr;
     
    7170//      delete variable.name;
    7271        delete variable.assertions;
    73         delete variable.initializer;
    7472
    7573        delete type;
     
    103101        newnode->variable.tyClass = variable.tyClass;
    104102        newnode->variable.assertions = maybeClone( variable.assertions );
    105         newnode->variable.initializer = maybeClone( variable.initializer );
    106103
    107104//      newnode->attr.name = attr.name ? new string( *attr.name ) : nullptr;
     
    329326} // DeclarationNode::newTypeDecl
    330327
    331 DeclarationNode * DeclarationNode::newPointer( DeclarationNode * qualifiers ) {
    332         DeclarationNode * newnode = new DeclarationNode;
    333         newnode->type = new TypeData( TypeData::Pointer );
     328DeclarationNode * DeclarationNode::newPointer( DeclarationNode * qualifiers, OperKinds kind ) {
     329        DeclarationNode * newnode = new DeclarationNode;
     330        newnode->type = new TypeData( kind == OperKinds::PointTo ? TypeData::Pointer : TypeData::Reference );
    334331        if ( qualifiers ) {
    335332                return newnode->addQualifiers( qualifiers );
     
    748745DeclarationNode * DeclarationNode::addPointer( DeclarationNode * p ) {
    749746        if ( p ) {
    750                 assert( p->type->kind == TypeData::Pointer );
     747                assert( p->type->kind == TypeData::Pointer || TypeData::Reference );
    751748                setBase( p->type );
    752749                p->type = nullptr;
     
    857854DeclarationNode * DeclarationNode::addInitializer( InitializerNode * init ) {
    858855        initializer = init;
    859         return this;
    860 }
    861 
    862 DeclarationNode * DeclarationNode::addTypeInitializer( DeclarationNode * init ) {
    863         assertf( variable.tyClass != NoTypeClass, "Called addTypeInitializer on something that isn't a type variable." );
    864         variable.initializer = init;
    865856        return this;
    866857}
     
    10231014                assertf( sizeof(kindMap)/sizeof(kindMap[0] == NoTypeClass-1), "DeclarationNode::build: kindMap is out of sync." );
    10241015                assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." );
    1025                 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.initializer ? variable.initializer->buildType() : nullptr );
     1016                TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ] );
    10261017                buildList( variable.assertions, ret->get_assertions() );
    10271018                return ret;
     
    10631054          case TypeData::Enum:
    10641055          case TypeData::Aggregate: {
    1065                   ReferenceToType * ret = buildComAggInst( type, attributes, linkage );
     1056                  ReferenceToType * ret = buildComAggInst( type, attributes );
    10661057                  buildList( type->aggregate.actuals, ret->get_parameters() );
    10671058                  return ret;
Note: See TracChangeset for help on using the changeset viewer.