| 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 package com.google.dart.compiler.ast; | 5 package com.google.dart.compiler.ast; |
| 6 | 6 |
| 7 import com.google.common.collect.Sets; | 7 import com.google.common.collect.Sets; |
| 8 import com.google.dart.compiler.common.SourceInfo; |
| 8 | 9 |
| 9 import java.util.List; | 10 import java.util.List; |
| 10 import java.util.Set; | 11 import java.util.Set; |
| 11 | 12 |
| 12 /** | 13 /** |
| 13 * Information about export - {@link LibraryUnit} and show/hide names. | 14 * Information about export - {@link LibraryUnit} and show/hide names. |
| 14 */ | 15 */ |
| 15 public class LibraryExport { | 16 public class LibraryExport { |
| 17 private final SourceInfo sourceInfo; |
| 16 private final LibraryUnit library; | 18 private final LibraryUnit library; |
| 17 private final Set<String> showNames; | 19 private final Set<String> showNames; |
| 18 private final Set<String> hideNames; | 20 private final Set<String> hideNames; |
| 19 | 21 |
| 20 public LibraryExport(LibraryUnit library, List<ImportCombinator> combinators)
{ | 22 public LibraryExport(SourceInfo sourceInfo, LibraryUnit library, |
| 23 List<ImportCombinator> combinators) { |
| 24 this.sourceInfo = sourceInfo; |
| 21 this.library = library; | 25 this.library = library; |
| 22 this.showNames = createCombinatorsSet(combinators, true); | 26 this.showNames = createCombinatorsSet(combinators, true); |
| 23 this.hideNames = createCombinatorsSet(combinators, false); | 27 this.hideNames = createCombinatorsSet(combinators, false); |
| 24 } | 28 } |
| 25 | 29 |
| 30 public SourceInfo getSourceInfo() { |
| 31 return sourceInfo; |
| 32 } |
| 33 |
| 26 public LibraryUnit getLibrary() { | 34 public LibraryUnit getLibrary() { |
| 27 return library; | 35 return library; |
| 28 } | 36 } |
| 29 | 37 |
| 30 public boolean isVisible(String name) { | 38 public boolean isVisible(String name) { |
| 31 if (hideNames.contains(name)) { | 39 if (hideNames.contains(name)) { |
| 32 return false; | 40 return false; |
| 33 } | 41 } |
| 34 if (!showNames.isEmpty()) { | 42 if (!showNames.isEmpty()) { |
| 35 return showNames.contains(name); | 43 return showNames.contains(name); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 55 for (DartIdentifier hideName : hideCombinator.getHiddenNames()) { | 63 for (DartIdentifier hideName : hideCombinator.getHiddenNames()) { |
| 56 if (hideName != null) { | 64 if (hideName != null) { |
| 57 result.add(hideName.getName()); | 65 result.add(hideName.getName()); |
| 58 } | 66 } |
| 59 } | 67 } |
| 60 } | 68 } |
| 61 } | 69 } |
| 62 return result; | 70 return result; |
| 63 } | 71 } |
| 64 } | 72 } |
| OLD | NEW |