| 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 mirrorHelperLibrary = element; | 467 mirrorHelperLibrary = element; |
| 468 mirrorHelperGetNameFunction = mirrorHelperLibrary.find( | 468 mirrorHelperGetNameFunction = mirrorHelperLibrary.find( |
| 469 MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION); | 469 MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION); |
| 470 mirrorHelperSymbolsMap = mirrorHelperLibrary.find( | 470 mirrorHelperSymbolsMap = mirrorHelperLibrary.find( |
| 471 MirrorRenamer.MIRROR_HELPER_SYMBOLS_MAP_NAME); | 471 MirrorRenamer.MIRROR_HELPER_SYMBOLS_MAP_NAME); |
| 472 }); | 472 }); |
| 473 } | 473 } |
| 474 return new Future.value(); | 474 return new Future.value(); |
| 475 } | 475 } |
| 476 | 476 |
| 477 void registerTypeLiteral(Element element, | 477 void registerTypeLiteral(DartType type, |
| 478 Enqueuer enqueuer, | 478 Enqueuer enqueuer, |
| 479 Registry registry) { | 479 Registry registry) { |
| 480 if (element.isClass) { | 480 if (type.isInterfaceType) { |
| 481 usedTypeLiterals.add(element); | 481 usedTypeLiterals.add(type.element); |
| 482 } | 482 } |
| 483 } | 483 } |
| 484 | 484 |
| 485 void registerStaticSend(Element element, Node node) { | 485 void registerStaticSend(Element element, Node node) { |
| 486 if (useMirrorHelperLibrary) { | 486 if (useMirrorHelperLibrary) { |
| 487 mirrorRenamer.registerStaticSend(element, node); | 487 mirrorRenamer.registerStaticSend(element, node); |
| 488 } | 488 } |
| 489 } | 489 } |
| 490 | 490 |
| 491 void registerMirrorHelperElement(Element element, Node node) { | 491 void registerMirrorHelperElement(Element element, Node node) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 | 553 |
| 554 visitNode(Node node) { | 554 visitNode(Node node) { |
| 555 node.visitChildren(this); | 555 node.visitChildren(this); |
| 556 } | 556 } |
| 557 | 557 |
| 558 visitTypeAnnotation(TypeAnnotation typeAnnotation) { | 558 visitTypeAnnotation(TypeAnnotation typeAnnotation) { |
| 559 TreeElements treeElements = elementAst.treeElements; | 559 TreeElements treeElements = elementAst.treeElements; |
| 560 final DartType type = treeElements.getType(typeAnnotation); | 560 final DartType type = treeElements.getType(typeAnnotation); |
| 561 assert(invariant(typeAnnotation, type != null, | 561 assert(invariant(typeAnnotation, type != null, |
| 562 message: "Missing type for type annotation: $treeElements.")); | 562 message: "Missing type for type annotation: $treeElements.")); |
| 563 if (type.kind == TypeKind.TYPEDEF) newTypedefElementCallback(type.element); | 563 if (type.isTypedef) newTypedefElementCallback(type.element); |
| 564 if (type.kind == TypeKind.INTERFACE) newClassElementCallback(type.element); | 564 if (type.isInterfaceType) newClassElementCallback(type.element); |
| 565 typeAnnotation.visitChildren(this); | 565 typeAnnotation.visitChildren(this); |
| 566 } | 566 } |
| 567 | 567 |
| 568 void collect() { | 568 void collect() { |
| 569 compiler.withCurrentElement(element, () { | 569 compiler.withCurrentElement(element, () { |
| 570 elementAst.ast.accept(this); | 570 elementAst.ast.accept(this); |
| 571 }); | 571 }); |
| 572 } | 572 } |
| 573 } | 573 } |
| 574 | 574 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 } | 634 } |
| 635 | 635 |
| 636 Constant compileMetadata(MetadataAnnotation metadata, | 636 Constant compileMetadata(MetadataAnnotation metadata, |
| 637 Node node, | 637 Node node, |
| 638 TreeElements elements) { | 638 TreeElements elements) { |
| 639 return measure(() { | 639 return measure(() { |
| 640 return constantCompiler.compileMetadata(metadata, node, elements); | 640 return constantCompiler.compileMetadata(metadata, node, elements); |
| 641 }); | 641 }); |
| 642 } | 642 } |
| 643 } | 643 } |
| OLD | NEW |