Changes in src/ResolvExpr/CastCost.cc [cf32116:7d01cf44]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/CastCost.cc
rcf32116 r7d01cf44 10 10 // Created On : Sun May 17 06:57:43 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : T ue Oct 4 15:00:00 201913 // Update Count : 912 // Last Modified On : Thu Aug 8 16:12:00 2019 13 // Update Count : 8 14 14 // 15 15 … … 142 142 143 143 CastCost_new( 144 const ast::Type * dst, bool srcIsLvalue,const ast::SymbolTable & symtab,144 const ast::Type * dst, const ast::SymbolTable & symtab, 145 145 const ast::TypeEnvironment & env, CostCalculation costFunc ) 146 : ConversionCost_new( dst, s rcIsLvalue, symtab, env, costFunc ) {}146 : ConversionCost_new( dst, symtab, env, costFunc ) {} 147 147 148 148 void postvisit( const ast::BasicType * basicType ) { … … 152 152 cost = Cost::unsafe; 153 153 } else { 154 cost = conversionCost( basicType, dst, s rcIsLvalue, symtab, env );154 cost = conversionCost( basicType, dst, symtab, env ); 155 155 } 156 156 } … … 183 183 } 184 184 }; 185 186 #warning For overload resolution between the two versions.187 int localPtrsCastable(const ast::Type * t1, const ast::Type * t2,188 const ast::SymbolTable & symtab, const ast::TypeEnvironment & env ) {189 return ptrsCastable( t1, t2, symtab, env );190 }191 Cost localCastCost(192 const ast::Type * src, const ast::Type * dst, bool srcIsLvalue,193 const ast::SymbolTable & symtab, const ast::TypeEnvironment & env194 ) { return castCost( src, dst, srcIsLvalue, symtab, env ); }195 185 } // anonymous namespace 196 186 197 198 199 187 Cost castCost( 200 const ast::Type * src, const ast::Type * dst, bool srcIsLvalue,201 const ast:: SymbolTable & symtab, const ast::TypeEnvironment & env188 const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab, 189 const ast::TypeEnvironment & env 202 190 ) { 203 191 if ( auto typeInst = dynamic_cast< const ast::TypeInstType * >( dst ) ) { … … 205 193 // check cast cost against bound type, if present 206 194 if ( eqvClass->bound ) { 207 return castCost( src, eqvClass->bound, s rcIsLvalue, symtab, env );195 return castCost( src, eqvClass->bound, symtab, env ); 208 196 } else { 209 197 return Cost::infinity; … … 213 201 auto type = strict_dynamic_cast< const ast::TypeDecl * >( named ); 214 202 if ( type->base ) { 215 return castCost( src, type->base, s rcIsLvalue, symtab, env ) + Cost::safe;203 return castCost( src, type->base, symtab, env ) + Cost::safe; 216 204 } 217 205 } … … 236 224 #warning cast on ptrsCastable artifact of having two functions, remove when port done 237 225 return convertToReferenceCost( 238 src, refType, srcIsLvalue, symtab, env, localPtrsCastable ); 226 src, refType, symtab, env, 227 ( int (*)( 228 const ast::Type *, const ast::Type *, const ast::SymbolTable &, 229 const ast::TypeEnvironment & ) 230 ) ptrsCastable ); 239 231 } else { 240 232 #warning cast on castCost artifact of having two functions, remove when port done 241 ast::Pass< CastCost_new > converter( 242 dst, srcIsLvalue, symtab, env, localCastCost ); 233 ast::Pass< CastCost_new > converter{ 234 dst, symtab, env, 235 ( Cost (*)( 236 const ast::Type *, const ast::Type *, const ast::SymbolTable &, 237 const ast::TypeEnvironment & ) 238 ) castCost }; 243 239 src->accept( converter ); 244 240 return converter.pass.cost;
Note: See TracChangeset
for help on using the changeset viewer.