- Timestamp:
- Apr 17, 2023, 11:00:38 AM (3 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 81bd7e3
- Parents:
- 6349929
- File:
-
- 1 edited
-
src/Parser/DeclarationNode.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.h
r6349929 r66b6f66 179 179 // This generic buildList is here along side its overloads. 180 180 template<typename AstType, typename NodeType, 181 template<typename, typename...> class Container, typename... Args>181 template<typename, typename...> class Container, typename... Args> 182 182 void buildList( NodeType * firstNode, 183 Container<ast::ptr<AstType>, Args...> & output ) {184 SemanticErrorException errors;185 std::back_insert_iterator<Container<ast::ptr<AstType>, Args...>> out( output );186 NodeType * cur = firstNode;187 188 while ( cur ) {189 try {190 if ( auto result = dynamic_cast<AstType *>( maybeBuild( cur ) ) ) {191 *out++ = result;192 } else {193 assertf(false, __PRETTY_FUNCTION__ );194 SemanticError( cur->location, "type specifier declaration in forall clause is currently unimplemented." );195 } // if196 } catch( SemanticErrorException & e ) {197 errors.append( e );198 } // try199 ParseNode * temp = cur->get_next();200 // Should not return nullptr, then it is non-homogeneous:201 cur = dynamic_cast<NodeType *>( temp );202 if ( !cur && temp ) {203 SemanticError( temp->location, "internal error, non-homogeneous nodes founds in buildList processing." );204 } // if205 } // while206 if ( ! errors.isEmpty() ) {207 throw errors;208 } // if183 Container<ast::ptr<AstType>, Args...> & output ) { 184 SemanticErrorException errors; 185 std::back_insert_iterator<Container<ast::ptr<AstType>, Args...>> out( output ); 186 NodeType * cur = firstNode; 187 188 while ( cur ) { 189 try { 190 if ( auto result = dynamic_cast<AstType *>( maybeBuild( cur ) ) ) { 191 *out++ = result; 192 } else { 193 assertf(false, __PRETTY_FUNCTION__ ); 194 SemanticError( cur->location, "type specifier declaration in forall clause is currently unimplemented." ); 195 } // if 196 } catch( SemanticErrorException & e ) { 197 errors.append( e ); 198 } // try 199 ParseNode * temp = cur->get_next(); 200 // Should not return nullptr, then it is non-homogeneous: 201 cur = dynamic_cast<NodeType *>( temp ); 202 if ( !cur && temp ) { 203 SemanticError( temp->location, "internal error, non-homogeneous nodes founds in buildList processing." ); 204 } // if 205 } // while 206 if ( ! errors.isEmpty() ) { 207 throw errors; 208 } // if 209 209 } 210 210 … … 214 214 215 215 template<typename AstType, typename NodeType, 216 template<typename, typename...> class Container, typename... Args>216 template<typename, typename...> class Container, typename... Args> 217 217 void buildMoveList( NodeType * firstNode, 218 218 Container<ast::ptr<AstType>, Args...> & output ) {
Note:
See TracChangeset
for help on using the changeset viewer.