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

Unified Diff: lib/compiler/implementation/closure.dart

Issue 10915054: Mark the local for this as used if a constructor call needs type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
Index: lib/compiler/implementation/closure.dart
diff --git a/lib/compiler/implementation/closure.dart b/lib/compiler/implementation/closure.dart
index f278e6ba8ba7b5118f37e1dcb0d93a0f15ef6f9b..6e53b7170ac6448bf0f354f21cd3bd701067688a 100644
--- a/lib/compiler/implementation/closure.dart
+++ b/lib/compiler/implementation/closure.dart
@@ -317,6 +317,31 @@ class ClosureTranslator extends AbstractVisitor {
super.visitSendSet(node);
}
+ visitNewExpression(NewExpression node) {
+ bool hasTypeVariable(DartType type) {
+ if (type is TypeVariableType) {
+ return true;
+ } else if (type is InterfaceType) {
+ InterfaceType ifcType = type;
+ for (DartType argument in ifcType.arguments) {
+ if (hasTypeVariable(argument)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ TypeAnnotation annotation = node.send.getTypeAnnotation();
+ DartType type = elements.getType(annotation);
+ if (hasTypeVariable(type)) {
+ // TODO(karlklose): factories cannot get the type argument via this.
ngeoffray 2012/09/03 12:57:23 The resolve must have checked this already. Either
karlklose 2012/09/03 13:55:19 Done.
+ if (closureData.thisElement !== null) {
+ useLocal(closureData.thisElement);
+ }
+ }
+ node.visitChildren(this);
+ }
+
// If variables that are declared in the [node] scope are captured and need
// to be boxed create a box-element and update the [capturingScopes] in the
// current [closureData].
« no previous file with comments | « no previous file | lib/compiler/implementation/resolver.dart » ('j') | lib/compiler/implementation/ssa/builder.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698