Chromium Code Reviews| 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 class DartBackend extends Backend { | 5 class DartBackend extends Backend { |
| 6 final List<CompilerTask> tasks; | 6 final List<CompilerTask> tasks; |
| 7 final UnparseValidator unparseValidator; | 7 final UnparseValidator unparseValidator; |
| 8 | 8 |
| 9 Map<Element, TreeElements> get resolvedElements() => | 9 Map<Element, TreeElements> get resolvedElements() => |
| 10 compiler.enqueuer.resolution.resolvedElements; | 10 compiler.enqueuer.resolution.resolvedElements; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 | 145 |
| 146 visitTypeAnnotation(TypeAnnotation typeAnnotation) { | 146 visitTypeAnnotation(TypeAnnotation typeAnnotation) { |
| 147 final type = compiler.resolveTypeAnnotation(element, typeAnnotation); | 147 final type = compiler.resolveTypeAnnotation(element, typeAnnotation); |
| 148 Element typeElement = type.element; | 148 Element typeElement = type.element; |
| 149 if (typeElement.isTypedef() && !typedefs.contains(typeElement)) { | 149 if (typeElement.isTypedef() && !typedefs.contains(typeElement)) { |
| 150 typedefs.add(typeElement); | 150 typedefs.add(typeElement); |
| 151 new ReferencedElementCollector( | 151 new ReferencedElementCollector( |
| 152 compiler, typeElement, new TreeElementMapping(), typedefs, classes) | 152 compiler, typeElement, new TreeElementMapping(), typedefs, classes) |
| 153 .collect(); | 153 .collect(); |
| 154 } | 154 } |
| 155 if (typeElement.isClass()) classes.add(typeElement); | 155 if (typeElement.isClass() && !classes.contains(typeElement)) { |
| 156 classes.add(typeElement); | |
| 157 new ReferencedElementCollector( | |
|
Anton Muhin
2012/08/13 08:01:01
please, do not duplicate the code, but move it bel
Roman
2012/08/13 08:14:06
Done.
| |
| 158 compiler, typeElement, new TreeElementMapping(), typedefs, classes) | |
| 159 .collect(); | |
| 160 } | |
| 156 typeAnnotation.visitChildren(this); | 161 typeAnnotation.visitChildren(this); |
| 157 } | 162 } |
| 158 | 163 |
| 159 void collect() { | 164 void collect() { |
| 160 compiler.withCurrentElement(element, () { | 165 compiler.withCurrentElement(element, () { |
| 161 element.parseNode(compiler).accept(this); | 166 element.parseNode(compiler).accept(this); |
| 162 }); | 167 }); |
| 163 } | 168 } |
| 164 } | 169 } |
| OLD | NEW |