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