Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: pkg/compiler/lib/src/closure.dart

Issue 2729613004: Cleanup registration of closures (Closed)
Patch Set: Updated cf. comments. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/closure.dart
diff --git a/pkg/compiler/lib/src/closure.dart b/pkg/compiler/lib/src/closure.dart
index 068f4970b24e98788a23966b20252453e3e541ee..9d7dc7476d8e05935e1c5ac452bf88d9f3260660 100644
--- a/pkg/compiler/lib/src/closure.dart
+++ b/pkg/compiler/lib/src/closure.dart
@@ -1104,10 +1104,13 @@ class ClosureTranslator extends Visitor {
insideClosure = outermostElement != null;
LocalFunctionElement closure;
executableContext = element;
+ bool needsRti = false;
if (insideClosure) {
closure = element;
closures.add(closure);
closureData = globalizeClosure(node, closure);
+ needsRti = compiler.options.enableTypeAssertions ||
+ compiler.backend.rtiNeed.localFunctionNeedsRti(closure);
} else {
outermostElement = element;
ThisLocal thisElement = null;
@@ -1115,6 +1118,10 @@ class ClosureTranslator extends Visitor {
thisElement = new ThisLocal(element);
}
closureData = new ClosureClassMap(null, null, null, thisElement);
+ if (element is MethodElement) {
+ needsRti = compiler.options.enableTypeAssertions ||
+ compiler.backend.rtiNeed.methodNeedsRti(element);
+ }
}
closureMappingCache[element.declaration] = closureData;
if (closureData.callElement != null) {
@@ -1122,13 +1129,10 @@ class ClosureTranslator extends Visitor {
}
inNewScope(node, () {
- ResolutionDartType type = element.type;
// 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.rtiNeed.methodNeedsRti(element) ||
- compiler.options.enableTypeAssertions)) {
- analyzeTypeVariables(type);
+ if (needsRti) {
+ analyzeTypeVariables(element.type);
}
visitChildren();
« no previous file with comments | « no previous file | pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698