- Timestamp:
- Dec 3, 2020, 10:44:40 AM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 1db306a
- Parents:
- b37515b
- Location:
- src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Print.cpp
rb37515b rcd6a6ff 205 205 206 206 void preprint( const ast::NamedTypeDecl * node ) { 207 if ( ! node->name.empty() ) os << node->name << ": "; 207 if ( ! node->name.empty() ) { 208 if( deterministic_output && isUnboundType(node->name) ) os << "[unbound]:"; 209 else os << node->name << ": "; 210 } 208 211 209 212 if ( ! short_mode && node->linkage != Linkage::Cforall ) { … … 240 243 241 244 if ( node->result ) { 242 if (!deterministic_output) { 243 os << endl << indent << "... with resolved type:" << endl; 244 ++indent; 245 os << indent; 246 node->result->accept( *this ); 247 --indent; 248 } 245 os << endl << indent << "... with resolved type:" << endl; 246 ++indent; 247 os << indent; 248 node->result->accept( *this ); 249 --indent; 249 250 } 250 251 … … 1382 1383 virtual const ast::Type * visit( const ast::TypeInstType * node ) override final { 1383 1384 preprint( node ); 1384 os << "instance of type " << node->name 1385 const auto & _name = deterministic_output && isUnboundType(node) ? "[unbound]" : node->name; 1386 os << "instance of type " << _name 1385 1387 << " (" << (node->kind == ast::TypeDecl::Ftype ? "" : "not ") << "function type)"; 1386 1388 print( node->params ); -
src/AST/Type.cpp
rb37515b rcd6a6ff 133 133 134 134 BaseInstType::BaseInstType( const BaseInstType & o ) 135 : ParameterizedType( o.qualifiers, copy( o.attributes ) ), params(), name( o.name ), 135 : ParameterizedType( o.qualifiers, copy( o.attributes ) ), params(), name( o.name ), 136 136 hoistType( o.hoistType ) { 137 137 Pass< ForallSubstitutor > sub; … … 222 222 // TODO: once TypeInstType representation is updated, it should properly check 223 223 // if the context id is filled. this is a temporary hack for now 224 if (std::count(typeInst->name.begin(), typeInst->name.end(), '_') >= 3) { 225 return true; 226 } 224 return isUnboundType(typeInst->name); 225 } 226 return false; 227 } 228 229 bool isUnboundType(const std::string & tname) { 230 // xxx - look for a type name produced by renameTyVars. 231 232 // TODO: once TypeInstType representation is updated, it should properly check 233 // if the context id is filled. this is a temporary hack for now 234 if (std::count(tname.begin(), tname.end(), '_') >= 3) { 235 return true; 227 236 } 228 237 return false; -
src/AST/Type.hpp
rb37515b rcd6a6ff 536 536 537 537 bool isUnboundType(const Type * type); 538 bool isUnboundType(const std::string & tname); 538 539 539 540 } -
src/AST/TypeEnvironment.cpp
rb37515b rcd6a6ff 34 34 #include "ResolvExpr/Unify.h" // for unifyInexact 35 35 #include "Tuples/Tuples.h" // for isTtype 36 #include "CompilationState.h" 36 37 37 38 using ResolvExpr::WidenMode; … … 56 57 57 58 void print( std::ostream & out, const EqvClass & clz, Indenter indent ) { 58 out << "( "; 59 std::copy( clz.vars.begin(), clz.vars.end(), std::ostream_iterator< std::string >( out, " " ) ); 59 out << "("; 60 bool first = true; 61 for(const auto & var : clz.vars) { 62 if(first) first = false; 63 else out << " "; 64 if( deterministic_output && isUnboundType(var) ) out << "[unbound]"; 65 else out << var; 66 } 60 67 out << ")"; 61 68 -
src/ResolvExpr/TypeEnvironment.cc
rb37515b rcd6a6ff 107 107 108 108 void EqvClass::print( std::ostream &os, Indenter indent ) const { 109 if( !deterministic_output ) { 110 os << "( "; 111 std::copy( vars.begin(), vars.end(), std::ostream_iterator< std::string >( os, " " ) ); 112 os << ")"; 113 } 109 os << "("; 110 bool first = true; 111 for(const auto & var : vars) { 112 if(first) first = false; 113 else os << " "; 114 if( deterministic_output && isUnboundType(var) ) os << "[unbound]"; 115 else os << var; 116 } 117 os << ")"; 114 118 if ( type ) { 115 119 os << " -> "; -
src/SynTree/Expression.cc
rb37515b rcd6a6ff 72 72 73 73 if ( result ) { 74 if (!deterministic_output) { 75 os << std::endl << indent << "with resolved type:" << std::endl; 76 os << (indent+1); 77 result->print( os, indent+1 ); 78 } 74 os << std::endl << indent << "with resolved type:" << std::endl; 75 os << (indent+1); 76 result->print( os, indent+1 ); 79 77 } 80 78 -
src/SynTree/NamedTypeDecl.cc
rb37515b rcd6a6ff 22 22 #include "LinkageSpec.h" // for Spec, Cforall, linkageName 23 23 #include "Type.h" // for Type, Type::StorageClasses 24 #include "CompilationState.h" 24 25 25 26 NamedTypeDecl::NamedTypeDecl( const std::string &name, Type::StorageClasses scs, Type *base ) … … 41 42 using namespace std; 42 43 43 if ( name != "" ) os << name << ": "; 44 if ( ! name.empty() ) { 45 if( deterministic_output && isUnboundType(name) ) os << "[unbound]:"; 46 else os << name << ": "; 47 } 44 48 45 49 if ( linkage != LinkageSpec::Cforall ) { -
src/SynTree/ReferenceToType.cc
rb37515b rcd6a6ff 24 24 #include "Type.h" // for TypeInstType, StructInstType, UnionInstType 25 25 #include "TypeSubstitution.h" // for TypeSubstitution 26 #include "CompilationState.h" 26 27 27 28 class Attribute; … … 205 206 206 207 Type::print( os, indent ); 207 os << "instance of " << typeString() << " " << get_name() << " (" << ( isFtype ? "" : "not" ) << " function type)"; 208 os << "instance of " << typeString() << " "; 209 const auto & name_ = get_name(); 210 if( deterministic_output && isUnboundType(name) ) os << "[unbound]"; 211 else os << name; 212 os << " (" << ( isFtype ? "" : "not" ) << " function type)"; 208 213 if ( ! parameters.empty() ) { 209 214 os << endl << indent << "... with parameters" << endl; -
src/SynTree/Type.cc
rb37515b rcd6a6ff 156 156 const Type::Qualifiers noQualifiers; 157 157 158 bool isUnboundType(const Type * type) { 159 if (auto typeInst = dynamic_cast<const TypeInstType *>(type)) { 160 // xxx - look for a type name produced by renameTyVars. 161 162 // TODO: once TypeInstType representation is updated, it should properly check 163 // if the context id is filled. this is a temporary hack for now 164 return isUnboundType(typeInst->name); 165 } 166 return false; 167 } 168 169 bool isUnboundType(const std::string & tname) { 170 // xxx - look for a type name produced by renameTyVars. 171 172 // TODO: once TypeInstType representation is updated, it should properly check 173 // if the context id is filled. this is a temporary hack for now 174 if (std::count(tname.begin(), tname.end(), '_') >= 3) { 175 return true; 176 } 177 return false; 178 } 179 158 180 // Local Variables: // 159 181 // tab-width: 4 // -
src/SynTree/Type.h
rb37515b rcd6a6ff 733 733 }; 734 734 735 736 bool isUnboundType(const Type * type); 737 bool isUnboundType(const std::string & tname); 738 735 739 // Local Variables: // 736 740 // tab-width: 4 //
Note: See TracChangeset
for help on using the changeset viewer.