| 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 'common/names.dart' show Identifiers; | 7 import 'common/names.dart' show Identifiers; |
| 8 import 'common/resolution.dart' show ParsingContext, Resolution; | 8 import 'common/resolution.dart' show ParsingContext, Resolution; |
| 9 import 'common/tasks.dart' show CompilerTask; | 9 import 'common/tasks.dart' show CompilerTask; |
| 10 import 'common.dart'; | 10 import 'common.dart'; |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 413 |
| 414 // If the scope is attached to a [For] contains the variables that are | 414 // If the scope is attached to a [For] contains the variables that are |
| 415 // declared in the initializer of the [For] and that need to be boxed. | 415 // declared in the initializer of the [For] and that need to be boxed. |
| 416 // Otherwise contains the empty List. | 416 // Otherwise contains the empty List. |
| 417 List<Local> boxedLoopVariables = const <Local>[]; | 417 List<Local> boxedLoopVariables = const <Local>[]; |
| 418 | 418 |
| 419 ClosureScope(this.boxElement, this.capturedVariables); | 419 ClosureScope(this.boxElement, this.capturedVariables); |
| 420 | 420 |
| 421 bool hasBoxedLoopVariables() => !boxedLoopVariables.isEmpty; | 421 bool hasBoxedLoopVariables() => !boxedLoopVariables.isEmpty; |
| 422 | 422 |
| 423 bool isCapturedVariable(VariableElement variable) { | 423 bool isCapturedVariable(Local variable) { |
| 424 return capturedVariables.containsKey(variable); | 424 return capturedVariables.containsKey(variable); |
| 425 } | 425 } |
| 426 | 426 |
| 427 void forEachCapturedVariable( | 427 void forEachCapturedVariable( |
| 428 f(LocalVariableElement variable, BoxFieldElement boxField)) { | 428 f(LocalVariableElement variable, BoxFieldElement boxField)) { |
| 429 capturedVariables.forEach(f); | 429 capturedVariables.forEach(f); |
| 430 } | 430 } |
| 431 | 431 |
| 432 String toString() { | 432 String toString() { |
| 433 String separator = ''; | 433 String separator = ''; |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 this.typeVariable, this.executableContext, this.memberContext); | 1217 this.typeVariable, this.executableContext, this.memberContext); |
| 1218 | 1218 |
| 1219 String get name => typeVariable.element.name; | 1219 String get name => typeVariable.element.name; |
| 1220 | 1220 |
| 1221 int get hashCode => typeVariable.hashCode; | 1221 int get hashCode => typeVariable.hashCode; |
| 1222 | 1222 |
| 1223 bool operator ==(other) { | 1223 bool operator ==(other) { |
| 1224 if (other is! TypeVariableLocal) return false; | 1224 if (other is! TypeVariableLocal) return false; |
| 1225 return typeVariable == other.typeVariable; | 1225 return typeVariable == other.typeVariable; |
| 1226 } | 1226 } |
| 1227 |
| 1228 String toString() { |
| 1229 StringBuffer sb = new StringBuffer(); |
| 1230 sb.write('type_variable_local('); |
| 1231 if (memberContext.enclosingClass != null) { |
| 1232 sb.write(memberContext.enclosingClass.name); |
| 1233 sb.write('.'); |
| 1234 } |
| 1235 sb.write(memberContext.name); |
| 1236 sb.write('#'); |
| 1237 sb.write(name); |
| 1238 sb.write(')'); |
| 1239 return sb.toString(); |
| 1240 } |
| 1227 } | 1241 } |
| 1228 | 1242 |
| 1229 /// | 1243 /// |
| 1230 /// Move the below classes to a JS model eventually. | 1244 /// Move the below classes to a JS model eventually. |
| 1231 /// | 1245 /// |
| 1232 abstract class JSEntity implements Entity { | 1246 abstract class JSEntity implements Entity { |
| 1233 Entity get declaredEntity; | 1247 Entity get declaredEntity; |
| 1234 } | 1248 } |
| 1235 | 1249 |
| 1236 abstract class PrivatelyNamedJSEntity implements JSEntity { | 1250 abstract class PrivatelyNamedJSEntity implements JSEntity { |
| 1237 Entity get rootOfScope; | 1251 Entity get rootOfScope; |
| 1238 } | 1252 } |
| OLD | NEW |