Changeset 24ceace for src/ResolvExpr
- Timestamp:
- May 2, 2022, 3:19:03 AM (3 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 12bb5ab1, 49a1684
- Parents:
- 9e7236f4 (diff), 4b4f95f (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
r9e7236f4 r24ceace 10 10 // Created On : Sun May 17 12:17:01 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Mar 1810:41:00 202213 // Update Count : 24 712 // Last Modified On : Wed Apr 20 10:41:00 2022 13 // Update Count : 248 14 14 // 15 15 … … 1722 1722 // Resolve all clauses first 1723 1723 for ( unsigned i = 0; i < stmt->clauses.size(); ++i ) { 1724 const ast::WaitFor Stmt::Clause & clause =stmt->clauses[i];1724 const ast::WaitForClause & clause = *stmt->clauses[i]; 1725 1725 1726 1726 ast::TypeEnvironment env; … … 1728 1728 1729 1729 // Find all candidates for a function in canonical form 1730 funcFinder.find( clause.target .func, ResolvMode::withAdjustment() );1730 funcFinder.find( clause.target_func, ResolvMode::withAdjustment() ); 1731 1731 1732 1732 if ( funcFinder.candidates.empty() ) { 1733 1733 stringstream ss; 1734 1734 ss << "Use of undeclared indentifier '"; 1735 ss << clause.target .func.strict_as< ast::NameExpr >()->name;1735 ss << clause.target_func.strict_as< ast::NameExpr >()->name; 1736 1736 ss << "' in call to waitfor"; 1737 1737 SemanticError( stmt->location, ss.str() ); 1738 1738 } 1739 1739 1740 if ( clause.target .args.empty() ) {1740 if ( clause.target_args.empty() ) { 1741 1741 SemanticError( stmt->location, 1742 1742 "Waitfor clause must have at least one mutex parameter"); … … 1745 1745 // Find all alternatives for all arguments in canonical form 1746 1746 std::vector< CandidateFinder > argFinders = 1747 funcFinder.findSubExprs( clause.target .args );1747 funcFinder.findSubExprs( clause.target_args ); 1748 1748 1749 1749 // List all combinations of arguments … … 1918 1918 1919 1919 // build new clause 1920 a st::WaitForStmt::Clause clause2;1921 1922 clause2 .target.func = funcCandidates.front()->expr;1923 1924 clause2 .target.args.reserve( clause.target.args.size() );1920 auto clause2 = new ast::WaitForClause( clause.location ); 1921 1922 clause2->target_func = funcCandidates.front()->expr; 1923 1924 clause2->target_args.reserve( clause.target_args.size() ); 1925 1925 const ast::StructDecl * decl_monitor = symtab.lookupStruct( "monitor$" ); 1926 1926 for ( auto arg : argsCandidates.front() ) { … … 1939 1939 ); 1940 1940 1941 clause2 .target.args.emplace_back( findSingleExpression( init, context ) );1941 clause2->target_args.emplace_back( findSingleExpression( init, context ) ); 1942 1942 } 1943 1943 1944 1944 // Resolve the conditions as if it were an IfStmt, statements normally 1945 clause2 .cond = findSingleExpression( clause.cond, context );1946 clause2 .stmt = clause.stmt->accept( *visitor );1945 clause2->cond = findSingleExpression( clause.cond, context ); 1946 clause2->stmt = clause.stmt->accept( *visitor ); 1947 1947 1948 1948 // set results into stmt 1949 1949 auto n = mutate( stmt ); 1950 n->clauses[i] = std::move( clause2 );1950 n->clauses[i] = clause2; 1951 1951 stmt = n; 1952 1952 } 1953 1953 1954 if ( stmt->timeout .stmt ) {1954 if ( stmt->timeout_stmt ) { 1955 1955 // resolve the timeout as a size_t, the conditions like IfStmt, and stmts normally 1956 ast::WaitForStmt::Timeout timeout2;1957 1958 1956 ast::ptr< ast::Type > target = 1959 1957 new ast::BasicType{ ast::BasicType::LongLongUnsignedInt }; 1960 timeout2.time = findSingleExpression( stmt->timeout.time, target, context );1961 timeout2.cond = findSingleExpression( stmt->timeout.cond, context );1962 timeout2.stmt = stmt->timeout.stmt->accept( *visitor );1958 auto timeout_time = findSingleExpression( stmt->timeout_time, target, context ); 1959 auto timeout_cond = findSingleExpression( stmt->timeout_cond, context ); 1960 auto timeout_stmt = stmt->timeout_stmt->accept( *visitor ); 1963 1961 1964 1962 // set results into stmt 1965 1963 auto n = mutate( stmt ); 1966 n->timeout = std::move( timeout2 ); 1964 n->timeout_time = std::move( timeout_time ); 1965 n->timeout_cond = std::move( timeout_cond ); 1966 n->timeout_stmt = std::move( timeout_stmt ); 1967 1967 stmt = n; 1968 1968 } 1969 1969 1970 if ( stmt-> orElse.stmt ) {1970 if ( stmt->else_stmt ) { 1971 1971 // resolve the condition like IfStmt, stmts normally 1972 ast::WaitForStmt::OrElse orElse2; 1973 1974 orElse2.cond = findSingleExpression( stmt->orElse.cond, context ); 1975 orElse2.stmt = stmt->orElse.stmt->accept( *visitor ); 1972 auto else_cond = findSingleExpression( stmt->else_cond, context ); 1973 auto else_stmt = stmt->else_stmt->accept( *visitor ); 1976 1974 1977 1975 // set results into stmt 1978 1976 auto n = mutate( stmt ); 1979 n->orElse = std::move( orElse2 ); 1977 n->else_cond = std::move( else_cond ); 1978 n->else_stmt = std::move( else_stmt ); 1980 1979 stmt = n; 1981 1980 }
Note: See TracChangeset
for help on using the changeset viewer.