| Index: src/scopes.cc
|
| diff --git a/src/scopes.cc b/src/scopes.cc
|
| index b796452e00589b17b837a0eb6b5224885d9c389b..364f2f1cf7ce88ca08e207172c1cba1613dbb3f7 100644
|
| --- a/src/scopes.cc
|
| +++ b/src/scopes.cc
|
| @@ -1138,6 +1138,30 @@ bool Scope::CheckStrongModeDeclaration(VariableProxy* proxy, Variable* var) {
|
| scope = scope->outer_scope();
|
| }
|
|
|
| + // Allow references from methods to classes declared later, if we detect no
|
| + // problematic dependency cycles.
|
| +
|
| + if (ClassVariableForMethod() && var->is_class()) {
|
| + // A method is referring to some other class, possibly declared
|
| + // later. Referring to a class declared earlier is always OK and covered by
|
| + // the code outside this if. Here we only need to allow special cases for
|
| + // referring to a class which is declared later.
|
| +
|
| + // Referring to a class C declared later is OK under the following
|
| + // circumstances:
|
| +
|
| + // 1. The class declarations are in a consecutive group with no other
|
| + // declarations or statements in between, and
|
| +
|
| + // 2. There is no dependency cycle where the first edge is an initialization
|
| + // time dependency (computed property name or extends clause) from C to
|
| + // something that depends on this class directly or transitively.
|
| +
|
| + // TODO(marja,rossberg): implement these checks. Here we undershoot the
|
| + // target and allow referring to any class.
|
| + return true;
|
| + }
|
| +
|
| // If both the use and the declaration are inside an eval scope (possibly
|
| // indirectly), or one of them is, we need to check whether they are inside
|
| // the same eval scope or different ones.
|
|
|