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 import 'package:kernel/ast.dart'; | 5 import 'package:kernel/ast.dart'; |
6 import 'package:kernel/binary/ast_to_binary.dart'; | 6 import 'package:kernel/binary/ast_to_binary.dart'; |
7 | 7 |
8 /// Writes libraries that satisfy the [predicate]. | 8 /// Writes libraries that satisfy the [predicate]. |
9 /// | 9 /// |
10 /// Only the referenced subset of canonical names is indexed and written, | 10 /// Only the referenced subset of canonical names is indexed and written, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 defaultMemberReference(Member node) { | 102 defaultMemberReference(Member node) { |
103 _handleReferencedName(node.canonicalName); | 103 _handleReferencedName(node.canonicalName); |
104 } | 104 } |
105 | 105 |
106 @override | 106 @override |
107 visitClassReference(Class node) { | 107 visitClassReference(Class node) { |
108 _handleReferencedName(node.canonicalName); | 108 _handleReferencedName(node.canonicalName); |
109 } | 109 } |
110 | 110 |
111 @override | 111 @override |
| 112 visitLibrary(Library node) { |
| 113 for (var reference in node.additionalExports) { |
| 114 _handleReferencedName(reference.canonicalName); |
| 115 } |
| 116 super.visitLibrary(node); |
| 117 } |
| 118 |
| 119 @override |
112 visitLibraryDependency(LibraryDependency node) { | 120 visitLibraryDependency(LibraryDependency node) { |
113 _handleReferencedName(node.importedLibraryReference.canonicalName); | 121 _handleReferencedName(node.importedLibraryReference.canonicalName); |
114 super.visitLibraryDependency(node); | 122 super.visitLibraryDependency(node); |
115 } | 123 } |
116 | 124 |
117 @override | 125 @override |
118 visitMethodInvocation(MethodInvocation node) { | 126 visitMethodInvocation(MethodInvocation node) { |
119 _handleReferencedName(node.interfaceTargetReference?.canonicalName); | 127 _handleReferencedName(node.interfaceTargetReference?.canonicalName); |
120 return super.visitMethodInvocation(node); | 128 return super.visitMethodInvocation(node); |
121 } | 129 } |
(...skipping 29 matching lines...) Expand all Loading... |
151 } | 159 } |
152 | 160 |
153 void _handleReferencedName(CanonicalName name) { | 161 void _handleReferencedName(CanonicalName name) { |
154 if (name == null || name.parent == null) return; | 162 if (name == null || name.parent == null) return; |
155 _handleReferencedName(name.parent); | 163 _handleReferencedName(name.parent); |
156 referencedNames.add(name); | 164 referencedNames.add(name); |
157 name.index = -1; | 165 name.index = -1; |
158 put(name.name); | 166 put(name.name); |
159 } | 167 } |
160 } | 168 } |
OLD | NEW |