| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 element, | 176 element, |
| 177 elementAst, | 177 elementAst, |
| 178 newTypedefElementCallback, | 178 newTypedefElementCallback, |
| 179 newClassElementCallback); | 179 newClassElementCallback); |
| 180 collector.collect(); | 180 collector.collect(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 int totalSize = outputter.assembleProgram( | 183 int totalSize = outputter.assembleProgram( |
| 184 libraries: compiler.libraryLoader.libraries, | 184 libraries: compiler.libraryLoader.libraries, |
| 185 instantiatedClasses: compiler.resolverWorld.directlyInstantiatedClasses, | 185 instantiatedClasses: compiler.resolverWorld.directlyInstantiatedClasses, |
| 186 resolvedElements: compiler.enqueuer.resolution.resolvedElements, | 186 resolvedElements: compiler.enqueuer.resolution.processedElements, |
| 187 usedTypeLiterals: usedTypeLiterals, | 187 usedTypeLiterals: usedTypeLiterals, |
| 188 postProcessElementAst: postProcessElementAst, | 188 postProcessElementAst: postProcessElementAst, |
| 189 computeElementAst: computeElementAst, | 189 computeElementAst: computeElementAst, |
| 190 shouldOutput: shouldOutput, | 190 shouldOutput: shouldOutput, |
| 191 isSafeToRemoveTypeDeclarations: isSafeToRemoveTypeDeclarations, | 191 isSafeToRemoveTypeDeclarations: isSafeToRemoveTypeDeclarations, |
| 192 sortElements: Elements.sortedByPosition, | 192 sortElements: Elements.sortedByPosition, |
| 193 mirrorRenamer: mirrorRenamer, | 193 mirrorRenamer: mirrorRenamer, |
| 194 mainFunction: compiler.mainFunction, | 194 mainFunction: compiler.mainFunction, |
| 195 outputUri: compiler.outputUri); | 195 outputUri: compiler.outputUri); |
| 196 | 196 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 node, MessageKind.DEFERRED_LIBRARY_DART_2_DART); | 339 node, MessageKind.DEFERRED_LIBRARY_DART_2_DART); |
| 340 return false; | 340 return false; |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 | 343 |
| 344 class DartResolutionCallbacks extends ResolutionCallbacks { | 344 class DartResolutionCallbacks extends ResolutionCallbacks { |
| 345 final DartBackend backend; | 345 final DartBackend backend; |
| 346 | 346 |
| 347 DartResolutionCallbacks(this.backend); | 347 DartResolutionCallbacks(this.backend); |
| 348 | 348 |
| 349 @override |
| 350 WorldImpact transformImpact(ResolutionWorldImpact worldImpact) { |
| 351 TransformedWorldImpact transformed = |
| 352 new TransformedWorldImpact(worldImpact); |
| 353 for (DartType typeLiteral in worldImpact.typeLiterals) { |
| 354 onTypeLiteral(typeLiteral, transformed); |
| 355 } |
| 356 for (InterfaceType instantiatedType in worldImpact.instantiatedTypes) { |
| 357 // TODO(johnniwinther): Remove this when dependency tracking is done on |
| 358 // the world impact itself. |
| 359 transformed.registerInstantiation(instantiatedType); |
| 360 backend.registerInstantiatedType( |
| 361 instantiatedType, backend.compiler.enqueuer.resolution, transformed); |
| 362 } |
| 363 return transformed; |
| 364 } |
| 365 |
| 366 @override |
| 349 void onTypeLiteral(DartType type, Registry registry) { | 367 void onTypeLiteral(DartType type, Registry registry) { |
| 350 if (type.isInterfaceType) { | 368 if (type.isInterfaceType) { |
| 351 backend.usedTypeLiterals.add(type.element); | 369 backend.usedTypeLiterals.add(type.element); |
| 352 } | 370 } |
| 353 } | 371 } |
| 354 } | 372 } |
| 355 | 373 |
| 356 class EmitterUnparser extends Unparser { | 374 class EmitterUnparser extends Unparser { |
| 357 final Map<Node, String> renames; | 375 final Map<Node, String> renames; |
| 358 | 376 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 } | 545 } |
| 528 | 546 |
| 529 // TODO(johnniwinther): Remove this when values are computed from the | 547 // TODO(johnniwinther): Remove this when values are computed from the |
| 530 // expressions. | 548 // expressions. |
| 531 @override | 549 @override |
| 532 void copyConstantValues(DartConstantTask task) { | 550 void copyConstantValues(DartConstantTask task) { |
| 533 constantCompiler.constantValueMap.addAll( | 551 constantCompiler.constantValueMap.addAll( |
| 534 task.constantCompiler.constantValueMap); | 552 task.constantCompiler.constantValueMap); |
| 535 } | 553 } |
| 536 } | 554 } |
| OLD | NEW |