Changes in src/GenPoly/GenPoly.h [c8837e5:3606fe4]
- File:
-
- 1 edited
-
src/GenPoly/GenPoly.h (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/GenPoly.h
rc8837e5 r3606fe4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Oct 7 15:06:00 202213 // Update Count : 912 // Last Modified On : Fri Aug 19 16:03:00 2022 13 // Update Count : 8 14 14 // 15 15 … … 20 20 21 21 #include "ErasableScopedMap.h" // for ErasableScopedMap 22 #include "AST/Decl.hpp" // for TypeDecl::Data 23 #include "AST/Fwd.hpp" // for ApplicationExpr, BaseInstType, Func... 22 #include "AST/Fwd.hpp" 24 23 #include "SymTab/Mangler.h" // for Mangler 25 24 #include "SynTree/Declaration.h" // for TypeDecl::Data, AggregateDecl, Type... … … 30 29 // TODO Via some tricks this works for ast::TypeDecl::Data as well. 31 30 typedef ErasableScopedMap< std::string, TypeDecl::Data > TyVarMap; 32 using TypeVarMap = ErasableScopedMap< std::string, ast::TypeDecl::Data >;33 31 34 32 /// Replaces a TypeInstType by its referrent in the environment, if applicable … … 41 39 /// returns polymorphic type if is polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided 42 40 Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 ); 43 const ast::Type * isPolyType( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * subst = nullptr);41 const ast::Type * isPolyType(const ast::Type * type, const TyVarMap & tyVars, const ast::TypeSubstitution * env = nullptr); 44 42 45 43 /// returns dynamic-layout type if is dynamic-layout type in tyVars, NULL otherwise; will look up substitution in env if provided 46 44 ReferenceToType *isDynType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 ); 47 const ast::BaseInstType *isDynType( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * subst= 0 );45 const ast::BaseInstType *isDynType( const ast::Type *type, const TyVarMap &tyVars, const ast::TypeSubstitution *typeSubs = 0 ); 48 46 49 47 /// true iff function has dynamic-layout return type under the given type variable map 50 48 ReferenceToType *isDynRet( FunctionType *function, const TyVarMap &tyVars ); 51 const ast::BaseInstType *isDynRet( const ast::FunctionType * type, const TypeVarMap & typeVars );52 49 53 50 /// true iff function has dynamic-layout return type under the type variable map generated from its forall-parameters … … 56 53 /// A function needs an adapter if it returns a dynamic-layout value or if any of its parameters have dynamic-layout type 57 54 bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVarr ); 58 bool needsAdapter( ast::FunctionType const * adaptee, const TypeVarMap & typeVars );59 55 60 56 /// returns polymorphic type if is pointer to polymorphic type, NULL otherwise; will look up substitution in env if provided … … 63 59 /// returns polymorphic type if is pointer to polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided 64 60 Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 ); 65 const ast::Type * isPolyPtr( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * env = 0 );66 61 67 62 /// if the base type (after dereferencing N >= 0 pointers) is a polymorphic type, returns the base type, NULL otherwise; … … 72 67 /// N will be stored in levels, if provided, will look up substitution in env if provided 73 68 Type *hasPolyBase( Type *type, const TyVarMap &tyVars, int *levels = 0, const TypeSubstitution *env = 0 ); 74 const ast::Type * hasPolyBase( const ast::Type * type, const TypeVarMap & typeVars, int * levels = 0, const ast::TypeSubstitution * env = 0 );75 69 76 70 /// true iff this type or some base of this type after dereferencing pointers is either polymorphic or a generic type with at least one … … 96 90 /// true if arg requires boxing given exprTyVars 97 91 bool needsBoxing( Type * param, Type * arg, const TyVarMap &exprTyVars, const TypeSubstitution * env ); 98 bool needsBoxing( const ast::Type * param, const ast::Type * arg, const Ty peVarMap & typeVars, const ast::TypeSubstitution * subst);92 bool needsBoxing( const ast::Type * param, const ast::Type * arg, const TyVarMap &exprTyVars, const ast::TypeSubstitution * env); 99 93 100 94 /// true if arg requires boxing in the call to appExpr 101 95 bool needsBoxing( Type * param, Type * arg, ApplicationExpr * appExpr, const TypeSubstitution * env ); 102 bool needsBoxing( const ast::Type * param, const ast::Type * arg, const ast::ApplicationExpr * expr, const ast::TypeSubstitution * subst);96 bool needsBoxing( const ast::Type * param, const ast::Type * arg, const ast::ApplicationExpr * appExpr, const ast::TypeSubstitution * env); 103 97 104 98 /// Adds the type variable `tyVar` to `tyVarMap` 105 99 void addToTyVarMap( TypeDecl * tyVar, TyVarMap &tyVarMap ); 106 void addToTypeVarMap( const ast::TypeDecl * type, TypeVarMap & typeVars );107 100 108 101 /// Adds the declarations in the forall list of type (and its pointed-to type if it's a pointer type) to `tyVarMap` 109 102 void makeTyVarMap( Type *type, TyVarMap &tyVarMap ); 110 void makeTy peVarMap( const ast::Type * type, TypeVarMap & typeVars);103 void makeTyVarMap(const ast::Type * type, TyVarMap & tyVarMap); 111 104 112 105 /// Prints type variable map 113 106 void printTyVarMap( std::ostream &os, const TyVarMap &tyVarMap ); 114 void printTypeVarMap( std::ostream &os, const TypeVarMap & typeVars );115 107 116 108 /// Gets the mangled name of this type; alias for SymTab::Mangler::mangleType().
Note:
See TracChangeset
for help on using the changeset viewer.