Changes in src/Parser/DeclarationNode.cc [6ef2d81:3a5131ed]
- File:
-
- 1 edited
-
src/Parser/DeclarationNode.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r6ef2d81 r3a5131ed 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 9 15:54:59201713 // Update Count : 7 4212 // Last Modified On : Thu Feb 16 13:06:50 2017 13 // Update Count : 753 14 14 // 15 15 … … 913 913 SemanticError errors; 914 914 std::back_insert_iterator< std::list< Declaration * > > out( outputList ); 915 const DeclarationNode * cur = firstNode; 916 917 while ( cur ) { 915 916 for ( const DeclarationNode * cur = firstNode; cur; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ) ) { 918 917 try { 919 918 if ( DeclarationNode * extr = cur->extractAggregate() ) { … … 921 920 Declaration * decl = extr->build(); 922 921 if ( decl ) { 922 decl->location = cur->location; 923 923 * out++ = decl; 924 924 } // if … … 928 928 Declaration * decl = cur->build(); 929 929 if ( decl ) { 930 decl->location = cur->location; 930 931 * out++ = decl; 931 932 } // if 932 933 } catch( SemanticError &e ) { 934 e.set_location( cur->location ); 933 935 errors.append( e ); 934 936 } // try 935 cur = dynamic_cast< DeclarationNode * >( cur->get_next() );936 937 } // while 937 938 … … 944 945 SemanticError errors; 945 946 std::back_insert_iterator< std::list< DeclarationWithType * > > out( outputList ); 946 const DeclarationNode * cur = firstNode;947 while ( cur) {947 948 for ( const DeclarationNode * cur = firstNode; cur; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ) ) { 948 949 try { 949 950 Declaration * decl = cur->build(); 950 951 if ( decl ) { 951 952 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) { 953 dwt->location = cur->location; 952 954 * out++ = dwt; 953 955 } else if ( StructDecl * agg = dynamic_cast< StructDecl * >( decl ) ) { 954 956 StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->get_name() ); 955 * out++ = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr ); 957 auto obj = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr ); 958 obj->location = cur->location; 959 * out++ = obj; 956 960 delete agg; 957 961 } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) { 958 962 UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->get_name() ); 959 * out++ = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr ); 963 auto obj = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr ); 964 obj->location = cur->location; 965 * out++ = obj; 960 966 } // if 961 967 } // if 962 968 } catch( SemanticError &e ) { 969 e.set_location( cur->location ); 963 970 errors.append( e ); 964 971 } // try 965 cur = dynamic_cast< DeclarationNode * >( cur->get_next() );966 } // while 972 } // for 973 967 974 if ( ! errors.isEmpty() ) { 968 975 throw errors; … … 979 986 * out++ = cur->buildType(); 980 987 } catch( SemanticError &e ) { 988 e.set_location( cur->location ); 981 989 errors.append( e ); 982 990 } // try
Note:
See TracChangeset
for help on using the changeset viewer.