Changeset a9762dc
- Timestamp:
- Sep 14, 2022, 4:35:15 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation
- Children:
- 01865fb
- Parents:
- 1b65595
- Location:
- src/AST
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.hpp
r1b65595 ra9762dc 327 327 struct PureVisitor {}; 328 328 329 struct WithCodeLocation { 330 const CodeLocation * location = nullptr; 331 }; 332 329 333 /// Keep track of the polymorphic const TypeSubstitution * typeSubs for the current expression. 330 334 struct WithConstTypeSubstitution { -
src/AST/Pass.impl.hpp
r1b65595 ra9762dc 25 25 #define VISIT_START( node ) \ 26 26 using namespace ast; \ 27 /* back-up the last known code location */ \ 28 __attribute__((unused)) auto loc_guard = ast::__pass::make_location_guard( core, node ); \ 27 29 /* back-up the visit children */ \ 28 30 __attribute__((unused)) ast::__pass::visit_children_guard guard1( ast::__pass::visit_children(core, 0) ); \ -
src/AST/Pass.proto.hpp
r1b65595 ra9762dc 295 295 FIELD_PTR( at_cleanup, __pass::at_cleanup_t ) 296 296 FIELD_PTR( visitor, ast::Pass<core_t> * const ) 297 FIELD_PTR( location, const CodeLocation * ) 297 298 298 299 // Remove the macro to make sure we don't clash … … 324 325 static auto on_error (core_t & core, ptr<Decl> & decl, int) -> decltype(core.on_error(decl)) { 325 326 return core.on_error(decl); 327 } 328 329 template< typename core_t, typename node_t > 330 static auto make_location_guard(core_t & core, node_t * node) -> ValueGuardPtr<const CodeLocation *> { 331 if constexpr (std::is_base_of<ParseNode, node_t>::value) { 332 const CodeLocation ** p = location(core, 0); 333 if(p) { 334 ValueGuardPtr<const CodeLocation *> g = { p }; 335 *p = &node->location; 336 return g; 337 } 338 } 339 (void)node; 340 return { nullptr }; 326 341 } 327 342
Note: See TracChangeset
for help on using the changeset viewer.