Changeset 6e1e2d0 for src/Common
- Timestamp:
- May 1, 2023, 4:19:09 PM (21 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- c083c3d
- Parents:
- a50fdfb (diff), 985b624 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/Common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/CodeLocationTools.cpp
ra50fdfb r6e1e2d0 210 210 211 211 struct LeafKindVisitor : public ast::Visitor { 212 LeafKind kind;212 LeafKind result; 213 213 214 214 #define VISIT(node_type, return_type) \ 215 215 const ast::return_type * visit( const ast::node_type * ) final { \ 216 kind= LeafKind::node_type; \216 result = LeafKind::node_type; \ 217 217 return nullptr; \ 218 218 } … … 224 224 225 225 LeafKind get_leaf_kind( ast::Node const * node ) { 226 LeafKindVisitor visitor; 227 node->accept( visitor ); 228 return visitor.kind; 226 return ast::Pass<LeafKindVisitor>::read( node ); 229 227 } 230 228 -
src/Common/Iterate.hpp
ra50fdfb r6e1e2d0 20 20 #include <iterator> 21 21 22 // it's nice to actually be able to increment iterators by an arbitrary amount22 // Returns an iterator that is it advanced n times. 23 23 template< class InputIt, class Distance > 24 24 InputIt operator+( InputIt it, Distance n ) { … … 50 50 51 51 // ----------------------------------------------------------------------------- 52 // Helper struct and function to support 53 // for ( val_and_index : enumerate( container ) ) {} 54 // which iterates through the container and tracks the index as well. 55 52 56 template< typename T > 53 57 struct enumerate_t { … … 109 113 110 114 // ----------------------------------------------------------------------------- 115 // Helper function to transform one iterable container into another. 116 111 117 template< typename OutType, typename Range, typename Functor > 112 118 OutType map_range( const Range& range, Functor&& functor ) { … … 206 212 // Helper struct and function to support 207 213 // for ( val : lazy_map( container1, f ) ) {} 208 // syntax to have a for each that iterates a container, mapping each element by applying f 214 // syntax to have a for each that iterates a container, 215 // mapping each element by applying f. 216 209 217 template< typename T, typename Func > 210 218 struct lambda_iterate_t {
Note: See TracChangeset
for help on using the changeset viewer.