Changeset a935892 for src/ResolvExpr
- Timestamp:
- Jun 3, 2019, 10:54:01 AM (7 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 0e315a5, dafe9e1
- Parents:
- 043a5b6 (diff), 8d70648 (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. - Location:
- src/ResolvExpr
- Files:
-
- 7 edited
-
AlternativeFinder.cc (modified) (2 diffs)
-
ResolveAssertions.cc (modified) (2 diffs)
-
Resolver.cc (modified) (28 diffs)
-
Resolver.h (modified) (3 diffs)
-
Unify.cc (modified) (4 diffs)
-
Unify.h (modified) (2 diffs)
-
typeops.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
r043a5b6 ra935892 28 28 #include "Alternative.h" // for AltList, Alternative 29 29 #include "AlternativeFinder.h" 30 #include "AST/Expr.hpp" 31 #include "AST/Type.hpp" 30 32 #include "Common/SemanticError.h" // for SemanticError 31 33 #include "Common/utility.h" // for deleteAll, printAll, CodeLocation … … 222 224 cost.incReference(); 223 225 } 226 } 227 228 const ast::Expr * referenceToRvalueConversion( const ast::Expr * expr, Cost & cost ) { 229 if ( expr->result.as< ast::ReferenceType >() ) { 230 // cast away reference from expr 231 cost.incReference(); 232 return new ast::CastExpr{ expr->location, expr, expr->result->stripReferences() }; 233 } 234 235 return expr; 224 236 } 225 237 -
src/ResolvExpr/ResolveAssertions.cc
r043a5b6 ra935892 30 30 #include "Common/Indenter.h" // for Indenter 31 31 #include "Common/utility.h" // for sort_mins 32 #include "GenPoly/GenPoly.h" // for getFunctionType 32 33 #include "ResolvExpr/RenameVars.h" // for renameTyVars 33 34 #include "SymTab/Indexer.h" // for Indexer … … 154 155 Cost k = Cost::zero; 155 156 for ( const auto& assn : x.assns ) { 157 // compute conversion cost from satisfying decl to assertion 156 158 k += computeConversionCost( 157 159 assn.match.adjType, assn.decl->get_type(), indexer, x.env ); 158 160 159 161 // mark vars+specialization cost on function-type assertions 160 Type* assnType = assn.match.cdata.id->get_type(); 161 FunctionType* func; 162 if ( PointerType* ptr = dynamic_cast< PointerType* >( assnType ) ) { 163 func = dynamic_cast< FunctionType* >( ptr->base ); 164 } else { 165 func = dynamic_cast< FunctionType* >( assnType ); 166 } 162 FunctionType* func = GenPoly::getFunctionType( assn.match.cdata.id->get_type() ); 167 163 if ( ! func ) continue; 168 164 -
src/ResolvExpr/Resolver.cc
r043a5b6 ra935892 7 7 // Resolver.cc -- 8 8 // 9 // Author : Richard C. Bilson9 // Author : Aaron B. Moss 10 10 // Created On : Sun May 17 12:17:01 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Tue Feb 19 18:09:56201913 // Update Count : 24 011 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Wed May 29 11:00:00 2019 13 // Update Count : 241 14 14 // 15 15 … … 21 21 #include "Alternative.h" // for Alternative, AltList 22 22 #include "AlternativeFinder.h" // for AlternativeFinder, resolveIn... 23 #include "CurrentObject.h" // for CurrentObject 24 #include "RenameVars.h" // for RenameVars, global_renamer 25 #include "Resolver.h" 26 #include "ResolvMode.h" // for ResolvMode 27 #include "typeops.h" // for extractResultType 28 #include "Unify.h" // for unify 29 #include "AST/Pass.hpp" 30 #include "AST/SymbolTable.hpp" 23 31 #include "Common/PassVisitor.h" // for PassVisitor 24 32 #include "Common/SemanticError.h" // for SemanticError 25 33 #include "Common/utility.h" // for ValueGuard, group_iterate 26 #include "CurrentObject.h" // for CurrentObject27 34 #include "InitTweak/GenInit.h" 28 35 #include "InitTweak/InitTweak.h" // for isIntrinsicSingleArgCallStmt 29 #include "RenameVars.h" // for RenameVars, global_renamer30 36 #include "ResolvExpr/TypeEnvironment.h" // for TypeEnvironment 31 #include "Resolver.h"32 #include "ResolvMode.h" // for ResolvMode33 37 #include "SymTab/Autogen.h" // for SizeType 34 38 #include "SymTab/Indexer.h" // for Indexer … … 41 45 #include "SynTree/Visitor.h" // for acceptAll, maybeAccept 42 46 #include "Tuples/Tuples.h" 43 #include "typeops.h" // for extractResultType44 #include "Unify.h" // for unify45 47 #include "Validate/FindSpecialDecls.h" // for SizeType 46 48 … … 48 50 49 51 namespace ResolvExpr { 50 struct Resolver final : public WithIndexer, public WithGuards, public WithVisitorRef<Resolver>, public WithShortCircuiting, public WithStmtsToAdd {51 Resolver () {}52 Resolver ( const SymTab::Indexer & other ) {52 struct Resolver_old final : public WithIndexer, public WithGuards, public WithVisitorRef<Resolver_old>, public WithShortCircuiting, public WithStmtsToAdd { 53 Resolver_old() {} 54 Resolver_old( const SymTab::Indexer & other ) { 53 55 indexer = other; 54 56 } … … 101 103 102 104 void resolve( std::list< Declaration * > translationUnit ) { 103 PassVisitor<Resolver > resolver;105 PassVisitor<Resolver_old> resolver; 104 106 acceptAll( translationUnit, resolver ); 105 107 } 106 108 107 109 void resolveDecl( Declaration * decl, const SymTab::Indexer & indexer ) { 108 PassVisitor<Resolver > resolver( indexer );110 PassVisitor<Resolver_old> resolver( indexer ); 109 111 maybeAccept( decl, resolver ); 110 112 } … … 402 404 } 403 405 404 void Resolver ::previsit( ObjectDecl * objectDecl ) {405 // To handle initialization of routine pointers, e.g., int (*fp)(int) = foo(), means that 406 // class-variable initContext is changed multiple time because the LHS is analysed twice. 407 // The second analysis changes initContext because of a function type can contain object 408 // declarations in the return and parameter types. So each value of initContext is 406 void Resolver_old::previsit( ObjectDecl * objectDecl ) { 407 // To handle initialization of routine pointers, e.g., int (*fp)(int) = foo(), means that 408 // class-variable initContext is changed multiple time because the LHS is analysed twice. 409 // The second analysis changes initContext because of a function type can contain object 410 // declarations in the return and parameter types. So each value of initContext is 409 411 // retained, so the type on the first analysis is preserved and used for selecting the RHS. 410 412 GuardValue( currentObject ); … … 418 420 419 421 template< typename PtrType > 420 void Resolver ::handlePtrType( PtrType * type ) {422 void Resolver_old::handlePtrType( PtrType * type ) { 421 423 if ( type->get_dimension() ) { 422 424 findSingleExpression( type->dimension, Validate::SizeType->clone(), indexer ); … … 424 426 } 425 427 426 void Resolver ::previsit( ArrayType * at ) {428 void Resolver_old::previsit( ArrayType * at ) { 427 429 handlePtrType( at ); 428 430 } 429 431 430 void Resolver ::previsit( PointerType * pt ) {432 void Resolver_old::previsit( PointerType * pt ) { 431 433 handlePtrType( pt ); 432 434 } 433 435 434 void Resolver ::previsit( FunctionDecl * functionDecl ) {436 void Resolver_old::previsit( FunctionDecl * functionDecl ) { 435 437 #if 0 436 438 std::cerr << "resolver visiting functiondecl "; … … 442 444 } 443 445 444 void Resolver ::postvisit( FunctionDecl * functionDecl ) {445 // default value expressions have an environment which shouldn't be there and trips up 446 void Resolver_old::postvisit( FunctionDecl * functionDecl ) { 447 // default value expressions have an environment which shouldn't be there and trips up 446 448 // later passes. 447 449 // xxx - it might be necessary to somehow keep the information from this environment, but I … … 457 459 } 458 460 459 void Resolver ::previsit( EnumDecl * ) {461 void Resolver_old::previsit( EnumDecl * ) { 460 462 // in case we decide to allow nested enums 461 463 GuardValue( inEnumDecl ); … … 463 465 } 464 466 465 void Resolver ::previsit( StaticAssertDecl * assertDecl ) {467 void Resolver_old::previsit( StaticAssertDecl * assertDecl ) { 466 468 findIntegralExpression( assertDecl->condition, indexer ); 467 469 } 468 470 469 void Resolver ::previsit( ExprStmt * exprStmt ) {471 void Resolver_old::previsit( ExprStmt * exprStmt ) { 470 472 visit_children = false; 471 473 assertf( exprStmt->expr, "ExprStmt has null Expression in resolver" ); … … 473 475 } 474 476 475 void Resolver ::previsit( AsmExpr * asmExpr ) {477 void Resolver_old::previsit( AsmExpr * asmExpr ) { 476 478 visit_children = false; 477 479 findVoidExpression( asmExpr->operand, indexer ); … … 481 483 } 482 484 483 void Resolver ::previsit( AsmStmt * asmStmt ) {485 void Resolver_old::previsit( AsmStmt * asmStmt ) { 484 486 visit_children = false; 485 487 acceptAll( asmStmt->get_input(), *visitor ); … … 487 489 } 488 490 489 void Resolver ::previsit( IfStmt * ifStmt ) {491 void Resolver_old::previsit( IfStmt * ifStmt ) { 490 492 findIntegralExpression( ifStmt->condition, indexer ); 491 493 } 492 494 493 void Resolver ::previsit( WhileStmt * whileStmt ) {495 void Resolver_old::previsit( WhileStmt * whileStmt ) { 494 496 findIntegralExpression( whileStmt->condition, indexer ); 495 497 } 496 498 497 void Resolver ::previsit( ForStmt * forStmt ) {499 void Resolver_old::previsit( ForStmt * forStmt ) { 498 500 if ( forStmt->condition ) { 499 501 findIntegralExpression( forStmt->condition, indexer ); … … 505 507 } 506 508 507 void Resolver ::previsit( SwitchStmt * switchStmt ) {509 void Resolver_old::previsit( SwitchStmt * switchStmt ) { 508 510 GuardValue( currentObject ); 509 511 findIntegralExpression( switchStmt->condition, indexer ); … … 512 514 } 513 515 514 void Resolver ::previsit( CaseStmt * caseStmt ) {516 void Resolver_old::previsit( CaseStmt * caseStmt ) { 515 517 if ( caseStmt->condition ) { 516 518 std::list< InitAlternative > initAlts = currentObject.getOptions(); … … 531 533 } 532 534 533 void Resolver ::previsit( BranchStmt * branchStmt ) {535 void Resolver_old::previsit( BranchStmt * branchStmt ) { 534 536 visit_children = false; 535 537 // must resolve the argument for a computed goto … … 542 544 } 543 545 544 void Resolver ::previsit( ReturnStmt * returnStmt ) {546 void Resolver_old::previsit( ReturnStmt * returnStmt ) { 545 547 visit_children = false; 546 548 if ( returnStmt->expr ) { … … 549 551 } 550 552 551 void Resolver ::previsit( ThrowStmt * throwStmt ) {553 void Resolver_old::previsit( ThrowStmt * throwStmt ) { 552 554 visit_children = false; 553 555 // TODO: Replace *exception type with &exception type. … … 561 563 } 562 564 563 void Resolver ::previsit( CatchStmt * catchStmt ) {565 void Resolver_old::previsit( CatchStmt * catchStmt ) { 564 566 if ( catchStmt->cond ) { 565 567 findSingleExpression( catchStmt->cond, new BasicType( noQualifiers, BasicType::Bool ), indexer ); … … 576 578 } 577 579 578 void Resolver ::previsit( WaitForStmt * stmt ) {580 void Resolver_old::previsit( WaitForStmt * stmt ) { 579 581 visit_children = false; 580 582 … … 782 784 } 783 785 784 void Resolver ::previsit( SingleInit * singleInit ) {786 void Resolver_old::previsit( SingleInit * singleInit ) { 785 787 visit_children = false; 786 788 // resolve initialization using the possibilities as determined by the currentObject cursor … … 834 836 } 835 837 836 void Resolver ::previsit( ListInit * listInit ) {838 void Resolver_old::previsit( ListInit * listInit ) { 837 839 visit_children = false; 838 840 // move cursor into brace-enclosed initializer-list … … 869 871 870 872 // ConstructorInit - fall back on C-style initializer 871 void Resolver ::fallbackInit( ConstructorInit * ctorInit ) {873 void Resolver_old::fallbackInit( ConstructorInit * ctorInit ) { 872 874 // could not find valid constructor, or found an intrinsic constructor 873 875 // fall back on C-style initializer … … 882 884 void resolveCtorInit( ConstructorInit * ctorInit, const SymTab::Indexer & indexer ) { 883 885 assert( ctorInit ); 884 PassVisitor<Resolver > resolver( indexer );886 PassVisitor<Resolver_old> resolver( indexer ); 885 887 ctorInit->accept( resolver ); 886 888 } … … 888 890 void resolveStmtExpr( StmtExpr * stmtExpr, const SymTab::Indexer & indexer ) { 889 891 assert( stmtExpr ); 890 PassVisitor<Resolver > resolver( indexer );892 PassVisitor<Resolver_old> resolver( indexer ); 891 893 stmtExpr->accept( resolver ); 892 894 stmtExpr->computeResult(); … … 894 896 } 895 897 896 void Resolver ::previsit( ConstructorInit * ctorInit ) {898 void Resolver_old::previsit( ConstructorInit * ctorInit ) { 897 899 visit_children = false; 898 900 // xxx - fallback init has been removed => remove fallbackInit function and remove complexity from FixInit and remove C-init from ConstructorInit … … 928 930 // } 929 931 } 932 933 /////////////////////////////////////////////////////////////////////////// 934 // 935 // *** NEW RESOLVER *** 936 // 937 /////////////////////////////////////////////////////////////////////////// 938 939 class Resolver_new final 940 : public ast::WithIndexer, public ast::WithGuards, public ast::WithVisitorRef<Resolver_new>, 941 public ast::WithShortCircuiting, public ast::WithStmtsToAdd<> { 942 943 public: 944 Resolver_new() = default; 945 Resolver_new( const ast::SymbolTable & syms ) { /*symtab = syms;*/ } 946 947 void previsit( ast::FunctionDecl * functionDecl ); 948 ast::DeclWithType * postvisit( ast::FunctionDecl * functionDecl ); 949 void previsit( ast::ObjectDecl * objectDecl ); 950 void previsit( ast::EnumDecl * enumDecl ); 951 void previsit( ast::StaticAssertDecl * assertDecl ); 952 953 void previsit( ast::ArrayType * at ); 954 void previsit( ast::PointerType * pt ); 955 956 void previsit( ast::ExprStmt * exprStmt ); 957 void previsit( ast::AsmExpr * asmExpr ); 958 void previsit( ast::AsmStmt * asmStmt ); 959 void previsit( ast::IfStmt * ifStmt ); 960 void previsit( ast::WhileStmt * whileStmt ); 961 void previsit( ast::ForStmt * forStmt ); 962 void previsit( ast::SwitchStmt * switchStmt ); 963 void previsit( ast::CaseStmt * caseStmt ); 964 void previsit( ast::BranchStmt * branchStmt ); 965 void previsit( ast::ReturnStmt * returnStmt ); 966 void previsit( ast::ThrowStmt * throwStmt ); 967 void previsit( ast::CatchStmt * catchStmt ); 968 void previsit( ast::WaitForStmt * stmt ); 969 970 void previsit( ast::SingleInit * singleInit ); 971 void previsit( ast::ListInit * listInit ); 972 void previsit( ast::ConstructorInit * ctorInit ); 973 }; 974 975 void resolve( std::list< ast::ptr<ast::Decl> >& translationUnit ) { 976 ast::Pass<Resolver_new> resolver; 977 accept_all( translationUnit, resolver ); 978 } 979 980 void previsit( ast::FunctionDecl * functionDecl ) { 981 #warning unimplemented; Resolver port in progress 982 (void)functionDecl; 983 assert(false); 984 } 985 986 ast::DeclWithType * postvisit( ast::FunctionDecl * functionDecl ) { 987 #warning unimplemented; Resolver port in progress 988 (void)functionDecl; 989 assert(false); 990 return nullptr; 991 } 992 993 void previsit( ast::ObjectDecl * objectDecl ) { 994 #warning unimplemented; Resolver port in progress 995 (void)objectDecl; 996 assert(false); 997 } 998 999 void previsit( ast::EnumDecl * enumDecl ) { 1000 #warning unimplemented; Resolver port in progress 1001 (void)enumDecl; 1002 assert(false); 1003 } 1004 1005 void previsit( ast::StaticAssertDecl * assertDecl ) { 1006 #warning unimplemented; Resolver port in progress 1007 (void)assertDecl; 1008 assert(false); 1009 } 1010 1011 void previsit( ast::ArrayType * at ) { 1012 #warning unimplemented; Resolver port in progress 1013 (void)at; 1014 assert(false); 1015 } 1016 1017 void previsit( ast::PointerType * pt ) { 1018 #warning unimplemented; Resolver port in progress 1019 (void)pt; 1020 assert(false); 1021 } 1022 1023 void previsit( ast::ExprStmt * exprStmt ) { 1024 #warning unimplemented; Resolver port in progress 1025 (void)exprStmt; 1026 assert(false); 1027 } 1028 1029 void previsit( ast::AsmExpr * asmExpr ) { 1030 #warning unimplemented; Resolver port in progress 1031 (void)asmExpr; 1032 assert(false); 1033 } 1034 1035 void previsit( ast::AsmStmt * asmStmt ) { 1036 #warning unimplemented; Resolver port in progress 1037 (void)asmStmt; 1038 assert(false); 1039 } 1040 1041 void previsit( ast::IfStmt * ifStmt ) { 1042 #warning unimplemented; Resolver port in progress 1043 (void)ifStmt; 1044 assert(false); 1045 } 1046 1047 void previsit( ast::WhileStmt * whileStmt ) { 1048 #warning unimplemented; Resolver port in progress 1049 (void)whileStmt; 1050 assert(false); 1051 } 1052 1053 void previsit( ast::ForStmt * forStmt ) { 1054 #warning unimplemented; Resolver port in progress 1055 (void)forStmt; 1056 assert(false); 1057 } 1058 1059 void previsit( ast::SwitchStmt * switchStmt ) { 1060 #warning unimplemented; Resolver port in progress 1061 (void)switchStmt; 1062 assert(false); 1063 } 1064 1065 void previsit( ast::CaseStmt * caseStmt ) { 1066 #warning unimplemented; Resolver port in progress 1067 (void)caseStmt; 1068 assert(false); 1069 } 1070 1071 void previsit( ast::BranchStmt * branchStmt ) { 1072 #warning unimplemented; Resolver port in progress 1073 (void)branchStmt; 1074 assert(false); 1075 } 1076 1077 void previsit( ast::ReturnStmt * returnStmt ) { 1078 #warning unimplemented; Resolver port in progress 1079 (void)returnStmt; 1080 assert(false); 1081 } 1082 1083 void previsit( ast::ThrowStmt * throwStmt ) { 1084 #warning unimplemented; Resolver port in progress 1085 (void)throwStmt; 1086 assert(false); 1087 } 1088 1089 void previsit( ast::CatchStmt * catchStmt ) { 1090 #warning unimplemented; Resolver port in progress 1091 (void)catchStmt; 1092 assert(false); 1093 } 1094 1095 void previsit( ast::WaitForStmt * stmt ) { 1096 #warning unimplemented; Resolver port in progress 1097 (void)stmt; 1098 assert(false); 1099 } 1100 1101 void previsit( ast::SingleInit * singleInit ) { 1102 #warning unimplemented; Resolver port in progress 1103 (void)singleInit; 1104 assert(false); 1105 } 1106 1107 void previsit( ast::ListInit * listInit ) { 1108 #warning unimplemented; Resolver port in progress 1109 (void)listInit; 1110 assert(false); 1111 } 1112 1113 void previsit( ast::ConstructorInit * ctorInit ) { 1114 #warning unimplemented; Resolver port in progress 1115 (void)ctorInit; 1116 assert(false); 1117 } 1118 930 1119 } // namespace ResolvExpr 931 1120 -
src/ResolvExpr/Resolver.h
r043a5b6 ra935892 16 16 #pragma once 17 17 18 #include <list> // for list 18 #include <list> // for list 19 #include <AST/Node.hpp> // for ptr 19 20 20 21 class ConstructorInit; … … 23 24 class StmtExpr; 24 25 namespace SymTab { 25 class Indexer; 26 } // namespace SymTab 26 class Indexer; 27 } // namespace SymTab 28 29 namespace ast { 30 class Decl; 31 } // namespace ast 27 32 28 33 namespace ResolvExpr { … … 40 45 /// Resolves with-stmts and with-clauses on functions 41 46 void resolveWithExprs( std::list< Declaration * > & translationUnit ); 47 48 /// Checks types and binds syntactic constructs to typed representations 49 void resolve( std::list< ast::ptr<ast::Decl> >& translationUnit ); 42 50 } // namespace ResolvExpr 43 51 -
src/ResolvExpr/Unify.cc
r043a5b6 ra935892 14 14 // 15 15 16 #include <cassert> // for assertf, assert17 #include <iterator> // for back_insert_iterator, back_inserter18 #include <map> // for _Rb_tree_const_iterator, _Rb_tree_i...19 #include <memory> // for unique_ptr20 #include <set> // for set21 #include <string> // for string, operator==, operator!=, bas...22 #include <utility> // for pair, move16 #include <cassert> // for assertf, assert 17 #include <iterator> // for back_insert_iterator, back_inserter 18 #include <map> // for _Rb_tree_const_iterator, _Rb_tree_i... 19 #include <memory> // for unique_ptr 20 #include <set> // for set 21 #include <string> // for string, operator==, operator!=, bas... 22 #include <utility> // for pair, move 23 23 #include <vector> 24 24 25 25 #include "AST/Node.hpp" 26 26 #include "AST/Type.hpp" 27 #include "Common/PassVisitor.h" // for PassVisitor 28 #include "FindOpenVars.h" // for findOpenVars 29 #include "Parser/LinkageSpec.h" // for C 30 #include "SynTree/Constant.h" // for Constant 31 #include "SynTree/Declaration.h" // for TypeDecl, TypeDecl::Data, Declarati... 32 #include "SynTree/Expression.h" // for TypeExpr, Expression, ConstantExpr 33 #include "SynTree/Mutator.h" // for Mutator 34 #include "SynTree/Type.h" // for Type, TypeInstType, FunctionType 35 #include "SynTree/Visitor.h" // for Visitor 36 #include "Tuples/Tuples.h" // for isTtype 37 #include "TypeEnvironment.h" // for EqvClass, AssertionSet, OpenVarSet 27 #include "AST/TypeEnvironment.hpp" 28 #include "Common/PassVisitor.h" // for PassVisitor 29 #include "FindOpenVars.h" // for findOpenVars 30 #include "Parser/LinkageSpec.h" // for C 31 #include "SynTree/Constant.h" // for Constant 32 #include "SynTree/Declaration.h" // for TypeDecl, TypeDecl::Data, Declarati... 33 #include "SynTree/Expression.h" // for TypeExpr, Expression, ConstantExpr 34 #include "SynTree/Mutator.h" // for Mutator 35 #include "SynTree/Type.h" // for Type, TypeInstType, FunctionType 36 #include "SynTree/Visitor.h" // for Visitor 37 #include "Tuples/Tuples.h" // for isTtype 38 #include "TypeEnvironment.h" // for EqvClass, AssertionSet, OpenVarSet 38 39 #include "Unify.h" 39 #include "typeops.h" // for flatten, occurs, commonType40 #include "typeops.h" // for flatten, occurs, commonType 40 41 41 42 namespace SymTab { … … 106 107 delete newSecond; 107 108 return result; 109 } 110 111 bool typesCompatible( 112 const ast::Type * first, const ast::Type * second, const ast::SymbolTable & symtab, 113 const ast::TypeEnvironment & env ) { 114 #warning unimplemented 115 assert((first, second, symtab, env, false)); 116 return false; 108 117 } 109 118 … … 130 139 delete newSecond; 131 140 return result; 141 } 142 143 bool typesCompatibleIgnoreQualifiers( 144 const ast::Type * first, const ast::Type * second, const ast::SymbolTable & symtab, 145 const ast::TypeEnvironment & env ) { 146 #warning unimplemented 147 assert((first, second, symtab, env, false)); 148 return false; 132 149 } 133 150 … … 263 280 } 264 281 282 bool unifyInexact( 283 const ast::Type * type1, const ast::Type * type2, ast::TypeEnvironment & env, 284 ast::AssertionSet & need, ast::AssertionSet & have, const ast::OpenVarSet & openVars, 285 WidenMode widenMode, const ast::SymbolTable & symtab, const ast::Type *& common ) { 286 #warning unimplemented 287 assert((type1, type2, env, need, have, openVars, widenMode, symtab, common, false)); 288 return false; 289 } 290 265 291 Unify::Unify( Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ) 266 292 : result( false ), type2( type2 ), env( env ), needAssertions( needAssertions ), haveAssertions( haveAssertions ), openVars( openVars ), widenMode( widenMode ), indexer( indexer ) { -
src/ResolvExpr/Unify.h
r043a5b6 ra935892 18 18 #include <list> // for list 19 19 20 #include "AST/TypeEnvironment.hpp" // for TypeEnvironment, AssertionSet, OpenVarSet 20 21 #include "Common/utility.h" // for deleteAll 21 22 #include "SynTree/Declaration.h" // for TypeDecl, TypeDecl::Data 22 23 #include "TypeEnvironment.h" // for AssertionSet, OpenVarSet 23 #include "WidenMode.h" // for WidenMode24 #include "WidenMode.h" // for WidenMode 24 25 25 26 class Type; 26 27 class TypeInstType; 27 28 namespace SymTab { 28 class Indexer; 29 } // namespace SymTab 29 class Indexer; 30 } 31 32 namespace ast { 33 class SymbolTable; 34 class Type; 35 } 30 36 31 37 namespace ResolvExpr { … … 62 68 } 63 69 70 bool unifyInexact( 71 const ast::Type * type1, const ast::Type * type2, ast::TypeEnvironment & env, 72 ast::AssertionSet & need, ast::AssertionSet & have, const ast::OpenVarSet & openVars, 73 WidenMode widenMode, const ast::SymbolTable & symtab, const ast::Type *& common ); 74 64 75 } // namespace ResolvExpr 65 76 -
src/ResolvExpr/typeops.h
r043a5b6 ra935892 18 18 #include <vector> 19 19 20 #include "AST/Fwd.hpp" 20 21 #include "AST/Node.hpp" 22 #include "AST/SymbolTable.hpp" 21 23 #include "AST/Type.hpp" 24 #include "AST/TypeEnvironment.hpp" 22 25 #include "SynTree/SynTree.h" 23 26 #include "SynTree/Type.h" … … 99 102 } 100 103 104 bool typesCompatible( 105 const ast::Type *, const ast::Type *, const ast::SymbolTable &, 106 const ast::TypeEnvironment & env = {} ); 107 108 bool typesCompatibleIgnoreQualifiers( 109 const ast::Type *, const ast::Type *, const ast::SymbolTable &, 110 const ast::TypeEnvironment & env = {} ); 111 101 112 /// creates the type represented by the list of returnVals in a FunctionType. The caller owns the return value. 102 113 Type * extractResultType( FunctionType * functionType ); … … 115 126 // in Occurs.cc 116 127 bool occurs( Type *type, std::string varName, const TypeEnvironment &env ); 128 // new AST version in TypeEnvironment.cpp (only place it was used in old AST) 117 129 118 130 template<typename Iter> … … 127 139 // in AlternativeFinder.cc 128 140 void referenceToRvalueConversion( Expression *& expr, Cost & cost ); 141 const ast::Expr * referenceToRvalueConversion( const ast::Expr * expr, Cost & cost ); 129 142 130 143 // flatten tuple type into list of types
Note:
See TracChangeset
for help on using the changeset viewer.