Index: pkg/compiler/lib/src/elements/names.dart |
diff --git a/pkg/compiler/lib/src/elements/names.dart b/pkg/compiler/lib/src/elements/names.dart |
index 38e094595e6ad5a8b10186aca69310370a6cf591..514729c8f61fe9516aa8eb06c883b59337403e9c 100644 |
--- a/pkg/compiler/lib/src/elements/names.dart |
+++ b/pkg/compiler/lib/src/elements/names.dart |
@@ -46,8 +46,15 @@ abstract class Name { |
/// privacy into account. |
bool isSimilarTo(Name other); |
int get similarHashCode; |
- |
+ |
LibraryElement get library; |
+ |
+ |
+ /// Returns `true` when [s] is private if used as an identifier. |
+ static bool isPrivateName(String s) => !s.isEmpty && s.codeUnitAt(0) == $_; |
+ |
+ /// Returns `true` when [s] is public if used as an identifier. |
+ static bool isPublicName(String s) => !isPrivateName(s); |
} |
class PublicName implements Name { |
@@ -74,7 +81,7 @@ class PublicName implements Name { |
bool isSimilarTo(Name other) => |
text == other.text && isSetter == other.isSetter; |
int get similarHashCode => text.hashCode + 11 * isSetter.hashCode; |
- |
+ |
LibraryElement get library => null; |
String toString() => isSetter ? '$text=' : text; |