Changes in src/GenPoly/SpecializeNew.cpp [8f31be6:c6b4432]
- File:
-
- 1 edited
-
src/GenPoly/SpecializeNew.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/SpecializeNew.cpp
r8f31be6 rc6b4432 23 23 #include "GenPoly/GenPoly.h" // for getFunctionType 24 24 #include "ResolvExpr/FindOpenVars.h" // for findOpenVars 25 #include "ResolvExpr/TypeEnvironment.h" // for FirstOpen, FirstClosed26 25 27 26 namespace GenPoly { … … 81 80 } 82 81 83 // The number of elements in a type if it is a flattened tuple.84 size_t flatT upleSize( const ast::Type * type) {85 if ( auto tuple = dynamic_cast<const ast::TupleType *>( type ) ) {86 size_t sum = 0;87 for ( auto t : *tuple) {88 sum += flatT upleSize( t);89 } 90 return sum;91 } else {92 return 1;93 }82 // The number of elements in a list, if all tuples had been flattened. 83 size_t flatTypeListSize( const std::vector<ast::ptr<ast::Type>> & types ) { 84 size_t sum = 0; 85 for ( const ast::ptr<ast::Type> & type : types ) { 86 if ( const ast::TupleType * tuple = type.as<ast::TupleType>() ) { 87 sum += flatTypeListSize( tuple->types ); 88 } else { 89 sum += 1; 90 } 91 } 92 return sum; 94 93 } 95 94 96 95 // Find the total number of components in a parameter list. 97 96 size_t functionParameterSize( const ast::FunctionType * type ) { 98 size_t sum = 0; 99 for ( auto param : type->params ) { 100 sum += flatTupleSize( param ); 101 } 102 return sum; 97 return flatTypeListSize( type->params ); 103 98 } 104 99
Note:
See TracChangeset
for help on using the changeset viewer.