Changes in src/Parser/DeclarationNode.cc [fa4805f:ce8c12f]
- File:
-
- 1 edited
-
src/Parser/DeclarationNode.cc (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
rfa4805f rce8c12f 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 12:34:05 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Wed Jun 28 15:27:00201713 // Update Count : 101 911 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 17 15:46:33 2017 13 // Update Count : 1018 14 14 // 15 15 … … 57 57 variable.tyClass = NoTypeClass; 58 58 variable.assertions = nullptr; 59 variable.initializer = nullptr;60 59 61 60 // attr.name = nullptr; … … 71 70 // delete variable.name; 72 71 delete variable.assertions; 73 delete variable.initializer;74 72 75 73 delete type; … … 103 101 newnode->variable.tyClass = variable.tyClass; 104 102 newnode->variable.assertions = maybeClone( variable.assertions ); 105 newnode->variable.initializer = maybeClone( variable.initializer );106 103 107 104 // newnode->attr.name = attr.name ? new string( *attr.name ) : nullptr; … … 329 326 } // DeclarationNode::newTypeDecl 330 327 331 DeclarationNode * DeclarationNode::newPointer( DeclarationNode * qualifiers ) {332 DeclarationNode * newnode = new DeclarationNode; 333 newnode->type = new TypeData( TypeData::Pointer);328 DeclarationNode * DeclarationNode::newPointer( DeclarationNode * qualifiers, OperKinds kind ) { 329 DeclarationNode * newnode = new DeclarationNode; 330 newnode->type = new TypeData( kind == OperKinds::PointTo ? TypeData::Pointer : TypeData::Reference ); 334 331 if ( qualifiers ) { 335 332 return newnode->addQualifiers( qualifiers ); … … 748 745 DeclarationNode * DeclarationNode::addPointer( DeclarationNode * p ) { 749 746 if ( p ) { 750 assert( p->type->kind == TypeData::Pointer );747 assert( p->type->kind == TypeData::Pointer || TypeData::Reference ); 751 748 setBase( p->type ); 752 749 p->type = nullptr; … … 857 854 DeclarationNode * DeclarationNode::addInitializer( InitializerNode * init ) { 858 855 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;865 856 return this; 866 857 } … … 1023 1014 assertf( sizeof(kindMap)/sizeof(kindMap[0] == NoTypeClass-1), "DeclarationNode::build: kindMap is out of sync." ); 1024 1015 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 ] ); 1026 1017 buildList( variable.assertions, ret->get_assertions() ); 1027 1018 return ret; … … 1063 1054 case TypeData::Enum: 1064 1055 case TypeData::Aggregate: { 1065 ReferenceToType * ret = buildComAggInst( type, attributes , linkage);1056 ReferenceToType * ret = buildComAggInst( type, attributes ); 1066 1057 buildList( type->aggregate.actuals, ret->get_parameters() ); 1067 1058 return ret;
Note:
See TracChangeset
for help on using the changeset viewer.