Changes in src/Parser/DeclarationNode.cc [a1c9ddd:c194661]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
ra1c9ddd rc194661 253 253 return newnode; 254 254 } // DeclarationNode::newFromTypedef 255 256 DeclarationNode * DeclarationNode::newFromGlobalScope() { 257 DeclarationNode * newnode = new DeclarationNode; 258 newnode->type = new TypeData( TypeData::GlobalScope ); 259 return newnode; 260 } 261 262 DeclarationNode * DeclarationNode::newQualifiedType( DeclarationNode * parent, DeclarationNode * child) { 263 DeclarationNode * newnode = new DeclarationNode; 264 newnode->type = new TypeData( TypeData::Qualified ); 265 newnode->type->qualified.parent = parent->type; 266 newnode->type->qualified.child = child->type; 267 parent->type = nullptr; 268 child->type = nullptr; 269 delete parent; 270 delete child; 271 return newnode; 272 } 255 273 256 274 DeclarationNode * DeclarationNode::newAggregate( Aggregate kind, const string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body ) { … … 993 1011 try { 994 1012 Declaration * decl = cur->build(); 995 if ( decl ) {996 997 998 999 1000 StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->get_name() );1001 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr);1002 obj->location = cur->location;1003 * out++ = obj;1004 delete agg;1005 } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) {1006 UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->get_name() );1007 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr);1008 obj->location = cur->location;1009 * out++ = obj;1010 } // if1013 assert( decl ); 1014 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) { 1015 dwt->location = cur->location; 1016 * out++ = dwt; 1017 } else if ( StructDecl * agg = dynamic_cast< StructDecl * >( decl ) ) { 1018 // xxx - this might be where anonymous struct members are added - should be conditional on struct name 1019 StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->name ); 1020 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr ); 1021 obj->location = cur->location; 1022 * out++ = obj; 1023 delete agg; 1024 } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) { 1025 UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->name ); 1026 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr ); 1027 obj->location = cur->location; 1028 * out++ = obj; 1011 1029 } // if 1012 1030 } catch( SemanticErrorException &e ) {
Note:
See TracChangeset
for help on using the changeset viewer.