| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 js_backend.backend.impact_transformer; | 5 library js_backend.backend.impact_transformer; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/backend_api.dart' show ImpactTransformer; | 8 import '../common/backend_api.dart' show ImpactTransformer; |
| 9 import '../common/codegen.dart' show CodegenImpact; | 9 import '../common/codegen.dart' show CodegenImpact; |
| 10 import '../common/resolution.dart' show ResolutionImpact; | 10 import '../common/resolution.dart' show ResolutionImpact; |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 case ConstantExpressionKind.STRING: | 240 case ConstantExpressionKind.STRING: |
| 241 registerImpact(impacts.stringLiteral); | 241 registerImpact(impacts.stringLiteral); |
| 242 break; | 242 break; |
| 243 default: | 243 default: |
| 244 assert(invariant(NO_LOCATION_SPANNABLE, false, | 244 assert(invariant(NO_LOCATION_SPANNABLE, false, |
| 245 message: "Unexpected constant literal: ${constant.kind}.")); | 245 message: "Unexpected constant literal: ${constant.kind}.")); |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 for (native.NativeBehavior behavior in worldImpact.nativeData) { | 249 for (native.NativeBehavior behavior in worldImpact.nativeData) { |
| 250 enqueuer.nativeEnqueuer | 250 backend.nativeResolutionEnqueuer |
| 251 .registerNativeBehavior(transformed, behavior, worldImpact); | 251 .registerNativeBehavior(transformed, behavior, worldImpact); |
| 252 } | 252 } |
| 253 | 253 |
| 254 return transformed; | 254 return transformed; |
| 255 } | 255 } |
| 256 | 256 |
| 257 /// Register [type] as required for the runtime type information system. | 257 /// Register [type] as required for the runtime type information system. |
| 258 void registerRequiredType(ResolutionDartType type) { | 258 void registerRequiredType(ResolutionDartType type) { |
| 259 if (!type.isInterfaceType) return; | 259 if (!type.isInterfaceType) return; |
| 260 // If [argument] has type variables or is a type variable, this method | 260 // If [argument] has type variables or is a type variable, this method |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 for (String name in impact.constSymbols) { | 398 for (String name in impact.constSymbols) { |
| 399 backend.mirrorsData.registerConstSymbol(name); | 399 backend.mirrorsData.registerConstSymbol(name); |
| 400 } | 400 } |
| 401 | 401 |
| 402 for (Set<ClassElement> classes in impact.specializedGetInterceptors) { | 402 for (Set<ClassElement> classes in impact.specializedGetInterceptors) { |
| 403 backend.oneShotInterceptorData | 403 backend.oneShotInterceptorData |
| 404 .registerSpecializedGetInterceptor(classes, backend.namer); | 404 .registerSpecializedGetInterceptor(classes, backend.namer); |
| 405 } | 405 } |
| 406 | 406 |
| 407 if (impact.usesInterceptor) { | 407 if (impact.usesInterceptor) { |
| 408 if (backend.codegenEnqueuer.nativeEnqueuer.hasInstantiatedNativeClasses) { | 408 if (backend.nativeCodegenEnqueuer.hasInstantiatedNativeClasses) { |
| 409 impacts.interceptorUse.registerImpact(transformed, elementEnvironment); | 409 impacts.interceptorUse.registerImpact(transformed, elementEnvironment); |
| 410 } | 410 } |
| 411 } | 411 } |
| 412 | 412 |
| 413 for (ClassElement element in impact.typeConstants) { | 413 for (ClassElement element in impact.typeConstants) { |
| 414 backend.customElementsCodegenAnalysis.registerTypeConstant(element); | 414 backend.customElementsCodegenAnalysis.registerTypeConstant(element); |
| 415 backend.lookupMapAnalysis.registerTypeConstant(element); | 415 backend.lookupMapAnalysis.registerTypeConstant(element); |
| 416 } | 416 } |
| 417 | 417 |
| 418 for (FunctionElement element in impact.asyncMarkers) { | 418 for (FunctionElement element in impact.asyncMarkers) { |
| 419 switch (element.asyncMarker) { | 419 switch (element.asyncMarker) { |
| 420 case AsyncMarker.ASYNC: | 420 case AsyncMarker.ASYNC: |
| 421 impacts.asyncBody.registerImpact(transformed, elementEnvironment); | 421 impacts.asyncBody.registerImpact(transformed, elementEnvironment); |
| 422 break; | 422 break; |
| 423 case AsyncMarker.SYNC_STAR: | 423 case AsyncMarker.SYNC_STAR: |
| 424 impacts.syncStarBody.registerImpact(transformed, elementEnvironment); | 424 impacts.syncStarBody.registerImpact(transformed, elementEnvironment); |
| 425 break; | 425 break; |
| 426 case AsyncMarker.ASYNC_STAR: | 426 case AsyncMarker.ASYNC_STAR: |
| 427 impacts.asyncStarBody.registerImpact(transformed, elementEnvironment); | 427 impacts.asyncStarBody.registerImpact(transformed, elementEnvironment); |
| 428 break; | 428 break; |
| 429 } | 429 } |
| 430 } | 430 } |
| 431 | 431 |
| 432 // TODO(johnniwinther): Remove eager registration. | 432 // TODO(johnniwinther): Remove eager registration. |
| 433 return transformed; | 433 return transformed; |
| 434 } | 434 } |
| 435 } | 435 } |
| OLD | NEW |