| 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' | 8 import '../common/backend_api.dart' |
| 9 show Backend, ForeignResolver, NativeRegistry; | 9 show Backend, ForeignResolver, NativeRegistry; |
| 10 import '../common/resolution.dart' show ResolutionImpact, Target; | 10 import '../common/resolution.dart' show ResolutionImpact, Target; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 223 } |
| 224 | 224 |
| 225 void setOperatorSelectorInComplexSendSet(SendSet node, Selector selector) { | 225 void setOperatorSelectorInComplexSendSet(SendSet node, Selector selector) { |
| 226 mapping.setOperatorSelectorInComplexSendSet(node, selector); | 226 mapping.setOperatorSelectorInComplexSendSet(node, selector); |
| 227 } | 227 } |
| 228 | 228 |
| 229 ////////////////////////////////////////////////////////////////////////////// | 229 ////////////////////////////////////////////////////////////////////////////// |
| 230 // Node-to-Type mapping functionality. | 230 // Node-to-Type mapping functionality. |
| 231 ////////////////////////////////////////////////////////////////////////////// | 231 ////////////////////////////////////////////////////////////////////////////// |
| 232 | 232 |
| 233 DartType useType(Node annotation, DartType type) { | 233 ResolutionDartType useType(Node annotation, ResolutionDartType type) { |
| 234 if (type != null) { | 234 if (type != null) { |
| 235 mapping.setType(annotation, type); | 235 mapping.setType(annotation, type); |
| 236 } | 236 } |
| 237 return type; | 237 return type; |
| 238 } | 238 } |
| 239 | 239 |
| 240 void setType(Node node, DartType type) => mapping.setType(node, type); | 240 void setType(Node node, ResolutionDartType type) => |
| 241 mapping.setType(node, type); |
| 241 | 242 |
| 242 DartType getType(Node node) => mapping.getType(node); | 243 ResolutionDartType getType(Node node) => mapping.getType(node); |
| 243 | 244 |
| 244 ////////////////////////////////////////////////////////////////////////////// | 245 ////////////////////////////////////////////////////////////////////////////// |
| 245 // Node-to-Constant mapping functionality. | 246 // Node-to-Constant mapping functionality. |
| 246 ////////////////////////////////////////////////////////////////////////////// | 247 ////////////////////////////////////////////////////////////////////////////// |
| 247 | 248 |
| 248 ConstantExpression getConstant(Node node) => mapping.getConstant(node); | 249 ConstantExpression getConstant(Node node) => mapping.getConstant(node); |
| 249 | 250 |
| 250 void setConstant(Node node, ConstantExpression constant) { | 251 void setConstant(Node node, ConstantExpression constant) { |
| 251 mapping.setConstant(node, constant); | 252 mapping.setConstant(node, constant); |
| 252 } | 253 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 void registerStaticUse(StaticUse staticUse) { | 328 void registerStaticUse(StaticUse staticUse) { |
| 328 impactBuilder.registerStaticUse(staticUse); | 329 impactBuilder.registerStaticUse(staticUse); |
| 329 } | 330 } |
| 330 | 331 |
| 331 /// Register the use of a type. | 332 /// Register the use of a type. |
| 332 void registerTypeUse(TypeUse typeUse) { | 333 void registerTypeUse(TypeUse typeUse) { |
| 333 impactBuilder.registerTypeUse(typeUse); | 334 impactBuilder.registerTypeUse(typeUse); |
| 334 } | 335 } |
| 335 | 336 |
| 336 /// Register checked mode check of [type] if it isn't `dynamic`. | 337 /// Register checked mode check of [type] if it isn't `dynamic`. |
| 337 void registerCheckedModeCheck(DartType type) { | 338 void registerCheckedModeCheck(ResolutionDartType type) { |
| 338 if (!type.isDynamic) { | 339 if (!type.isDynamic) { |
| 339 impactBuilder.registerTypeUse(new TypeUse.checkedModeCheck(type)); | 340 impactBuilder.registerTypeUse(new TypeUse.checkedModeCheck(type)); |
| 340 } | 341 } |
| 341 } | 342 } |
| 342 | 343 |
| 343 void registerSuperUse(SourceSpan span) { | 344 void registerSuperUse(SourceSpan span) { |
| 344 mapping.addSuperUse(span); | 345 mapping.addSuperUse(span); |
| 345 } | 346 } |
| 346 | 347 |
| 347 void registerTypeLiteral(Send node, DartType type) { | 348 void registerTypeLiteral(Send node, ResolutionDartType type) { |
| 348 mapping.setType(node, type); | 349 mapping.setType(node, type); |
| 349 impactBuilder.registerTypeUse(new TypeUse.typeLiteral(type)); | 350 impactBuilder.registerTypeUse(new TypeUse.typeLiteral(type)); |
| 350 } | 351 } |
| 351 | 352 |
| 352 void registerLiteralList(Node node, InterfaceType type, | 353 void registerLiteralList(Node node, ResolutionInterfaceType type, |
| 353 {bool isConstant, bool isEmpty}) { | 354 {bool isConstant, bool isEmpty}) { |
| 354 setType(node, type); | 355 setType(node, type); |
| 355 impactBuilder.registerListLiteral( | 356 impactBuilder.registerListLiteral( |
| 356 new ListLiteralUse(type, isConstant: isConstant, isEmpty: isEmpty)); | 357 new ListLiteralUse(type, isConstant: isConstant, isEmpty: isEmpty)); |
| 357 } | 358 } |
| 358 | 359 |
| 359 void registerMapLiteral(Node node, InterfaceType type, | 360 void registerMapLiteral(Node node, ResolutionInterfaceType type, |
| 360 {bool isConstant, bool isEmpty}) { | 361 {bool isConstant, bool isEmpty}) { |
| 361 setType(node, type); | 362 setType(node, type); |
| 362 impactBuilder.registerMapLiteral( | 363 impactBuilder.registerMapLiteral( |
| 363 new MapLiteralUse(type, isConstant: isConstant, isEmpty: isEmpty)); | 364 new MapLiteralUse(type, isConstant: isConstant, isEmpty: isEmpty)); |
| 364 } | 365 } |
| 365 | 366 |
| 366 void registerForeignCall(Node node, Element element, | 367 void registerForeignCall(Node node, Element element, |
| 367 CallStructure callStructure, ResolverVisitor visitor) { | 368 CallStructure callStructure, ResolverVisitor visitor) { |
| 368 var nativeData = target.resolveForeignCall(node, element, callStructure, | 369 var nativeData = target.resolveForeignCall(node, element, callStructure, |
| 369 new ForeignResolutionResolver(visitor, this)); | 370 new ForeignResolutionResolver(visitor, this)); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 387 } | 388 } |
| 388 | 389 |
| 389 void registerConstantLiteral(ConstantExpression constant) { | 390 void registerConstantLiteral(ConstantExpression constant) { |
| 390 impactBuilder.registerConstantLiteral(constant); | 391 impactBuilder.registerConstantLiteral(constant); |
| 391 } | 392 } |
| 392 | 393 |
| 393 ClassElement defaultSuperclass(ClassElement element) { | 394 ClassElement defaultSuperclass(ClassElement element) { |
| 394 return target.defaultSuperclass(element); | 395 return target.defaultSuperclass(element); |
| 395 } | 396 } |
| 396 | 397 |
| 397 void registerInstantiation(InterfaceType type) { | 398 void registerInstantiation(ResolutionInterfaceType type) { |
| 398 impactBuilder.registerTypeUse(new TypeUse.instantiation(type)); | 399 impactBuilder.registerTypeUse(new TypeUse.instantiation(type)); |
| 399 } | 400 } |
| 400 | 401 |
| 401 void registerSendStructure(Send node, SendStructure sendStructure) { | 402 void registerSendStructure(Send node, SendStructure sendStructure) { |
| 402 mapping.setSendStructure(node, sendStructure); | 403 mapping.setSendStructure(node, sendStructure); |
| 403 } | 404 } |
| 404 | 405 |
| 405 void registerNewStructure(NewExpression node, NewStructure newStructure) { | 406 void registerNewStructure(NewExpression node, NewStructure newStructure) { |
| 406 mapping.setNewStructure(node, newStructure); | 407 mapping.setNewStructure(node, newStructure); |
| 407 } | 408 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 422 final ResolutionRegistry registry; | 423 final ResolutionRegistry registry; |
| 423 | 424 |
| 424 ForeignResolutionResolver(this.visitor, this.registry); | 425 ForeignResolutionResolver(this.visitor, this.registry); |
| 425 | 426 |
| 426 @override | 427 @override |
| 427 ConstantExpression getConstant(Node node) { | 428 ConstantExpression getConstant(Node node) { |
| 428 return registry.getConstant(node); | 429 return registry.getConstant(node); |
| 429 } | 430 } |
| 430 | 431 |
| 431 @override | 432 @override |
| 432 void registerInstantiatedType(InterfaceType type) { | 433 void registerInstantiatedType(ResolutionInterfaceType type) { |
| 433 registry.registerInstantiation(type); | 434 registry.registerInstantiation(type); |
| 434 } | 435 } |
| 435 | 436 |
| 436 @override | 437 @override |
| 437 DartType resolveTypeFromString(Node node, String typeName) { | 438 ResolutionDartType resolveTypeFromString(Node node, String typeName) { |
| 438 return visitor.resolveTypeFromString(node, typeName); | 439 return visitor.resolveTypeFromString(node, typeName); |
| 439 } | 440 } |
| 440 } | 441 } |
| OLD | NEW |