Changes in / [831b2ec:aacd1e1]
- Files:
-
- 2 deleted
- 5 edited
-
libcfa/src/collections/string.hfa (modified) (4 diffs)
-
src/AST/Util.cpp (modified) (1 diff)
-
src/Parser/TypeData.cpp (modified) (1 diff)
-
src/Parser/parser.yy (modified) (1 diff)
-
src/SymTab/Mangler.cpp (modified) (1 diff)
-
tests/.expect/poly-bare-assn.txt (deleted)
-
tests/poly-bare-assn.cfa (deleted)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/collections/string.hfa
r831b2ec raacd1e1 23 23 }; 24 24 25 // Getters 26 static inline size_t len( const string & s ) { return len( *s.inner ); } 27 static inline size_t len( const char * cs ) { return strlen( cs ); }; 28 static inline size_t strlen( const string & s ) { return len( s ); } 29 25 30 // RAII, assignment 26 void ^?{}( string & s );27 28 31 void ?{}( string & s ); // empty string 29 32 void ?{}( string & s, const string & s2 ); … … 55 58 string & assign( string & s, const string & c, size_t n ); 56 59 string & assign( string & s, const char * c, size_t n ); 60 61 static inline string & strcpy( string & s, const char * c ) { s = c; return s; } 62 static inline string & strncpy( string & s, const char * c, size_t n ) { assign( s, c, n ); return s; } 63 static inline string & strcpy( string & s, const string & c ) { s = c; return s; } 64 static inline string & strncpy( string & s, const string & c, size_t n ) { assign( s, c, n ); return s; } 65 57 66 string & ?=?( string & s, ssize_t rhs ); 58 67 string & ?=?( string & s, size_t rhs ); … … 62 71 string & ?=?( string & s, long double _Complex rhs ); 63 72 64 static inline string & strcpy( string & s, const char * c ) { s = c; return s; } 65 static inline string & strncpy( string & s, const char * c, size_t n ) { assign( s, c, n ); return s; } 66 static inline string & strcpy( string & s, const string & c ) { s = c; return s; } 67 static inline string & strncpy( string & s, const string & c, size_t n ) { assign( s, c, n ); return s; } 73 void ^?{}( string & s ); 68 74 69 75 // Alternate construction: request shared edits … … 73 79 string_Share ?`share( string & s ); 74 80 void ?{}( string & s, string_Share src ); 75 76 // Getters77 static inline size_t len( const string & s ) { return len( *s.inner ); }78 static inline size_t len( const char * cs ) { return strlen( cs ); };79 static inline size_t strlen( const string & s ) { return len( s ); }80 81 81 82 // IO Operator -
src/AST/Util.cpp
r831b2ec raacd1e1 260 260 } 261 261 } 262 if ( ! type->assertions.empty() ) visit_children = false;263 262 } 264 263 -
src/Parser/TypeData.cpp
r831b2ec raacd1e1 1585 1585 buildParamList( td->function.params, params ); 1586 1586 buildForall( td->forall, forall ); 1587 // Functions do not store their assertions there anymore. <-- FIXME: clarify or remove this comment 1588 // Assertions were parsed as belonging to the type that preceded them. 1589 // forall ( T | is_foo(T), U | are_bar(T, U) ) 1590 // => parse 1591 // forall( [ typarm( T, [is_foo(T)] ), typarm( U, [are_bar(T, U)] ) ] ) 1592 // => now, flatten as 1593 // forall( [ T, U ] ), assns( [ is_foo(T), are_bar(T, U)] ) 1587 // Functions do not store their assertions there anymore. 1594 1588 for ( ast::ptr<ast::TypeDecl> & type_param : forall ) { 1595 1589 auto mut = type_param.get_and_mutate(); 1596 1590 splice( assertions, mut->assertions ); 1597 }1598 // When assertions without a type preceding them were parsed, placeholder1599 // types were invented to hold them.1600 // forall ( | is_foo(), U | is_bar(U) )1601 // => parse1602 // forall( [ typarm( PLCHLD, [is_foo()] ), typarm( U, [is_bar(U)] ) ] )1603 // => prev step1604 // forall( [ PLCHLD, U ] ), assns( [ is_foo(), is_bar(U)] )1605 // => now, remove the placeholders1606 // forall( [ U ] ), assns( [ is_foo(), is_bar(U)] )1607 for (std::vector<ast::ptr<ast::TypeDecl>>::iterator it = forall.begin();1608 it != forall.end(); ) {1609 // placeholder types have empty names1610 if ( (*it)->name == "" ) it = forall.erase(it);1611 else ++it;1612 1591 } 1613 1592 if ( td->base ) { -
src/Parser/parser.yy
r831b2ec raacd1e1 3132 3132 // | type_specifier identifier_parameter_declarator 3133 3133 | assertion_list 3134 // Invent a placeholder type to wrap these bare assertions. Rely on buildFunctionDecl to remove the placeholder. 3135 { $$ = DeclarationNode::newTypeParam( ast::TypeDecl::Dtype, new string( "" ) )->addAssertions( $1 ); } 3134 { $$ = DeclarationNode::newTypeParam( ast::TypeDecl::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); } 3136 3135 | ENUM '(' identifier_or_type_name ')' identifier_or_type_name new_type_class type_initializer_opt assertion_list_opt 3137 3136 { -
src/SymTab/Mangler.cpp
r831b2ec raacd1e1 290 290 if ( typeMode ) return; 291 291 auto funcType = dynamic_cast<const ast::FunctionType *>( type ); 292 if ( funcType && (!funcType->forall.empty() || !funcType->assertions.empty()) ) {292 if ( funcType && !funcType->forall.empty() ) { 293 293 std::list< std::string > assertionNames; 294 294 int dcount = 0, fcount = 0, vcount = 0, acount = 0;
Note:
See TracChangeset
for help on using the changeset viewer.