Commit f6e31dff by Ian Lance Taylor

compiler: Check for initialization cycles in bound method expressions.

Fixes issue 7961.

From-SVN: r216342
parent 960224c3
...@@ -953,13 +953,14 @@ Find_var::expression(Expression** pexpr) ...@@ -953,13 +953,14 @@ Find_var::expression(Expression** pexpr)
} }
} }
// We traverse the code of any function we see. Note that this // We traverse the code of any function or bound method we see. Note that
// means that we will traverse the code of a function whose address // this means that we will traverse the code of a function or bound method
// is taken even if it is not called. // whose address is taken even if it is not called.
Func_expression* fe = e->func_expression(); Func_expression* fe = e->func_expression();
if (fe != NULL) Bound_method_expression* bme = e->bound_method_expression();
if (fe != NULL || bme != NULL)
{ {
const Named_object* f = fe->named_object(); const Named_object* f = fe != NULL ? fe->named_object() : bme->function();
if (f->is_function() && f->package() == NULL) if (f->is_function() && f->package() == NULL)
{ {
std::pair<Seen_objects::iterator, bool> ins = std::pair<Seen_objects::iterator, bool> ins =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment