diff options
author | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-22 17:43:43 -0300 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-22 17:43:43 -0300 |
commit | a926878ddbd5a98b272c22171ce58663fc04c3e0 (patch) | |
tree | 86af256e5d9a9c06263c00adc90e5fe348008c43 /gcc/go/gofrontend/escape.cc | |
parent | 542730f087133690b47e036dfd43eb0db8a650ce (diff) | |
parent | 07cbaed8ba7d1b6e4ab3a9f44175502a4e1ecdb1 (diff) | |
download | gcc-devel/autopar_devel.zip gcc-devel/autopar_devel.tar.gz gcc-devel/autopar_devel.tar.bz2 |
Merge branch 'autopar_rebase2' into autopar_develdevel/autopar_devel
Quickly commit changes in the rebase branch.
Diffstat (limited to 'gcc/go/gofrontend/escape.cc')
-rw-r--r-- | gcc/go/gofrontend/escape.cc | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/gcc/go/gofrontend/escape.cc b/gcc/go/gofrontend/escape.cc index 0d38858..8962f3f 100644 --- a/gcc/go/gofrontend/escape.cc +++ b/gcc/go/gofrontend/escape.cc @@ -142,18 +142,22 @@ Node::ast_format(Gogo* gogo) const else if (this->expr() != NULL) { Expression* e = this->expr(); + bool is_call = e->call_expression() != NULL; if (is_call) - e->call_expression()->fn(); + e = e->call_expression()->fn(); Func_expression* fe = e->func_expression();; - - bool is_closure = fe != NULL && fe->closure() != NULL; - if (is_closure) + if (fe != NULL) { - if (is_call) - return "(func literal)()"; - return "func literal"; + Named_object* no = fe->named_object(); + if (no->is_function() && no->func_value()->enclosing() != NULL) + { + if (is_call) + return "(func literal)()"; + return "func literal"; + } } + Ast_dump_context::dump_to_stream(this->expr(), &ss); } else if (this->statement() != NULL) @@ -1172,11 +1176,14 @@ Escape_discover_expr::expression(Expression** pexpr) // Method call or function call. fn = e->call_expression()->fn()->func_expression()->named_object(); } - else if (e->func_expression() != NULL - && e->func_expression()->closure() != NULL) + else if (e->func_expression() != NULL) { - // Closure. - fn = e->func_expression()->named_object(); + Named_object* no = e->func_expression()->named_object(); + if (no->is_function() && no->func_value()->enclosing() != NULL) + { + // Nested function. + fn = no; + } } if (fn != NULL) |