Changes in src/Parser/DeclarationNode.cc [d9bad51:67467a3]
- File:
-
- 1 edited
-
src/Parser/DeclarationNode.cc (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
rd9bad51 r67467a3 53 53 linkage( ::linkage ) { 54 54 55 // variable.name = nullptr; 55 56 variable.tyClass = ast::TypeDecl::NUMBER_OF_KINDS; 56 57 variable.assertions = nullptr; … … 64 65 delete name; 65 66 67 // delete variable.name; 66 68 delete variable.assertions; 67 69 delete variable.initializer; 68 70 69 delete type;71 // delete type; 70 72 delete bitfieldWidth; 71 73 … … 98 100 newnode->error = error; 99 101 102 // newnode->variable.name = variable.name ? new string( *variable.name ) : nullptr; 100 103 newnode->variable.tyClass = variable.tyClass; 101 104 newnode->variable.assertions = maybeCopy( variable.assertions ); … … 225 228 } // DeclarationNode::newEnumValueGeneric 226 229 227 DeclarationNode * DeclarationNode::newEnumInLine( const st d::string *name ) {228 DeclarationNode * newnode = newName( n ame);230 DeclarationNode * DeclarationNode::newEnumInLine( const string name ) { 231 DeclarationNode * newnode = newName( new std::string(name) ); 229 232 newnode->enumInLine = true; 230 233 return newnode; … … 457 460 SemanticWarning( yylloc, Warning::BadQualifiersZeroOne, TypeData::builtinTypeNames[builtin] ); 458 461 } // if 459 type = ::addQualifiers( type, q->type );462 type = ::addQualifiers( q->type, type ); 460 463 q->type = nullptr; 461 464 … … 470 473 copySpecifiers( o, copyattr ); 471 474 if ( o->type ) { 472 type = ::addType( type, o->type, o->attributes );475 type = ::addType( o->type, type, o->attributes ); 473 476 o->type = nullptr; 474 477 } // if … … 581 584 DeclarationNode * DeclarationNode::addAssertions( DeclarationNode * assertions ) { 582 585 if ( variable.tyClass != ast::TypeDecl::NUMBER_OF_KINDS ) { 583 extend( variable.assertions, assertions ); 586 if ( variable.assertions ) { 587 variable.assertions->set_last( assertions ); 588 } else { 589 variable.assertions = assertions; 590 } // if 584 591 return this; 585 592 } // if 586 593 587 594 assert( type ); 588 assert( TypeData::Symbolic == type->kind ); 589 extend( type->symbolic.assertions, assertions ); 595 switch ( type->kind ) { 596 case TypeData::Symbolic: 597 if ( type->symbolic.assertions ) { 598 type->symbolic.assertions->set_last( assertions ); 599 } else { 600 type->symbolic.assertions = assertions; 601 } // if 602 break; 603 default: 604 assert( false ); 605 } // switch 590 606 591 607 return this; … … 672 688 673 689 DeclarationNode * DeclarationNode::addNewPointer( DeclarationNode * p ) { 674 if ( !p ) return this; 675 assert( p->type->kind == TypeData::Pointer || p->type->kind == TypeData::Reference ); 676 if ( type ) { 677 p->type->base = makeNewBase( type ); 678 type = nullptr; 679 } // if 680 delete this; 681 return p; 690 if ( p ) { 691 assert( p->type->kind == TypeData::Pointer || p->type->kind == TypeData::Reference ); 692 if ( type ) { 693 p->type->base = makeNewBase( type ); 694 type = nullptr; 695 } // if 696 delete this; 697 return p; 698 } else { 699 return this; 700 } // if 682 701 } 683 702 684 703 DeclarationNode * DeclarationNode::addNewArray( DeclarationNode * a ) { 685 if ( ! a ) return this;704 if ( ! a ) return this; 686 705 assert( a->type->kind == TypeData::Array ); 687 706 if ( type ) { … … 755 774 if ( ret->kind == TypeData::Aggregate ) { 756 775 newnode->attributes.swap( ret->aggregate.attributes ); 757 } // if 776 } // if 758 777 return newnode; 759 778 } // if
Note:
See TracChangeset
for help on using the changeset viewer.