Changes in src/ResolvExpr/Resolver.cc [7583c02:2dda05d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
r7583c02 r2dda05d 986 986 }; 987 987 } // anonymous namespace 988 988 989 /// Check if this expression is or includes a deleted expression 989 990 const ast::DeletedExpr * findDeletedExpr( const ast::Expr * expr ) { … … 1151 1152 const ast::Expr * untyped, const ast::SymbolTable & symtab 1152 1153 ) { 1154 resetTyVarRenaming(); 1153 1155 ast::TypeEnvironment env; 1154 1156 ast::ptr< ast::Expr > newExpr = resolveInVoidContext( untyped, symtab, env ); … … 1310 1312 } 1311 1313 1312 const ast::Expr *resolveStmtExpr(1314 ast::ptr< ast::Expr > resolveStmtExpr( 1313 1315 const ast::StmtExpr * stmtExpr, const ast::SymbolTable & symtab 1314 1316 ) { 1315 1317 assert( stmtExpr ); 1316 1318 ast::Pass< Resolver_new > resolver{ symtab }; 1317 auto ret = mutate(stmtExpr->accept(resolver)); 1318 strict_dynamic_cast< ast::StmtExpr * >( ret )->computeResult(); 1319 ast::ptr< ast::Expr > ret = stmtExpr; 1320 ret = ret->accept( resolver ); 1321 strict_dynamic_cast< ast::StmtExpr * >( ret.get_and_mutate() )->computeResult(); 1319 1322 return ret; 1320 1323 } … … 1372 1375 } 1373 1376 1374 // handle assertions 1377 // handle assertions. (seems deep) 1375 1378 1376 1379 symtab.enterScope(); 1377 mutType->forall.clear(); 1378 mutType->assertions.clear(); 1379 for (auto & typeParam : mutDecl->type_params) { 1380 symtab.addType(typeParam); 1381 mutType->forall.emplace_back(new ast::TypeInstType(typeParam->name, typeParam)); 1382 } 1383 for (auto & asst : mutDecl->assertions) { 1384 asst = fixObjectType(asst.strict_as<ast::ObjectDecl>(), symtab); 1385 symtab.addId(asst); 1386 mutType->assertions.emplace_back(new ast::VariableExpr(functionDecl->location, asst)); 1380 for (auto & typeParam : mutType->forall) { 1381 auto mutParam = typeParam.get_and_mutate(); 1382 symtab.addType(mutParam); 1383 for (auto & asst : mutParam->assertions) { 1384 asst = fixObjectType(asst.strict_as<ast::ObjectDecl>(), symtab); 1385 symtab.addId(asst); 1386 } 1387 typeParam = mutParam; 1387 1388 } 1388 1389 … … 1406 1407 mutType->returns = std::move(returnTypes); 1407 1408 1408 auto renamedType = strict_dynamic_cast<const ast::FunctionType *>(renameTyVars(mutType, RenameMode::GEN_EXPR_ID));1409 1410 1409 std::list<ast::ptr<ast::Stmt>> newStmts; 1411 1410 resolveWithExprs (mutDecl->withExprs, newStmts); … … 1419 1418 symtab.leaveScope(); 1420 1419 1421 mutDecl->type = renamedType;1422 1420 mutDecl->mangleName = Mangle::mangle(mutDecl); 1423 1421 mutDecl->isTypeFixed = true; … … 1536 1534 const PtrType * handlePtrType( const PtrType * type, const ast::SymbolTable & symtab ) { 1537 1535 if ( type->dimension ) { 1538 ast::ptr< ast::Type > sizeType = ast::sizeType; 1536 #warning should use new equivalent to Validate::SizeType rather than sizeType here 1537 ast::ptr< ast::Type > sizeType = new ast::BasicType{ ast::BasicType::LongUnsignedInt }; 1539 1538 ast::mutate_field( 1540 1539 type, &PtrType::dimension,
Note: See TracChangeset
for help on using the changeset viewer.