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