| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 dart2js.resolution.registry; | 5 library dart2js.resolution.registry; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/backend_api.dart' show ForeignResolver, NativeRegistry; | 8 import '../common/backend_api.dart' show ForeignResolver, NativeRegistry; |
| 9 import '../common/resolution.dart' show ResolutionImpact, Target; | 9 import '../common/resolution.dart' show ResolutionImpact, Target; |
| 10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 mapping.undefineLabel(node); | 272 mapping.undefineLabel(node); |
| 273 } | 273 } |
| 274 | 274 |
| 275 /// Register the target of [node] as reference to [label]. | 275 /// Register the target of [node] as reference to [label]. |
| 276 void useLabel(GotoStatement node, LabelDefinition label) { | 276 void useLabel(GotoStatement node, LabelDefinition label) { |
| 277 mapping.registerTargetLabel(node, label); | 277 mapping.registerTargetLabel(node, label); |
| 278 } | 278 } |
| 279 | 279 |
| 280 /// Register [node] to be the declaration of [target]. | 280 /// Register [node] to be the declaration of [target]. |
| 281 void defineTarget(Node node, JumpTarget target) { | 281 void defineTarget(Node node, JumpTarget target) { |
| 282 assert(invariant(node, node is Statement || node is SwitchCase, | 282 assert(node is Statement || node is SwitchCase, |
| 283 message: "Only statements and switch cases can define targets.")); | 283 failedAt(node, "Only statements and switch cases can define targets.")); |
| 284 mapping.defineTarget(node, target); | 284 mapping.defineTarget(node, target); |
| 285 } | 285 } |
| 286 | 286 |
| 287 /// Returns the [JumpTarget] defined by [node]. | 287 /// Returns the [JumpTarget] defined by [node]. |
| 288 JumpTarget getTargetDefinition(Node node) { | 288 JumpTarget getTargetDefinition(Node node) { |
| 289 assert(invariant(node, node is Statement || node is SwitchCase, | 289 assert(node is Statement || node is SwitchCase, |
| 290 message: "Only statements and switch cases can define targets.")); | 290 failedAt(node, "Only statements and switch cases can define targets.")); |
| 291 return mapping.getTargetDefinition(node); | 291 return mapping.getTargetDefinition(node); |
| 292 } | 292 } |
| 293 | 293 |
| 294 /// Undefine the target of [node]. This is used to cleanup unused targets. | 294 /// Undefine the target of [node]. This is used to cleanup unused targets. |
| 295 void undefineTarget(Node node) { | 295 void undefineTarget(Node node) { |
| 296 assert(invariant(node, node is Statement || node is SwitchCase, | 296 assert(node is Statement || node is SwitchCase, |
| 297 message: "Only statements and switch cases can define targets.")); | 297 failedAt(node, "Only statements and switch cases can define targets.")); |
| 298 mapping.undefineTarget(node); | 298 mapping.undefineTarget(node); |
| 299 } | 299 } |
| 300 | 300 |
| 301 /// Register the target of [node] to be [target]. | 301 /// Register the target of [node] to be [target]. |
| 302 void registerTargetOf(GotoStatement node, JumpTarget target) { | 302 void registerTargetOf(GotoStatement node, JumpTarget target) { |
| 303 mapping.registerTargetOf(node, target); | 303 mapping.registerTargetOf(node, target); |
| 304 } | 304 } |
| 305 | 305 |
| 306 ////////////////////////////////////////////////////////////////////////////// | 306 ////////////////////////////////////////////////////////////////////////////// |
| 307 // Potential access registration. | 307 // Potential access registration. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 @override | 437 @override |
| 438 void registerInstantiatedType(ResolutionInterfaceType type) { | 438 void registerInstantiatedType(ResolutionInterfaceType type) { |
| 439 registry.registerInstantiation(type); | 439 registry.registerInstantiation(type); |
| 440 } | 440 } |
| 441 | 441 |
| 442 @override | 442 @override |
| 443 ResolutionDartType resolveTypeFromString(Node node, String typeName) { | 443 ResolutionDartType resolveTypeFromString(Node node, String typeName) { |
| 444 return visitor.resolveTypeFromString(node, typeName); | 444 return visitor.resolveTypeFromString(node, typeName); |
| 445 } | 445 } |
| 446 } | 446 } |
| OLD | NEW |