- File:
-
- 1 edited
-
src/ResolvExpr/CandidateFinder.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/CandidateFinder.cpp
rd958834b r9e23b446 41 41 #include "Common/utility.h" // for move, copy 42 42 #include "SymTab/Mangler.h" 43 #include "SymTab/Validate.h" // for validateType 43 44 #include "Tuples/Tuples.h" // for handleTupleAssignment 44 45 #include "InitTweak/InitTweak.h" // for getPointerBase … … 897 898 } 898 899 899 if (argType.as<ast::PointerType>()) funcFinder.otypeKeys.insert(Mangle::Encoding::pointer); 900 //else if (const ast::EnumInstType * enumInst = argType.as<ast::EnumInstType>()) {901 // const ast::EnumDecl * enumDecl = enumInst->base; // Here902 //if ( const ast::Type* enumType = enumDecl->base ) {903 //// instance of enum (T) is a instance of type (T)904 //funcFinder.otypeKeys.insert(Mangle::mangle(enumType, Mangle::NoGenericParams | Mangle::Type));905 //} else {906 //// instance of an untyped enum is techically int907 //funcFinder.otypeKeys.insert(Mangle::mangle(enumDecl, Mangle::NoGenericParams | Mangle::Type));908 //}909 // }900 if (argType.as<ast::PointerType>()) funcFinder.otypeKeys.insert(Mangle::Encoding::pointer); 901 else if (const ast::EnumInstType * enumInst = argType.as<ast::EnumInstType>()) { 902 const ast::EnumDecl * enumDecl = enumInst->base; 903 if ( const ast::Type* enumType = enumDecl->base ) { 904 // instance of enum (T) is a instance of type (T) 905 funcFinder.otypeKeys.insert(Mangle::mangle(enumType, Mangle::NoGenericParams | Mangle::Type)); 906 } else { 907 // instance of an untyped enum is techically int 908 funcFinder.otypeKeys.insert(Mangle::mangle(enumDecl, Mangle::NoGenericParams | Mangle::Type)); 909 } 910 } 910 911 else funcFinder.otypeKeys.insert(Mangle::mangle(argType, Mangle::NoGenericParams | Mangle::Type)); 911 912 } … … 1090 1091 assert( toType ); 1091 1092 toType = resolveTypeof( toType, context ); 1093 // toType = SymTab::validateType( castExpr->location, toType, symtab ); 1092 1094 toType = adjustExprType( toType, tenv, symtab ); 1093 1095 … … 1263 1265 newExpr, copy( tenv ), ast::OpenVarSet{}, ast::AssertionSet{}, Cost::zero, 1264 1266 cost ); 1267 1268 if (newCand->expr->env) { 1269 newCand->env.add(*newCand->expr->env); 1270 auto mutExpr = newCand->expr.get_and_mutate(); 1271 mutExpr->env = nullptr; 1272 newCand->expr = mutExpr; 1273 } 1274 1265 1275 PRINT( 1266 1276 std::cerr << "decl is "; … … 1580 1590 // calculate target type 1581 1591 const ast::Type * toType = resolveTypeof( initAlt.type, context ); 1592 // toType = SymTab::validateType( initExpr->location, toType, symtab ); 1582 1593 toType = adjustExprType( toType, tenv, symtab ); 1583 1594 // The call to find must occur inside this loop, otherwise polymorphic return
Note:
See TracChangeset
for help on using the changeset viewer.