| 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 part of dart_backend; | 5 part of dart_backend; |
| 6 | 6 |
| 7 // TODO(ahe): This class is simply wrong. This backend should use | 7 // TODO(ahe): This class is simply wrong. This backend should use |
| 8 // elements when it can, not AST nodes. Perhaps a [Map<Element, | 8 // elements when it can, not AST nodes. Perhaps a [Map<Element, |
| 9 // TreeElements>] is what is needed. | 9 // TreeElements>] is what is needed. |
| 10 class ElementAst { | 10 class ElementAst { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 void registerStaticUse(Element element, Enqueuer enqueuer) { | 247 void registerStaticUse(Element element, Enqueuer enqueuer) { |
| 248 if (element == compiler.mirrorSystemGetNameFunction) { | 248 if (element == compiler.mirrorSystemGetNameFunction) { |
| 249 FunctionElement getNameFunction = mirrorRenamer.getNameFunction; | 249 FunctionElement getNameFunction = mirrorRenamer.getNameFunction; |
| 250 if (getNameFunction != null) { | 250 if (getNameFunction != null) { |
| 251 enqueuer.addToWorkList(getNameFunction); | 251 enqueuer.addToWorkList(getNameFunction); |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 | 255 |
| 256 @override | 256 @override |
| 257 void registerInstantiatedType(InterfaceType type, Registry registry) { | 257 void registerInstantiatedType(InterfaceType type, |
| 258 Enqueuer enqueuer, |
| 259 Registry registry, |
| 260 {bool mirrorUsage: false}) { |
| 258 // Without patching, dart2dart has no way of performing sound tree-shaking | 261 // Without patching, dart2dart has no way of performing sound tree-shaking |
| 259 // in face external functions. Therefore we employ another scheme: | 262 // in face external functions. Therefore we employ another scheme: |
| 260 // | 263 // |
| 261 // Based on the assumption that the platform code only relies on the | 264 // Based on the assumption that the platform code only relies on the |
| 262 // interfaces of it's own classes, we can approximate the semantics of | 265 // interfaces of it's own classes, we can approximate the semantics of |
| 263 // external functions by eagerly registering dynamic invocation of instance | 266 // external functions by eagerly registering dynamic invocation of instance |
| 264 // members defined the platform interfaces. | 267 // members defined the platform interfaces. |
| 265 // | 268 // |
| 266 // Since we only need to generate code for non-platform classes we can | 269 // Since we only need to generate code for non-platform classes we can |
| 267 // restrict this registration to platform interfaces implemented by | 270 // restrict this registration to platform interfaces implemented by |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 new UniverseSelector(selector, null)); | 316 new UniverseSelector(selector, null)); |
| 314 } else { | 317 } else { |
| 315 registry.registerDynamicInvocation( | 318 registry.registerDynamicInvocation( |
| 316 new UniverseSelector(selector, null)); | 319 new UniverseSelector(selector, null)); |
| 317 } | 320 } |
| 318 }); | 321 }); |
| 319 } | 322 } |
| 320 } | 323 } |
| 321 } | 324 } |
| 322 } | 325 } |
| 323 | 326 super.registerInstantiatedType( |
| 327 type, enqueuer, registry, mirrorUsage: mirrorUsage); |
| 324 } | 328 } |
| 325 | 329 |
| 326 @override | 330 @override |
| 327 bool enableDeferredLoadingIfSupported(Spannable node, Registry registry) { | 331 bool enableDeferredLoadingIfSupported(Spannable node, Registry registry) { |
| 328 // TODO(sigurdm): Implement deferred loading for dart2dart. | 332 // TODO(sigurdm): Implement deferred loading for dart2dart. |
| 329 compiler.reportWarningMessage( | 333 compiler.reportWarningMessage( |
| 330 node, MessageKind.DEFERRED_LIBRARY_DART_2_DART); | 334 node, MessageKind.DEFERRED_LIBRARY_DART_2_DART); |
| 331 return false; | 335 return false; |
| 332 } | 336 } |
| 333 } | 337 } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 } | 522 } |
| 519 | 523 |
| 520 // TODO(johnniwinther): Remove this when values are computed from the | 524 // TODO(johnniwinther): Remove this when values are computed from the |
| 521 // expressions. | 525 // expressions. |
| 522 @override | 526 @override |
| 523 void copyConstantValues(DartConstantTask task) { | 527 void copyConstantValues(DartConstantTask task) { |
| 524 constantCompiler.constantValueMap.addAll( | 528 constantCompiler.constantValueMap.addAll( |
| 525 task.constantCompiler.constantValueMap); | 529 task.constantCompiler.constantValueMap); |
| 526 } | 530 } |
| 527 } | 531 } |
| OLD | NEW |