- File:
-
- 1 edited
-
src/Common/CodeLocationTools.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/CodeLocationTools.cpp
r400b8be r3b0bc16 9 9 // Author : Andrew Beach 10 10 // Created On : Fri Dec 4 15:42:00 2020 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Mar 14 15:14:00202213 // Update Count : 411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 1 09:14:39 2022 13 // Update Count : 3 14 14 // 15 15 … … 112 112 macro(ForStmt, Stmt) \ 113 113 macro(SwitchStmt, Stmt) \ 114 macro(Case Clause, CaseClause) \114 macro(CaseStmt, Stmt) \ 115 115 macro(BranchStmt, Stmt) \ 116 116 macro(ReturnStmt, Stmt) \ 117 117 macro(ThrowStmt, Stmt) \ 118 118 macro(TryStmt, Stmt) \ 119 macro(Catch Clause, CatchClause) \120 macro(Finally Clause, FinallyClause) \119 macro(CatchStmt, Stmt) \ 120 macro(FinallyStmt, Stmt) \ 121 121 macro(SuspendStmt, Stmt) \ 122 122 macro(WaitForStmt, Stmt) \ … … 239 239 }; 240 240 241 class LocalFillCore : public ast::WithGuards {242 CodeLocation const * parent;243 public:244 LocalFillCore( CodeLocation const & location ) : parent( &location ) {245 assert( location.isSet() );246 }247 248 template<typename node_t>249 auto previsit( node_t const * node )250 -> typename std::enable_if<has_code_location<node_t>::value, node_t const *>::type {251 if ( node->location.isSet() ) {252 GuardValue( parent ) = &node->location;253 return node;254 } else {255 node_t * mut = ast::mutate( node );256 mut->location = *parent;257 return mut;258 }259 }260 };261 262 241 } // namespace 263 242 … … 299 278 ast::Pass<FillCore>::run( unit ); 300 279 } 301 302 ast::Node const * localFillCodeLocations(303 CodeLocation const & location , ast::Node const * node ) {304 ast::Pass<LocalFillCore> visitor( location );305 return node->accept( visitor );306 }
Note:
See TracChangeset
for help on using the changeset viewer.