Changeset 97b47ec
- Timestamp:
- Jun 23, 2023, 11:24:07 AM (21 months ago)
- Branches:
- master
- Children:
- 1fbf481
- Parents:
- fe0b94f
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified libcfa/prelude/prelude-gen.cc ¶
rfe0b94f r97b47ec 159 159 int main() { 160 160 cout << "# 2 \"prelude.cfa\" // needed for error messages from this file" << endl; 161 cout << "forall( T &) trait sized {};" << endl;161 cout << "forall( T * ) trait sized {};" << endl; 162 162 163 163 cout << "//////////////////////////" << endl; -
TabularUnified src/AST/Decl.cpp ¶
rfe0b94f r97b47ec 115 115 static_assert( sizeof(kindNames) / sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "typeString: kindNames is out of sync." ); 116 116 assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." ); 117 return sized ? kindNames[ kind ] : &kindNames[ kind ][ sizeof("sized") ]; // sizeof includes '\0' 117 // sizeof("sized") includes '\0' and gives the offset to remove "sized ". 118 return sized ? kindNames[ kind ] : &kindNames[ kind ][ sizeof("sized") ]; 118 119 } 119 120 -
TabularUnified src/Validate/LinkReferenceToTypes.cpp ¶
rfe0b94f r97b47ec 264 264 265 265 ast::TraitDecl const * LinkTypesCore::postvisit( ast::TraitDecl const * decl ) { 266 auto mut = ast::mutate( decl );267 if ( mut->name == "sized" ) {268 // "sized" is a special trait - flick the sized status on for the type variable.269 assertf( mut->params.size() == 1, "Built-in trait 'sized' has incorrect number of parameters: %zd", decl->params.size() );270 ast::TypeDecl * td = mut->params.front().get_and_mutate();271 td->sized = true;272 }273 274 266 // There is some overlap with code from decayForallPointers, 275 267 // perhaps reorganization or shared helper functions are called for. 276 268 // Move assertions from type parameters into the body of the trait. 269 auto mut = ast::mutate( decl ); 277 270 for ( ast::ptr<ast::TypeDecl> const & td : decl->params ) { 278 271 auto expanded = expandAssertions( td->assertions );
Note: See TracChangeset
for help on using the changeset viewer.