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