Index: pkg/analyzer/lib/src/dart/element/element.dart |
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart |
index 530539595434b8fb77939f46c74bcff8dd6329d4..7c321e65d952790de803d609c8133fce72a2cc2c 100644 |
--- a/pkg/analyzer/lib/src/dart/element/element.dart |
+++ b/pkg/analyzer/lib/src/dart/element/element.dart |
@@ -1562,12 +1562,23 @@ class ElementAnnotationImpl implements ElementAnnotation { |
static String _DEPRECATED_VARIABLE_NAME = "deprecated"; |
/** |
+ * The name of `meta` library, used to define analysis annotations. |
+ */ |
+ static String _META_LIB_NAME = "meta"; |
+ |
+ /** |
* The name of the top-level variable used to mark a method as being expected |
* to override an inherited method. |
*/ |
static String _OVERRIDE_VARIABLE_NAME = "override"; |
/** |
+ * The name of the top-level variable used to mark a method as being |
+ * protected. |
+ */ |
+ static String _PROTECTED_VARIABLE_NAME = "protected"; |
+ |
+ /** |
* The name of the top-level variable used to mark a class as implementing a |
* proxy object. |
*/ |
@@ -1644,6 +1655,20 @@ class ElementAnnotationImpl implements ElementAnnotation { |
} |
@override |
+ bool get isProtected { |
+ if (element != null) { |
+ LibraryElement library = element.library; |
+ if (library != null && library.name == _META_LIB_NAME) { |
+ if (element is PropertyAccessorElement && |
+ element.name == _PROTECTED_VARIABLE_NAME) { |
+ return true; |
+ } |
+ } |
+ } |
+ return false; |
+ } |
+ |
+ @override |
bool get isProxy { |
if (element != null) { |
LibraryElement library = element.library; |
@@ -1837,6 +1862,16 @@ abstract class ElementImpl implements Element { |
} |
@override |
+ bool get isProtected { |
+ for (ElementAnnotation annotation in metadata) { |
+ if (annotation.isProtected) { |
+ return true; |
+ } |
+ } |
+ return false; |
+ } |
+ |
+ @override |
bool get isPublic => !isPrivate; |
@override |
@@ -3929,6 +3964,9 @@ class MultiplyDefinedElementImpl implements MultiplyDefinedElement { |
} |
@override |
+ bool get isProtected => false; |
+ |
+ @override |
bool get isPublic => !isPrivate; |
@override |