| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.src.summary.public_namespace_visitor; | 5 library analyzer.src.summary.public_namespace_visitor; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/src/summary/base.dart'; | 8 import 'package:analyzer/src/summary/base.dart'; |
| 9 import 'package:analyzer/src/summary/format.dart'; | 9 import 'package:analyzer/src/summary/format.dart'; |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * Compute the public namespace portion of the summary for the given [unit], | 12 * Compute the public namespace portion of the summary for the given [unit], |
| 13 * which is presumed to be an unresolved AST. | 13 * which is presumed to be an unresolved AST. |
| 14 */ | 14 */ |
| 15 UnlinkedPublicNamespaceBuilder computePublicNamespace( | 15 UnlinkedPublicNamespaceBuilder computePublicNamespace( |
| 16 BuilderContext ctx, CompilationUnit unit) { | 16 BuilderContext ctx, CompilationUnit unit) { |
| 17 _PublicNamespaceVisitor visitor = new _PublicNamespaceVisitor(ctx); | 17 _PublicNamespaceVisitor visitor = new _PublicNamespaceVisitor(ctx); |
| 18 unit.accept(visitor); | 18 unit.accept(visitor); |
| 19 return encodeUnlinkedPublicNamespace(ctx, | 19 return encodeUnlinkedPublicNamespace(ctx, |
| 20 names: visitor.names, exports: visitor.exports, parts: visitor.parts); | 20 names: visitor.names, exports: visitor.exports, parts: visitor.parts); |
| 21 } | 21 } |
| 22 | 22 |
| 23 class _CombinatorEncoder extends SimpleAstVisitor<UnlinkedCombinatorBuilder> { | 23 class _CombinatorEncoder extends SimpleAstVisitor<UnlinkedCombinatorBuilder> { |
| 24 final BuilderContext ctx; | 24 final BuilderContext ctx; |
| 25 | 25 |
| 26 _CombinatorEncoder(this.ctx); | 26 _CombinatorEncoder(this.ctx); |
| 27 | 27 |
| 28 List<UnlinkedCombinatorNameBuilder> encodeNames( | 28 List<String> encodeNames(NodeList<SimpleIdentifier> names) => |
| 29 NodeList<SimpleIdentifier> names) => | 29 names.map((SimpleIdentifier id) => id.name).toList(); |
| 30 names | |
| 31 .map((SimpleIdentifier id) => | |
| 32 encodeUnlinkedCombinatorName(ctx, name: id.name)) | |
| 33 .toList(); | |
| 34 | 30 |
| 35 @override | 31 @override |
| 36 UnlinkedCombinatorBuilder visitHideCombinator(HideCombinator node) { | 32 UnlinkedCombinatorBuilder visitHideCombinator(HideCombinator node) { |
| 37 return encodeUnlinkedCombinator(ctx, hides: encodeNames(node.hiddenNames)); | 33 return encodeUnlinkedCombinator(ctx, hides: encodeNames(node.hiddenNames)); |
| 38 } | 34 } |
| 39 | 35 |
| 40 @override | 36 @override |
| 41 UnlinkedCombinatorBuilder visitShowCombinator(ShowCombinator node) { | 37 UnlinkedCombinatorBuilder visitShowCombinator(ShowCombinator node) { |
| 42 return encodeUnlinkedCombinator(ctx, shows: encodeNames(node.shownNames)); | 38 return encodeUnlinkedCombinator(ctx, shows: encodeNames(node.shownNames)); |
| 43 } | 39 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 100 |
| 105 @override | 101 @override |
| 106 visitVariableDeclaration(VariableDeclaration node) { | 102 visitVariableDeclaration(VariableDeclaration node) { |
| 107 String name = node.name.name; | 103 String name = node.name.name; |
| 108 addNameIfPublic(name, PrelinkedReferenceKind.other); | 104 addNameIfPublic(name, PrelinkedReferenceKind.other); |
| 109 if (!node.isFinal && !node.isConst) { | 105 if (!node.isFinal && !node.isConst) { |
| 110 addNameIfPublic('$name=', PrelinkedReferenceKind.other); | 106 addNameIfPublic('$name=', PrelinkedReferenceKind.other); |
| 111 } | 107 } |
| 112 } | 108 } |
| 113 } | 109 } |
| OLD | NEW |