From 064c6e4815b212d72f008082939376f570897c19 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Thu, 3 Dec 2020 15:34:15 +0000 Subject: Type Resolve ReturnExpr's to ensure they match the function type. This an implementation to check return types for functions it needs work to handle structs and other data structures later on. --- gcc/rust/backend/rust-compile.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/rust/backend') diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc index 2dbce16..820f880 100644 --- a/gcc/rust/backend/rust-compile.cc +++ b/gcc/rust/backend/rust-compile.cc @@ -805,10 +805,10 @@ void Compilation::visit (AST::ReturnExpr &expr) { Bexpression *ret = NULL; - VISIT_POP (expr.return_expr->get_locus_slow (), expr.return_expr, ret, exprs); + VISIT_POP (expr.get_expr ()->get_locus_slow (), expr.get_expr (), ret, exprs); if (ret == NULL) { - rust_fatal_error (expr.return_expr->get_locus_slow (), + rust_fatal_error (expr.get_expr ()->get_locus_slow (), "failed to compile"); return; } @@ -816,7 +816,7 @@ Compilation::visit (AST::ReturnExpr &expr) std::vector retstmts; retstmts.push_back (ret); auto s = backend->return_statement (scope.GetCurrentFndecl (), retstmts, - expr.locus); + expr.get_locus ()); scope.AddStatement (s); } -- cgit v1.1