OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library closureToClassMapper; | 5 library closureToClassMapper; |
6 | 6 |
7 import 'constants/expressions.dart'; | 7 import 'constants/expressions.dart'; |
8 import 'dart2jslib.dart'; | 8 import 'dart2jslib.dart'; |
9 import 'dart_types.dart'; | 9 import 'dart_types.dart'; |
10 import 'elements/elements.dart'; | 10 import 'elements/elements.dart'; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } else { | 81 } else { |
82 throw new SpannableAssertionFailure( | 82 throw new SpannableAssertionFailure( |
83 closure, 'Not a closure: $closure (${closure.runtimeType}).'); | 83 closure, 'Not a closure: $closure (${closure.runtimeType}).'); |
84 } | 84 } |
85 compiler.enqueuer.codegen.forgetElement(cls); | 85 compiler.enqueuer.codegen.forgetElement(cls); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 /// Common interface for [BoxFieldElement] and [ClosureFieldElement] as | 89 /// Common interface for [BoxFieldElement] and [ClosureFieldElement] as |
90 /// non-elements. | 90 /// non-elements. |
91 abstract class CapturedVariable {} | 91 abstract class CapturedVariable implements Element {} |
92 | 92 |
93 // TODO(ahe): These classes continuously cause problems. We need to | 93 // TODO(ahe): These classes continuously cause problems. We need to |
94 // find a more general solution. | 94 // find a more general solution. |
95 class ClosureFieldElement extends ElementX | 95 class ClosureFieldElement extends ElementX |
96 implements FieldElement, CapturedVariable { | 96 implements FieldElement, CapturedVariable { |
97 /// The [BoxLocal] or [LocalElement] being accessed through the field. | 97 /// The [BoxLocal] or [LocalElement] being accessed through the field. |
98 final Local local; | 98 final Local local; |
99 | 99 |
100 ClosureFieldElement(String name, | 100 ClosureFieldElement(String name, |
101 this.local, | 101 this.local, |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 | 1111 |
1112 String get name => typeVariable.name; | 1112 String get name => typeVariable.name; |
1113 | 1113 |
1114 int get hashCode => typeVariable.hashCode; | 1114 int get hashCode => typeVariable.hashCode; |
1115 | 1115 |
1116 bool operator ==(other) { | 1116 bool operator ==(other) { |
1117 if (other is! TypeVariableLocal) return false; | 1117 if (other is! TypeVariableLocal) return false; |
1118 return typeVariable == other.typeVariable; | 1118 return typeVariable == other.typeVariable; |
1119 } | 1119 } |
1120 } | 1120 } |
OLD | NEW |