Changeset 24d6572 for src/ResolvExpr/typeops.h
- Timestamp:
- Jun 12, 2023, 2:45:32 PM (2 years ago)
- Branches:
- ast-experimental, master
- Children:
- 62d62db
- Parents:
- 34b4268 (diff), 251ce80 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/typeops.h
r34b4268 r24d6572 10 10 // Created On : Sun May 17 07:28:22 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Oct 1 09:45:00 201913 // Update Count : 612 // Last Modified On : Wed Jan 18 11:54:00 2023 13 // Update Count : 7 14 14 // 15 15 … … 18 18 #include <vector> 19 19 20 #include "Cost.h"21 #include "TypeEnvironment.h"22 #include "WidenMode.h"23 #include "AST/Fwd.hpp"24 #include "AST/Node.hpp"25 #include "AST/SymbolTable.hpp"26 20 #include "AST/Type.hpp" 27 #include "AST/TypeEnvironment.hpp"28 #include "SynTree/SynTree.h"29 21 #include "SynTree/Type.h" 30 22 … … 34 26 35 27 namespace ResolvExpr { 28 class TypeEnvironment; 29 36 30 // combos: takes a list of sets and returns a set of lists representing every possible way of forming a list by 37 31 // picking one element out of each set … … 61 55 } 62 56 63 // in AdjustExprType.cc64 /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function65 void adjustExprType( Type *& type, const TypeEnvironment & env, const SymTab::Indexer & indexer );66 67 /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function using empty TypeEnvironment and Indexer68 void adjustExprType( Type *& type );69 70 template< typename ForwardIterator >71 void adjustExprTypeList( ForwardIterator begin, ForwardIterator end, const TypeEnvironment & env, const SymTab::Indexer & indexer ) {72 while ( begin != end ) {73 adjustExprType( *begin++, env, indexer );74 } // while75 }76 77 /// Replaces array types with equivalent pointer, and function types with a pointer-to-function78 const ast::Type * adjustExprType(79 const ast::Type * type, const ast::TypeEnvironment & env, const ast::SymbolTable & symtab );80 81 // in CastCost.cc82 Cost castCost( const Type * src, const Type * dest, bool srcIsLvalue,83 const SymTab::Indexer & indexer, const TypeEnvironment & env );84 Cost castCost(85 const ast::Type * src, const ast::Type * dst, bool srcIsLvalue,86 const ast::SymbolTable & symtab, const ast::TypeEnvironment & env );87 88 // in ConversionCost.cc89 Cost conversionCost( const Type * src, const Type * dest, bool srcIsLvalue,90 const SymTab::Indexer & indexer, const TypeEnvironment & env );91 Cost conversionCost(92 const ast::Type * src, const ast::Type * dst, bool srcIsLvalue,93 const ast::SymbolTable & symtab, const ast::TypeEnvironment & env );94 95 // in AlternativeFinder.cc96 Cost computeConversionCost( Type * actualType, Type * formalType, bool actualIsLvalue,97 const SymTab::Indexer & indexer, const TypeEnvironment & env );98 99 // in PtrsAssignable.cc100 int ptrsAssignable( const Type * src, const Type * dest, const TypeEnvironment & env );101 int ptrsAssignable( const ast::Type * src, const ast::Type * dst,102 const ast::TypeEnvironment & env );103 104 // in PtrsCastable.cc105 int ptrsCastable( const Type * src, const Type * dest, const TypeEnvironment & env, const SymTab::Indexer & indexer );106 int ptrsCastable(107 const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab,108 const ast::TypeEnvironment & env );109 110 // in Unify.cc111 bool typesCompatible( const Type *, const Type *, const SymTab::Indexer & indexer, const TypeEnvironment & env );112 bool typesCompatibleIgnoreQualifiers( const Type *, const Type *, const SymTab::Indexer & indexer, const TypeEnvironment & env );113 114 inline bool typesCompatible( const Type * t1, const Type * t2, const SymTab::Indexer & indexer ) {115 TypeEnvironment env;116 return typesCompatible( t1, t2, indexer, env );117 }118 119 inline bool typesCompatibleIgnoreQualifiers( const Type * t1, const Type * t2, const SymTab::Indexer & indexer ) {120 TypeEnvironment env;121 return typesCompatibleIgnoreQualifiers( t1, t2, indexer, env );122 }123 124 bool typesCompatible(125 const ast::Type *, const ast::Type *, const ast::SymbolTable & symtab = {},126 const ast::TypeEnvironment & env = {} );127 128 bool typesCompatibleIgnoreQualifiers(129 const ast::Type *, const ast::Type *, const ast::SymbolTable &,130 const ast::TypeEnvironment & env = {} );131 132 /// creates the type represented by the list of returnVals in a FunctionType. The caller owns the return value.133 Type * extractResultType( FunctionType * functionType );134 /// Creates or extracts the type represented by the list of returns in a `FunctionType`.135 ast::ptr<ast::Type> extractResultType( const ast::FunctionType * func );136 137 // in CommonType.cc138 Type * commonType( Type * type1, Type * type2, bool widenFirst, bool widenSecond, const SymTab::Indexer & indexer, TypeEnvironment & env, const OpenVarSet & openVars );139 ast::ptr< ast::Type > commonType(140 const ast::ptr< ast::Type > & type1, const ast::ptr< ast::Type > & type2,141 ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,142 const ast::OpenVarSet & open, WidenMode widen, const ast::SymbolTable & symtab143 );144 // in Unify.cc145 std::vector< ast::ptr< ast::Type > > flattenList(146 const std::vector< ast::ptr< ast::Type > > & src, ast::TypeEnvironment & env147 );148 149 // in PolyCost.cc150 int polyCost( Type * type, const TypeEnvironment & env, const SymTab::Indexer & indexer );151 int polyCost(152 const ast::Type * type, const ast::SymbolTable & symtab, const ast::TypeEnvironment & env );153 154 // in SpecCost.cc155 int specCost( Type * type );156 int specCost( const ast::Type * type );157 158 57 // in Occurs.cc 159 58 bool occurs( const Type * type, const std::string & varName, const TypeEnvironment & env ); … … 168 67 return false; 169 68 } 170 171 // in AlternativeFinder.cc172 void referenceToRvalueConversion( Expression *& expr, Cost & cost );173 // in CandidateFinder.cpp174 const ast::Expr * referenceToRvalueConversion( const ast::Expr * expr, Cost & cost );175 69 176 70 /// flatten tuple type into list of types … … 218 112 } 219 113 220 221 114 return new ast::TupleType{ std::move(types) }; 222 115 } … … 227 120 return tupleFromTypes( tys.begin(), tys.end() ); 228 121 } 229 230 231 122 232 123 // in TypeEnvironment.cc
Note:
See TracChangeset
for help on using the changeset viewer.