Changeset 1a45263
- Timestamp:
- Oct 20, 2022, 2:50:26 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 8bd886e
- Parents:
- df6cc9d (diff), bc899d6 (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. - Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/containers/array.hfa
rdf6cc9d r1a45263 175 175 176 176 // Wrapper 177 struct all_t {} all;177 extern struct all_t {} all; 178 178 forall( [N], S & | sized(S), Te &, result &, Tbase & | { tag(result) enq_( tag(Tbase), tag(N), tag(S), tag(Te) ); } ) 179 179 static inline result & ?[?]( arpk(N, S, Te, Tbase) & this, all_t ) { -
src/AST/module.mk
rdf6cc9d r1a45263 67 67 AST/Util.cpp \ 68 68 AST/Util.hpp \ 69 AST/Vector.hpp \ 69 70 AST/Visitor.hpp 70 71 -
src/GenPoly/InstantiateGenericNew.cpp
rdf6cc9d r1a45263 26 26 #include "AST/Pass.hpp" // for Pass, WithGuard, WithShortCi... 27 27 #include "AST/TranslationUnit.hpp" // for TranslationUnit 28 #include "AST/Vector.hpp" // for vector 28 29 #include "CodeGen/OperatorTable.h" // for isAssignment 29 30 #include "Common/ScopedMap.h" // for ScopedMap … … 39 40 // Utilities: 40 41 41 using type_vector = std::vector< ast::ptr< ast::TypeExpr >>;42 using type_vector = ast::vector< ast::TypeExpr >; 42 43 43 44 /// Abstracts type equality for a list of parameter types. 44 45 struct TypeList { 45 46 TypeList() : params() {} 46 TypeList( std::vector< ast::ptr< ast::Type >> const & params ) :47 TypeList( ast::vector< ast::Type > const & params ) : 47 48 params( params ) {} 48 TypeList( std::vector< ast::ptr< ast::Type >> && params ) :49 TypeList( ast::vector< ast::Type > && params ) : 49 50 params( std::move( params ) ) {} 50 51 TypeList( TypeList const & that ) : params( that.params ) {} 51 52 TypeList( TypeList && that ) : params( std::move( that.params ) ) {} 52 53 53 TypeList( std::vector< ast::ptr< ast::TypeExpr >> const & exprs ) :54 TypeList( ast::vector< ast::TypeExpr > const & exprs ) : 54 55 params() { 55 56 for ( auto expr : exprs ) { … … 82 83 } 83 84 84 std::vector<ast::ptr<ast::Type>> params;85 ast::vector<ast::Type> params; 85 86 }; 86 87 … … 103 104 /// returns null if no such value exists. 104 105 ast::AggregateDecl const * lookup( 105 ast::AggregateDecl const * key, type_vector const & params ) const { 106 ast::AggregateDecl const * key, 107 type_vector const & params ) const { 106 108 // This type repackaging is used for the helpers. 107 109 ast::ptr<ast::AggregateDecl> ptr = key; … … 150 152 } 151 153 152 bool isDtypeStatic( std::vector<ast::ptr<ast::TypeDecl>> const & baseParams ) {154 bool isDtypeStatic( ast::vector<ast::TypeDecl> const & baseParams ) { 153 155 return std::all_of( baseParams.begin(), baseParams.end(), 154 156 []( ast::TypeDecl const * td ){ return !td->isComplete(); } … … 161 163 /// least one parameter type, and dynamic if there is no concrete instantiation. 162 164 GenericType makeSubstitutions( 163 std::vector<ast::ptr<ast::TypeExpr>> & out,164 std::vector<ast::ptr<ast::TypeDecl>> const & baseParams,165 std::vector<ast::ptr<ast::Expr>> const & params ) {165 ast::vector<ast::TypeExpr> & out, 166 ast::vector<ast::TypeDecl> const & baseParams, 167 ast::vector<ast::Expr> const & params ) { 166 168 GenericType gt = GenericType::dtypeStatic; 167 169 … … 214 216 /// Substitutes types of members according to baseParams => typeSubs, 215 217 /// returning the result in a new vector. 216 std::vector<ast::ptr<ast::Decl>> substituteMembers(217 std::vector<ast::ptr<ast::Decl>> const & members,218 std::vector<ast::ptr<ast::TypeDecl>> const & baseParams,219 std::vector<ast::ptr<ast::TypeExpr>> const & typeSubs ) {220 std::vector<ast::ptr<ast::Decl>> out;218 ast::vector<ast::Decl> substituteMembers( 219 ast::vector<ast::Decl> const & members, 220 ast::vector<ast::TypeDecl> const & baseParams, 221 ast::vector<ast::TypeExpr> const & typeSubs ) { 222 ast::vector<ast::Decl> out; 221 223 ast::TypeSubstitution subs( baseParams, typeSubs ); 222 224 for ( ast::ptr<ast::Decl> const & member : members ) { … … 235 237 /// modifying them in-place. 236 238 void substituteMembersHere( 237 std::vector<ast::ptr<ast::Decl>> & members,238 std::vector<ast::ptr<ast::TypeDecl>> const & baseParams,239 std::vector<ast::ptr<ast::TypeExpr>> const & typeSubs ) {239 ast::vector<ast::Decl> & members, 240 ast::vector<ast::TypeDecl> const & baseParams, 241 ast::vector<ast::TypeExpr> const & typeSubs ) { 240 242 ast::TypeSubstitution subs( baseParams, typeSubs ); 241 243 for ( ast::ptr<ast::Decl> & member : members ) { … … 285 287 286 288 ast::Expr const * fixMemberExpr( 287 std::vector<ast::ptr<ast::TypeDecl>> const & baseParams,289 ast::vector<ast::TypeDecl> const & baseParams, 288 290 ast::MemberExpr const * memberExpr ); 289 291 … … 349 351 350 352 ast::Expr const * FixDtypeStatic::fixMemberExpr( 351 std::vector<ast::ptr<ast::TypeDecl>> const & baseParams,353 ast::vector<ast::TypeDecl> const & baseParams, 352 354 ast::MemberExpr const * memberExpr ) { 353 355 // Need to cast dtype-static member expressions to their actual type … … 461 463 type_vector const & typeSubs, ast::UnionDecl const * decl ); 462 464 463 void replaceParametersWithConcrete( std::vector<ast::ptr<ast::Expr>> & params );465 void replaceParametersWithConcrete( ast::vector<ast::Expr> & params ); 464 466 ast::Type const * replaceWithConcrete( ast::Type const * type, bool doClone ); 465 467 … … 470 472 /// marks it as stripped. 471 473 void stripDtypeParams( ast::AggregateDecl * base, 472 std::vector<ast::ptr<ast::TypeDecl>> & baseParams,473 std::vector<ast::ptr<ast::TypeExpr>> const & typeSubs );474 ast::vector<ast::TypeDecl> & baseParams, 475 ast::vector<ast::TypeExpr> const & typeSubs ); 474 476 }; 475 477 … … 511 513 // and put substitutions in typeSubs. 512 514 assertf( inst->base, "Base data-type has parameters." ); 513 std::vector<ast::ptr<ast::TypeExpr>> typeSubs;515 ast::vector<ast::TypeExpr> typeSubs; 514 516 GenericType gt = makeSubstitutions( typeSubs, inst->base->params, inst->params ); 515 517 switch ( gt ) { … … 570 572 ast::AggregateDecl const * aggr = 571 573 expr->aggregate->result.strict_as<ast::BaseInstType>()->aggr(); 572 std::vector<ast::ptr<ast::Decl>> const & members = aggr->members;574 ast::vector<ast::Decl> const & members = aggr->members; 573 575 auto it = std::find( members.begin(), members.end(), expr->member ); 574 576 memberIndex = std::distance( members.begin(), it ); … … 643 645 644 646 void GenericInstantiator::replaceParametersWithConcrete( 645 std::vector<ast::ptr<ast::Expr>> & params ) {647 ast::vector<ast::Expr> & params ) { 646 648 for ( ast::ptr<ast::Expr> & param : params ) { 647 649 auto paramType = param.as<ast::TypeExpr>(); … … 673 675 void GenericInstantiator::stripDtypeParams( 674 676 ast::AggregateDecl * base, 675 std::vector<ast::ptr<ast::TypeDecl>> & baseParams,676 std::vector<ast::ptr<ast::TypeExpr>> const & typeSubs ) {677 ast::vector<ast::TypeDecl> & baseParams, 678 ast::vector<ast::TypeExpr> const & typeSubs ) { 677 679 substituteMembersHere( base->members, baseParams, typeSubs ); 678 680 -
src/Parser/ParseNode.h
rdf6cc9d r1a45263 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Oct 18 1 4:15:37202213 // Update Count : 93 612 // Last Modified On : Tue Oct 18 16:22:15 2022 13 // Update Count : 937 14 14 // 15 15 … … 468 468 cur = dynamic_cast< const NodeType * >( temp ); // should not return nullptr 469 469 if ( ! cur && temp ) { // non-homogeneous nodes ? 470 SemanticError( cur->location, "internal error, non-homogeneous nodes founds in buildList processing." );470 SemanticError( temp->location, "internal error, non-homogeneous nodes founds in buildList processing." ); 471 471 } // if 472 472 } // while
Note: See TracChangeset
for help on using the changeset viewer.