Changeset 8a930c03 for src/ResolvExpr/Resolver.cc
- Timestamp:
- Jun 12, 2023, 12:05:58 PM (2 years ago)
- Branches:
- master
- Children:
- fec8bd1
- Parents:
- 2b78949 (diff), 38e266ca (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
r2b78949 r8a930c03 1106 1106 1107 1107 /// Removes cast to type of argument (unlike StripCasts, also handles non-generated casts) 1108 void removeExtraneousCast( ast::ptr<ast::Expr> & expr , const ast::SymbolTable & symtab) {1108 void removeExtraneousCast( ast::ptr<ast::Expr> & expr ) { 1109 1109 if ( const ast::CastExpr * castExpr = expr.as< ast::CastExpr >() ) { 1110 if ( typesCompatible( castExpr->arg->result, castExpr->result , symtab) ) {1110 if ( typesCompatible( castExpr->arg->result, castExpr->result ) ) { 1111 1111 // cast is to the same type as its argument, remove it 1112 1112 swap_and_save_env( expr, castExpr->arg ); … … 1196 1196 ast::ptr< ast::Expr > castExpr = new ast::CastExpr{ untyped, type }; 1197 1197 ast::ptr< ast::Expr > newExpr = findSingleExpression( castExpr, context ); 1198 removeExtraneousCast( newExpr , context.symtab);1198 removeExtraneousCast( newExpr ); 1199 1199 return newExpr; 1200 1200 } … … 1261 1261 static size_t traceId; 1262 1262 Resolver_new( const ast::TranslationGlobal & global ) : 1263 ast::WithSymbolTable(ast::SymbolTable::ErrorDetection::ValidateOnAdd), 1263 1264 context{ symtab, global } {} 1264 1265 Resolver_new( const ResolveContext & context ) : … … 1834 1835 if ( 1835 1836 ! unify( 1836 arg->expr->result, *param, resultEnv, need, have, open, 1837 symtab ) 1837 arg->expr->result, *param, resultEnv, need, have, open ) 1838 1838 ) { 1839 1839 // Type doesn't match … … 2041 2041 const ast::Type * initContext = currentObject.getCurrentType(); 2042 2042 2043 removeExtraneousCast( newExpr , symtab);2043 removeExtraneousCast( newExpr ); 2044 2044 2045 2045 // check if actual object's type is char[]
Note:
See TracChangeset
for help on using the changeset viewer.