Changeset ce7ed2c
- Timestamp:
- Dec 18, 2017, 3:24:54 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 523232d
- Parents:
- a180ded
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/FindOpenVars.cc
ra180ded rce7ed2c 19 19 #include <map> // for map<>::mapped_type 20 20 21 #include "Common/PassVisitor.h" 21 22 #include "SynTree/Declaration.h" // for TypeDecl, DeclarationWithType (ptr ... 22 23 #include "SynTree/Type.h" // for Type, Type::ForallList, ArrayType 23 #include "SynTree/Visitor.h" // for Visitor24 24 25 25 namespace ResolvExpr { 26 class FindOpenVars : public Visitor { 27 public: 26 struct FindOpenVars : public WithGuards { 28 27 FindOpenVars( OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen ); 29 28 30 private: 31 virtual void visit(PointerType *pointerType); 32 virtual void visit(ArrayType *arrayType); 33 virtual void visit(FunctionType *functionType); 34 virtual void visit(TupleType *tupleType); 29 void previsit( PointerType * pointerType ); 30 void previsit( ArrayType * arrayType ); 31 void previsit( FunctionType * functionType ); 32 void previsit( TupleType * tupleType ); 35 33 36 34 void common_action( Type *type ); … … 42 40 43 41 void findOpenVars( Type *type, OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen ) { 44 FindOpenVarsfinder( openVars, closedVars, needAssertions, haveAssertions, firstIsOpen );42 PassVisitor<FindOpenVars> finder( openVars, closedVars, needAssertions, haveAssertions, firstIsOpen ); 45 43 type->accept( finder ); 46 44 } … … 70 68 } // for 71 69 } // if 72 /// std::c out<< "type is ";73 /// type->print( std::c out);74 /// std::c out<< std::endl << "need is" << std::endl;75 /// printAssertionSet( needAssertions, std::c out);76 /// std::c out<< std::endl << "have is" << std::endl;77 /// printAssertionSet( haveAssertions, std::c out);70 /// std::cerr << "type is "; 71 /// type->print( std::cerr ); 72 /// std::cerr << std::endl << "need is" << std::endl; 73 /// printAssertionSet( needAssertions, std::cerr ); 74 /// std::cerr << std::endl << "have is" << std::endl; 75 /// printAssertionSet( haveAssertions, std::cerr ); 78 76 } 79 77 80 void FindOpenVars:: visit(PointerType *pointerType) {78 void FindOpenVars::previsit(PointerType *pointerType) { 81 79 common_action( pointerType ); 82 Visitor::visit( pointerType );83 80 } 84 81 85 void FindOpenVars:: visit(ArrayType *arrayType) {82 void FindOpenVars::previsit(ArrayType *arrayType) { 86 83 common_action( arrayType ); 87 Visitor::visit( arrayType );88 84 } 89 85 90 void FindOpenVars:: visit(FunctionType *functionType) {86 void FindOpenVars::previsit(FunctionType *functionType) { 91 87 common_action( functionType ); 92 88 nextIsOpen = ! nextIsOpen; 93 Visitor::visit( functionType ); 94 nextIsOpen = ! nextIsOpen; 89 GuardAction( [this](){ nextIsOpen = ! nextIsOpen; } ); 95 90 } 96 91 97 void FindOpenVars:: visit(TupleType *tupleType) {92 void FindOpenVars::previsit(TupleType *tupleType) { 98 93 common_action( tupleType ); 99 Visitor::visit( tupleType );100 94 } 101 95 } // namespace ResolvExpr
Note: See TracChangeset
for help on using the changeset viewer.