| Index: sdk/lib/_internal/compiler/implementation/closure.dart
|
| ===================================================================
|
| --- sdk/lib/_internal/compiler/implementation/closure.dart (revision 28922)
|
| +++ sdk/lib/_internal/compiler/implementation/closure.dart (working copy)
|
| @@ -770,19 +770,13 @@
|
| }
|
|
|
| DartType type = element.computeType(compiler);
|
| - // Compute the function type and check for type variables in return or
|
| - // parameter types.
|
| - if (type.containsTypeVariables) {
|
| - registerNeedsThis();
|
| + // If the method needs RTI, or checked mode is set, we need to
|
| + // escape the potential type variables used in that closure.
|
| + if (element is FunctionElement
|
| + && (compiler.backend.methodNeedsRti(element) ||
|
| + compiler.enableTypeAssertions)) {
|
| + analyzeTypeVariables(type);
|
| }
|
| - // Ensure that closure that need runtime type information has access to
|
| - // this of the enclosing class.
|
| - if (element is FunctionElement &&
|
| - closureData.thisElement != null &&
|
| - type.containsTypeVariables &&
|
| - compiler.backend.methodNeedsRti(element)) {
|
| - registerNeedsThis();
|
| - }
|
|
|
| visitChildren();
|
| });
|
|
|