Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 189803004: Translate private Java members to private Dart members. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | pkg/analyzer/lib/src/generated/scanner.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 4d27e6b8e9192ccd69695f3437d1cc82e87d3158..5680d7889d4d28ac43687b37a012f8d9984b2316 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -85,7 +85,7 @@ class AngularCompilationUnitBuilder {
List<AngularPropertyElement> properties = AngularPropertyElement.EMPTY_ARRAY;
// maybe name
if (toolkitObject is AngularElement) {
- if (isNameCoveredByLiteral(toolkitObject, node)) {
+ if (_isNameCoveredByLiteral(toolkitObject, node)) {
return toolkitObject;
}
}
@@ -93,7 +93,7 @@ class AngularCompilationUnitBuilder {
if (toolkitObject is AngularHasSelectorElement) {
AngularHasSelectorElement hasSelector = toolkitObject;
AngularSelectorElement selector = hasSelector.selector;
- if (isNameCoveredByLiteral(selector, node)) {
+ if (_isNameCoveredByLiteral(selector, node)) {
return selector;
}
}
@@ -110,7 +110,7 @@ class AngularCompilationUnitBuilder {
// check properties
for (AngularPropertyElement property in properties) {
// property name (use complete node range)
- if (isNameCoveredByLiteral(property, node)) {
+ if (_isNameCoveredByLiteral(property, node)) {
return property;
}
// field name (use complete node range, including @, => and <=>)
@@ -167,7 +167,7 @@ class AngularCompilationUnitBuilder {
/**
* Returns the [FieldElement] of the first field in the given [FieldDeclaration].
*/
- static FieldElement getOnlyFieldElement(FieldDeclaration fieldDeclaration) {
+ static FieldElement _getOnlyFieldElement(FieldDeclaration fieldDeclaration) {
NodeList<VariableDeclaration> fields = fieldDeclaration.fields.variables;
return fields[0].element as FieldElement;
}
@@ -176,7 +176,7 @@ class AngularCompilationUnitBuilder {
* If given [Annotation] has one argument and it is [SimpleStringLiteral], returns it,
* otherwise returns `null`.
*/
- static SimpleStringLiteral getOnlySimpleStringLiteralArgument(Annotation annotation) {
+ static SimpleStringLiteral _getOnlySimpleStringLiteralArgument(Annotation annotation) {
SimpleStringLiteral nameLiteral = null;
ArgumentList argsNode = annotation.arguments;
if (argsNode != null) {
@@ -195,7 +195,7 @@ class AngularCompilationUnitBuilder {
* Checks if the name range of the given [Element] is completely covered by the given
* [SimpleStringLiteral].
*/
- static bool isNameCoveredByLiteral(Element element, AstNode node) {
+ static bool _isNameCoveredByLiteral(Element element, AstNode node) {
if (element != null) {
String name = element.name;
if (name != null) {
@@ -210,7 +210,7 @@ class AngularCompilationUnitBuilder {
/**
* Parses given [SimpleStringLiteral] using [parseSelector].
*/
- static AngularSelectorElement parseSelectorFromString(SimpleStringLiteral literal) {
+ static AngularSelectorElement _parseSelectorFromString(SimpleStringLiteral literal) {
int offset = literal.valueOffset;
String text = literal.stringValue;
return parseSelector(offset, text);
@@ -268,7 +268,7 @@ class AngularCompilationUnitBuilder {
* Builds Angular specific element models and adds them to the existing Dart elements.
*/
void build() {
- parseViews();
+ _parseViews();
// process classes
for (CompilationUnitMember unitMember in _unit.declarations) {
if (unitMember is ClassDeclaration) {
@@ -284,23 +284,23 @@ class AngularCompilationUnitBuilder {
}
this._annotation = annotation;
// @NgFilter
- if (isAngularAnnotation(annotation, _NG_FILTER)) {
- parseNgFilter();
+ if (_isAngularAnnotation(annotation, _NG_FILTER)) {
+ _parseNgFilter();
continue;
}
// @NgComponent
- if (isAngularAnnotation(annotation, _NG_COMPONENT)) {
- parseNgComponent();
+ if (_isAngularAnnotation(annotation, _NG_COMPONENT)) {
+ _parseNgComponent();
continue;
}
// @NgController
- if (isAngularAnnotation(annotation, _NG_CONTROLLER)) {
- parseNgController();
+ if (_isAngularAnnotation(annotation, _NG_CONTROLLER)) {
+ _parseNgController();
continue;
}
// @NgDirective
- if (isAngularAnnotation(annotation, _NG_DIRECTIVE)) {
- parseNgDirective();
+ if (_isAngularAnnotation(annotation, _NG_DIRECTIVE)) {
+ _parseNgDirective();
continue;
}
}
@@ -317,7 +317,7 @@ class AngularCompilationUnitBuilder {
* @return the argument [Expression] with given name form [annotation], may be
* `null` if not found.
*/
- Expression getArgument(String name) {
+ Expression _getArgument(String name) {
List<Expression> arguments = _annotation.arguments.arguments;
for (Expression argument in arguments) {
if (argument is NamedExpression) {
@@ -334,36 +334,36 @@ class AngularCompilationUnitBuilder {
/**
* @return the [String] value of the named argument.
*/
- String getStringArgument(String name) => getStringLiteral(name).value;
+ String _getStringArgument(String name) => _getStringLiteral(name).value;
/**
* @return the offset of the value of the named argument.
*/
- int getStringArgumentOffset(String name) {
- Expression argument = getArgument(name);
+ int _getStringArgumentOffset(String name) {
+ Expression argument = _getArgument(name);
return (argument as SimpleStringLiteral).valueOffset;
}
/**
* @return the [SimpleStringLiteral] of the named argument.
*/
- SimpleStringLiteral getStringLiteral(String name) {
- Expression argument = getArgument(name);
+ SimpleStringLiteral _getStringLiteral(String name) {
+ Expression argument = _getArgument(name);
return argument as SimpleStringLiteral;
}
/**
* Checks if [namedArguments] has string value for the argument with the given name.
*/
- bool hasStringArgument(String name) {
- Expression argument = getArgument(name);
+ bool _hasStringArgument(String name) {
+ Expression argument = _getArgument(name);
return argument is SimpleStringLiteral;
}
/**
* Checks if given [Annotation] is an annotation with required name.
*/
- bool isAngularAnnotation(Annotation annotation, String name) {
+ bool _isAngularAnnotation(Annotation annotation, String name) {
Element element = annotation.element;
if (element is ConstructorElement) {
ConstructorElement constructorElement = element;
@@ -372,41 +372,41 @@ class AngularCompilationUnitBuilder {
return false;
}
- void parseNgComponent() {
+ void _parseNgComponent() {
bool isValid = true;
// publishAs
String name = null;
int nameOffset = -1;
- if (hasStringArgument(_PUBLISH_AS)) {
- name = getStringArgument(_PUBLISH_AS);
- nameOffset = getStringArgumentOffset(_PUBLISH_AS);
+ if (_hasStringArgument(_PUBLISH_AS)) {
+ name = _getStringArgument(_PUBLISH_AS);
+ nameOffset = _getStringArgumentOffset(_PUBLISH_AS);
}
// selector
AngularSelectorElement selector = null;
- if (!hasStringArgument(_SELECTOR)) {
- reportErrorForAnnotation(AngularCode.MISSING_SELECTOR, []);
+ if (!_hasStringArgument(_SELECTOR)) {
+ _reportErrorForAnnotation(AngularCode.MISSING_SELECTOR, []);
isValid = false;
} else {
- SimpleStringLiteral selectorLiteral = getStringLiteral(_SELECTOR);
- selector = parseSelectorFromString(selectorLiteral);
+ SimpleStringLiteral selectorLiteral = _getStringLiteral(_SELECTOR);
+ selector = _parseSelectorFromString(selectorLiteral);
if (selector == null) {
- reportErrorForArgument(_SELECTOR, AngularCode.CANNOT_PARSE_SELECTOR, [selectorLiteral]);
+ _reportErrorForArgument(_SELECTOR, AngularCode.CANNOT_PARSE_SELECTOR, [selectorLiteral]);
isValid = false;
}
}
// templateUrl
String templateUri = null;
int templateUriOffset = -1;
- if (hasStringArgument(_TEMPLATE_URL)) {
- templateUri = getStringArgument(_TEMPLATE_URL);
- templateUriOffset = getStringArgumentOffset(_TEMPLATE_URL);
+ if (_hasStringArgument(_TEMPLATE_URL)) {
+ templateUri = _getStringArgument(_TEMPLATE_URL);
+ templateUriOffset = _getStringArgumentOffset(_TEMPLATE_URL);
}
// cssUrl
String styleUri = null;
int styleUriOffset = -1;
- if (hasStringArgument(_CSS_URL)) {
- styleUri = getStringArgument(_CSS_URL);
- styleUriOffset = getStringArgumentOffset(_CSS_URL);
+ if (_hasStringArgument(_CSS_URL)) {
+ styleUri = _getStringArgument(_CSS_URL);
+ styleUriOffset = _getStringArgumentOffset(_CSS_URL);
}
// create
if (isValid) {
@@ -416,8 +416,8 @@ class AngularCompilationUnitBuilder {
element.templateUriOffset = templateUriOffset;
element.styleUri = styleUri;
element.styleUriOffset = styleUriOffset;
- element.properties = parseNgComponentProperties();
- element.scopeProperties = parseScopeProperties();
+ element.properties = _parseNgComponentProperties();
+ element.scopeProperties = _parseScopeProperties();
_classToolkitObjects.add(element);
}
}
@@ -425,17 +425,17 @@ class AngularCompilationUnitBuilder {
/**
* Parses [AngularPropertyElement]s from [annotation] and [classDeclaration].
*/
- List<AngularPropertyElement> parseNgComponentProperties() {
+ List<AngularPropertyElement> _parseNgComponentProperties() {
List<AngularPropertyElement> properties = [];
- parseNgComponentProperties_fromMap(properties);
- parseNgComponentProperties_fromFields(properties);
+ _parseNgComponentProperties_fromMap(properties);
+ _parseNgComponentProperties_fromFields(properties);
return new List.from(properties);
}
/**
* Parses [AngularPropertyElement]s from [annotation].
*/
- void parseNgComponentProperties_fromFields(List<AngularPropertyElement> properties) {
+ void _parseNgComponentProperties_fromFields(List<AngularPropertyElement> properties) {
NodeList<ClassMember> members = _classDeclaration.members;
for (ClassMember member in members) {
if (member is FieldDeclaration) {
@@ -443,21 +443,21 @@ class AngularCompilationUnitBuilder {
for (Annotation annotation in fieldDeclaration.metadata) {
// prepare property kind (if property annotation at all)
AngularPropertyKind kind = null;
- if (isAngularAnnotation(annotation, _NG_ATTR)) {
+ if (_isAngularAnnotation(annotation, _NG_ATTR)) {
kind = AngularPropertyKind.ATTR;
- } else if (isAngularAnnotation(annotation, _NG_CALLBACK)) {
+ } else if (_isAngularAnnotation(annotation, _NG_CALLBACK)) {
kind = AngularPropertyKind.CALLBACK;
- } else if (isAngularAnnotation(annotation, _NG_ONE_WAY)) {
+ } else if (_isAngularAnnotation(annotation, _NG_ONE_WAY)) {
kind = AngularPropertyKind.ONE_WAY;
- } else if (isAngularAnnotation(annotation, _NG_ONE_WAY_ONE_TIME)) {
+ } else if (_isAngularAnnotation(annotation, _NG_ONE_WAY_ONE_TIME)) {
kind = AngularPropertyKind.ONE_WAY_ONE_TIME;
- } else if (isAngularAnnotation(annotation, _NG_TWO_WAY)) {
+ } else if (_isAngularAnnotation(annotation, _NG_TWO_WAY)) {
kind = AngularPropertyKind.TWO_WAY;
}
// add property
if (kind != null) {
- SimpleStringLiteral nameLiteral = getOnlySimpleStringLiteralArgument(annotation);
- FieldElement field = getOnlyFieldElement(fieldDeclaration);
+ SimpleStringLiteral nameLiteral = _getOnlySimpleStringLiteralArgument(annotation);
+ FieldElement field = _getOnlyFieldElement(fieldDeclaration);
if (nameLiteral != null && field != null) {
AngularPropertyElementImpl property = new AngularPropertyElementImpl(nameLiteral.value, nameLiteral.valueOffset);
property.field = field;
@@ -473,15 +473,15 @@ class AngularCompilationUnitBuilder {
/**
* Parses [AngularPropertyElement]s from [annotation].
*/
- void parseNgComponentProperties_fromMap(List<AngularPropertyElement> properties) {
- Expression mapExpression = getArgument("map");
+ void _parseNgComponentProperties_fromMap(List<AngularPropertyElement> properties) {
+ Expression mapExpression = _getArgument("map");
// may be not properties
if (mapExpression == null) {
return;
}
// prepare map literal
if (mapExpression is! MapLiteral) {
- reportErrorForNode(AngularCode.INVALID_PROPERTY_MAP, mapExpression, []);
+ _reportErrorForNode(AngularCode.INVALID_PROPERTY_MAP, mapExpression, []);
return;
}
MapLiteral mapLiteral = mapExpression as MapLiteral;
@@ -490,7 +490,7 @@ class AngularCompilationUnitBuilder {
// prepare property name
Expression nameExpression = entry.key;
if (nameExpression is! SimpleStringLiteral) {
- reportErrorForNode(AngularCode.INVALID_PROPERTY_NAME, nameExpression, []);
+ _reportErrorForNode(AngularCode.INVALID_PROPERTY_NAME, nameExpression, []);
continue;
}
SimpleStringLiteral nameLiteral = nameExpression as SimpleStringLiteral;
@@ -499,7 +499,7 @@ class AngularCompilationUnitBuilder {
// prepare field specification
Expression specExpression = entry.value;
if (specExpression is! SimpleStringLiteral) {
- reportErrorForNode(AngularCode.INVALID_PROPERTY_SPEC, specExpression, []);
+ _reportErrorForNode(AngularCode.INVALID_PROPERTY_SPEC, specExpression, []);
continue;
}
SimpleStringLiteral specLiteral = specExpression as SimpleStringLiteral;
@@ -523,7 +523,7 @@ class AngularCompilationUnitBuilder {
kind = AngularPropertyKind.TWO_WAY;
fieldNameOffset = 3;
} else {
- reportErrorForNode(AngularCode.INVALID_PROPERTY_KIND, specLiteral, [spec]);
+ _reportErrorForNode(AngularCode.INVALID_PROPERTY_KIND, specLiteral, [spec]);
continue;
}
String fieldName = spec.substring(fieldNameOffset);
@@ -531,7 +531,7 @@ class AngularCompilationUnitBuilder {
// prepare field
PropertyAccessorElement setter = _classElement.type.lookUpSetter(fieldName, _classElement.library);
if (setter == null) {
- reportErrorForOffset(AngularCode.INVALID_PROPERTY_FIELD, fieldNameOffset, fieldName.length, [fieldName]);
+ _reportErrorForOffset(AngularCode.INVALID_PROPERTY_FIELD, fieldNameOffset, fieldName.length, [fieldName]);
continue;
}
FieldElement field = setter.variable as FieldElement;
@@ -544,48 +544,48 @@ class AngularCompilationUnitBuilder {
}
}
- void parseNgController() {
+ void _parseNgController() {
bool isValid = true;
// publishAs
- if (!hasStringArgument(_PUBLISH_AS)) {
- reportErrorForAnnotation(AngularCode.MISSING_PUBLISH_AS, []);
+ if (!_hasStringArgument(_PUBLISH_AS)) {
+ _reportErrorForAnnotation(AngularCode.MISSING_PUBLISH_AS, []);
isValid = false;
}
// selector
AngularSelectorElement selector = null;
- if (!hasStringArgument(_SELECTOR)) {
- reportErrorForAnnotation(AngularCode.MISSING_SELECTOR, []);
+ if (!_hasStringArgument(_SELECTOR)) {
+ _reportErrorForAnnotation(AngularCode.MISSING_SELECTOR, []);
isValid = false;
} else {
- SimpleStringLiteral selectorLiteral = getStringLiteral(_SELECTOR);
- selector = parseSelectorFromString(selectorLiteral);
+ SimpleStringLiteral selectorLiteral = _getStringLiteral(_SELECTOR);
+ selector = _parseSelectorFromString(selectorLiteral);
if (selector == null) {
- reportErrorForArgument(_SELECTOR, AngularCode.CANNOT_PARSE_SELECTOR, [selectorLiteral]);
+ _reportErrorForArgument(_SELECTOR, AngularCode.CANNOT_PARSE_SELECTOR, [selectorLiteral]);
isValid = false;
}
}
// create
if (isValid) {
- String name = getStringArgument(_PUBLISH_AS);
- int nameOffset = getStringArgumentOffset(_PUBLISH_AS);
+ String name = _getStringArgument(_PUBLISH_AS);
+ int nameOffset = _getStringArgumentOffset(_PUBLISH_AS);
AngularControllerElementImpl element = new AngularControllerElementImpl(name, nameOffset);
element.selector = selector;
_classToolkitObjects.add(element);
}
}
- void parseNgDirective() {
+ void _parseNgDirective() {
bool isValid = true;
// selector
AngularSelectorElement selector = null;
- if (!hasStringArgument(_SELECTOR)) {
- reportErrorForAnnotation(AngularCode.MISSING_SELECTOR, []);
+ if (!_hasStringArgument(_SELECTOR)) {
+ _reportErrorForAnnotation(AngularCode.MISSING_SELECTOR, []);
isValid = false;
} else {
- SimpleStringLiteral selectorLiteral = getStringLiteral(_SELECTOR);
- selector = parseSelectorFromString(selectorLiteral);
+ SimpleStringLiteral selectorLiteral = _getStringLiteral(_SELECTOR);
+ selector = _parseSelectorFromString(selectorLiteral);
if (selector == null) {
- reportErrorForArgument(_SELECTOR, AngularCode.CANNOT_PARSE_SELECTOR, [selectorLiteral]);
+ _reportErrorForArgument(_SELECTOR, AngularCode.CANNOT_PARSE_SELECTOR, [selectorLiteral]);
isValid = false;
}
}
@@ -594,27 +594,27 @@ class AngularCompilationUnitBuilder {
int offset = _annotation.offset;
AngularDirectiveElementImpl element = new AngularDirectiveElementImpl(offset);
element.selector = selector;
- element.properties = parseNgComponentProperties();
+ element.properties = _parseNgComponentProperties();
_classToolkitObjects.add(element);
}
}
- void parseNgFilter() {
+ void _parseNgFilter() {
bool isValid = true;
// name
- if (!hasStringArgument(_NAME)) {
- reportErrorForAnnotation(AngularCode.MISSING_NAME, []);
+ if (!_hasStringArgument(_NAME)) {
+ _reportErrorForAnnotation(AngularCode.MISSING_NAME, []);
isValid = false;
}
// create
if (isValid) {
- String name = getStringArgument(_NAME);
- int nameOffset = getStringArgumentOffset(_NAME);
+ String name = _getStringArgument(_NAME);
+ int nameOffset = _getStringArgumentOffset(_NAME);
_classToolkitObjects.add(new AngularFilterElementImpl(name, nameOffset));
}
}
- List<AngularScopePropertyElement> parseScopeProperties() {
+ List<AngularScopePropertyElement> _parseScopeProperties() {
List<AngularScopePropertyElement> properties = [];
_classDeclaration.accept(new RecursiveAstVisitor_AngularCompilationUnitBuilder_parseScopeProperties(properties));
return new List.from(properties);
@@ -624,7 +624,7 @@ class AngularCompilationUnitBuilder {
* Create [AngularViewElement] for each valid <code>view('template.html')</code> invocation,
* where <code>view</code> is <code>ViewFactory</code>.
*/
- void parseViews() {
+ void _parseViews() {
List<AngularViewElement> views = [];
_unit.accept(new RecursiveAstVisitor_AngularCompilationUnitBuilder_parseViews(views));
if (!views.isEmpty) {
@@ -633,22 +633,22 @@ class AngularCompilationUnitBuilder {
}
}
- void reportErrorForAnnotation(ErrorCode errorCode, List<Object> arguments) {
- reportErrorForNode(errorCode, _annotation, arguments);
+ void _reportErrorForAnnotation(ErrorCode errorCode, List<Object> arguments) {
+ _reportErrorForNode(errorCode, _annotation, arguments);
}
- void reportErrorForArgument(String argumentName, ErrorCode errorCode, List<Object> arguments) {
- Expression argument = getArgument(argumentName);
- reportErrorForNode(errorCode, argument, arguments);
+ void _reportErrorForArgument(String argumentName, ErrorCode errorCode, List<Object> arguments) {
+ Expression argument = _getArgument(argumentName);
+ _reportErrorForNode(errorCode, argument, arguments);
}
- void reportErrorForNode(ErrorCode errorCode, AstNode node, List<Object> arguments) {
+ void _reportErrorForNode(ErrorCode errorCode, AstNode node, List<Object> arguments) {
int offset = node.offset;
int length = node.length;
- reportErrorForOffset(errorCode, offset, length, arguments);
+ _reportErrorForOffset(errorCode, offset, length, arguments);
}
- void reportErrorForOffset(ErrorCode errorCode, int offset, int length, List<Object> arguments) {
+ void _reportErrorForOffset(ErrorCode errorCode, int offset, int length, List<Object> arguments) {
_errorListener.onError(new AnalysisError.con2(_source, offset, length, errorCode, arguments));
}
}
@@ -659,19 +659,19 @@ class RecursiveAstVisitor_AngularCompilationUnitBuilder_parseScopeProperties ext
RecursiveAstVisitor_AngularCompilationUnitBuilder_parseScopeProperties(this.properties) : super();
Object visitAssignmentExpression(AssignmentExpression node) {
- addProperty(node);
+ _addProperty(node);
return super.visitAssignmentExpression(node);
}
- void addProperty(AssignmentExpression node) {
+ void _addProperty(AssignmentExpression node) {
// try to find "name" in scope[name]
- SimpleStringLiteral nameNode = getNameNode(node.leftHandSide);
+ SimpleStringLiteral nameNode = _getNameNode(node.leftHandSide);
if (nameNode == null) {
return;
}
// prepare unique
String name = nameNode.stringValue;
- if (hasPropertyWithName(name)) {
+ if (_hasPropertyWithName(name)) {
return;
}
// do add property
@@ -681,19 +681,19 @@ class RecursiveAstVisitor_AngularCompilationUnitBuilder_parseScopeProperties ext
properties.add(property);
}
- SimpleStringLiteral getNameNode(Expression node) {
+ SimpleStringLiteral _getNameNode(Expression node) {
if (node is IndexExpression) {
IndexExpression indexExpression = node;
Expression target = indexExpression.target;
Expression index = indexExpression.index;
- if (index is SimpleStringLiteral && isContext(target)) {
+ if (index is SimpleStringLiteral && _isContext(target)) {
return index;
}
}
return null;
}
- bool hasPropertyWithName(String name) {
+ bool _hasPropertyWithName(String name) {
for (AngularScopePropertyElement property in properties) {
if (property.name == name) {
return true;
@@ -702,17 +702,17 @@ class RecursiveAstVisitor_AngularCompilationUnitBuilder_parseScopeProperties ext
return false;
}
- bool isContext(Expression target) {
+ bool _isContext(Expression target) {
if (target is PrefixedIdentifier) {
PrefixedIdentifier prefixed = target;
SimpleIdentifier prefix = prefixed.prefix;
SimpleIdentifier identifier = prefixed.identifier;
- return (identifier.name == "context") && isScope(prefix);
+ return (identifier.name == "context") && _isScope(prefix);
}
return false;
}
- bool isScope(Expression target) {
+ bool _isScope(Expression target) {
if (target != null) {
Type2 type = target.bestType;
if (type is InterfaceType) {
@@ -730,11 +730,11 @@ class RecursiveAstVisitor_AngularCompilationUnitBuilder_parseViews extends Recur
RecursiveAstVisitor_AngularCompilationUnitBuilder_parseViews(this.views) : super();
Object visitMethodInvocation(MethodInvocation node) {
- addView(node);
+ _addView(node);
return super.visitMethodInvocation(node);
}
- void addView(MethodInvocation node) {
+ void _addView(MethodInvocation node) {
// only one argument
List<Expression> arguments = node.argumentList.arguments;
if (arguments.length != 1) {
@@ -751,7 +751,7 @@ class RecursiveAstVisitor_AngularCompilationUnitBuilder_parseViews extends Recur
return;
}
// should be ViewFactory
- if (!isViewFactory(node.methodName)) {
+ if (!_isViewFactory(node.methodName)) {
return;
}
// add AngularViewElement
@@ -760,7 +760,7 @@ class RecursiveAstVisitor_AngularCompilationUnitBuilder_parseViews extends Recur
views.add(new AngularViewElementImpl(templateUri, templateUriOffset));
}
- bool isViewFactory(Expression target) {
+ bool _isViewFactory(Expression target) {
if (target is SimpleIdentifier) {
SimpleIdentifier identifier = target;
Element element = identifier.staticElement;
@@ -901,7 +901,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
try {
List<ClassMember> nonFields = new List<ClassMember>();
node.visitChildren(new UnifyingAstVisitor_ElementBuilder_visitClassDeclaration(this, nonFields));
- buildFieldMap(holder.fieldsWithoutFlushing);
+ _buildFieldMap(holder.fieldsWithoutFlushing);
int count = nonFields.length;
for (int i = 0; i < count; i++) {
nonFields[i].accept(this);
@@ -912,7 +912,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
SimpleIdentifier className = node.name;
ClassElementImpl element = new ClassElementImpl(className);
List<TypeParameterElement> typeParameters = holder.typeParameters;
- List<Type2> typeArguments = createTypeParameterTypes(typeParameters);
+ List<Type2> typeArguments = _createTypeParameterTypes(typeParameters);
InterfaceTypeImpl interfaceType = new InterfaceTypeImpl.con1(element);
interfaceType.typeArguments = typeArguments;
element.type = interfaceType;
@@ -921,7 +921,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
//
// Create the default constructor.
//
- constructors = createDefaultConstructors(interfaceType);
+ constructors = _createDefaultConstructors(interfaceType);
}
element.abstract = node.abstractKeyword != null;
element.accessors = holder.accessors;
@@ -945,19 +945,19 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
Object visitClassTypeAlias(ClassTypeAlias node) {
ElementHolder holder = new ElementHolder();
_functionTypesToFix = new List<FunctionTypeImpl>();
- visitChildren(holder, node);
+ _visitChildren(holder, node);
SimpleIdentifier className = node.name;
ClassElementImpl element = new ClassElementImpl(className);
element.abstract = node.abstractKeyword != null;
element.typedef = true;
List<TypeParameterElement> typeParameters = holder.typeParameters;
element.typeParameters = typeParameters;
- List<Type2> typeArguments = createTypeParameterTypes(typeParameters);
+ List<Type2> typeArguments = _createTypeParameterTypes(typeParameters);
InterfaceTypeImpl interfaceType = new InterfaceTypeImpl.con1(element);
interfaceType.typeArguments = typeArguments;
element.type = interfaceType;
// set default constructor
- element.constructors = createDefaultConstructors(interfaceType);
+ element.constructors = _createDefaultConstructors(interfaceType);
for (FunctionTypeImpl functionType in _functionTypesToFix) {
functionType.typeArguments = typeArguments;
}
@@ -974,7 +974,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
bool wasInFunction = _inFunction;
_inFunction = true;
try {
- visitChildren(holder, node);
+ _visitChildren(holder, node);
} finally {
_inFunction = wasInFunction;
}
@@ -1010,8 +1010,8 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
int declarationEnd = node.offset + node.length;
int statementEnd = statement.offset + statement.length;
element.setVisibleRange(declarationEnd, statementEnd - declarationEnd - 1);
- element.const3 = matches(keyword, sc.Keyword.CONST);
- element.final2 = matches(keyword, sc.Keyword.FINAL);
+ element.const3 = _matches(keyword, sc.Keyword.CONST);
+ element.final2 = _matches(keyword, sc.Keyword.FINAL);
_currentHolder.addLocalVariable(element);
variableName.staticElement = element;
return super.visitDeclaredIdentifier(node);
@@ -1037,7 +1037,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
// set initializer, default value range
Expression defaultValue = node.defaultValue;
if (defaultValue != null) {
- visit(holder, defaultValue);
+ _visit(holder, defaultValue);
FunctionElementImpl initializer = new FunctionElementImpl.con2(defaultValue.beginToken.offset);
initializer.functions = holder.functions;
initializer.labels = holder.labels;
@@ -1048,7 +1048,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
parameter.setDefaultValueRange(defaultValue.offset, defaultValue.length);
}
// visible range
- setParameterVisibleRange(node, parameter);
+ _setParameterVisibleRange(node, parameter);
_currentHolder.addParameter(parameter);
parameterName.staticElement = parameter;
normalParameter.accept(this);
@@ -1085,7 +1085,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
// The children of this parameter include any parameters defined on the type of this parameter.
//
ElementHolder holder = new ElementHolder();
- visitChildren(holder, node);
+ _visitChildren(holder, node);
(node.element as ParameterElementImpl).parameters = holder.parameters;
holder.validate();
return null;
@@ -1098,7 +1098,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
bool wasInFunction = _inFunction;
_inFunction = true;
try {
- visitChildren(holder, expression);
+ _visitChildren(holder, expression);
} finally {
_inFunction = wasInFunction;
}
@@ -1135,7 +1135,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
variable.synthetic = true;
_currentHolder.addTopLevelVariable(variable);
}
- if (matches(property, sc.Keyword.GET)) {
+ if (_matches(property, sc.Keyword.GET)) {
PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con1(propertyNameNode);
getter.functions = holder.functions;
getter.labels = holder.labels;
@@ -1173,7 +1173,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
bool wasInFunction = _inFunction;
_inFunction = true;
try {
- visitChildren(holder, node);
+ _visitChildren(holder, node);
} finally {
_inFunction = wasInFunction;
}
@@ -1203,7 +1203,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
Object visitFunctionTypeAlias(FunctionTypeAlias node) {
ElementHolder holder = new ElementHolder();
- visitChildren(holder, node);
+ _visitChildren(holder, node);
SimpleIdentifier aliasName = node.name;
List<ParameterElement> parameters = holder.parameters;
List<TypeParameterElement> typeParameters = holder.typeParameters;
@@ -1211,7 +1211,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
element.parameters = parameters;
element.typeParameters = typeParameters;
FunctionTypeImpl type = new FunctionTypeImpl.con2(element);
- type.typeArguments = createTypeParameterTypes(typeParameters);
+ type.typeArguments = _createTypeParameterTypes(typeParameters);
element.type = type;
_currentHolder.addTypeAlias(element);
aliasName.staticElement = element;
@@ -1224,7 +1224,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
SimpleIdentifier parameterName = node.identifier;
ParameterElementImpl parameter = new ParameterElementImpl.con1(parameterName);
parameter.parameterKind = node.kind;
- setParameterVisibleRange(node, parameter);
+ _setParameterVisibleRange(node, parameter);
_currentHolder.addParameter(parameter);
parameterName.staticElement = parameter;
}
@@ -1232,7 +1232,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
// The children of this parameter include any parameters defined on the type of this parameter.
//
ElementHolder holder = new ElementHolder();
- visitChildren(holder, node);
+ _visitChildren(holder, node);
(node.element as ParameterElementImpl).parameters = holder.parameters;
holder.validate();
return null;
@@ -1254,7 +1254,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
bool wasInFunction = _inFunction;
_inFunction = true;
try {
- visitChildren(holder, node);
+ _visitChildren(holder, node);
} finally {
_inFunction = wasInFunction;
}
@@ -1286,7 +1286,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
field.synthetic = true;
_currentHolder.addField(field);
}
- if (matches(property, sc.Keyword.GET)) {
+ if (_matches(property, sc.Keyword.GET)) {
PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con1(propertyNameNode);
getter.functions = holder.functions;
getter.labels = holder.labels;
@@ -1305,7 +1305,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
setter.localVariables = holder.localVariables;
setter.parameters = holder.parameters;
setter.variable = field;
- setter.abstract = node.body is EmptyFunctionBody && !matches(node.externalKeyword, sc.Keyword.EXTERNAL);
+ setter.abstract = node.body is EmptyFunctionBody && !_matches(node.externalKeyword, sc.Keyword.EXTERNAL);
setter.setter = true;
setter.static = isStatic;
field.setter = setter;
@@ -1325,7 +1325,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
parameter.const3 = node.isConst;
parameter.final2 = node.isFinal;
parameter.parameterKind = node.kind;
- setParameterVisibleRange(node, parameter);
+ _setParameterVisibleRange(node, parameter);
_currentHolder.addParameter(parameter);
parameterName.staticElement = parameter;
}
@@ -1369,8 +1369,8 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
Object visitVariableDeclaration(VariableDeclaration node) {
sc.Token keyword = (node.parent as VariableDeclarationList).keyword;
- bool isConst = matches(keyword, sc.Keyword.CONST);
- bool isFinal = matches(keyword, sc.Keyword.FINAL);
+ bool isConst = _matches(keyword, sc.Keyword.CONST);
+ bool isFinal = _matches(keyword, sc.Keyword.FINAL);
bool hasInitializer = node.initializer != null;
VariableElementImpl element;
if (_inFieldContext) {
@@ -1419,7 +1419,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
bool wasInFieldContext = _inFieldContext;
_inFieldContext = false;
try {
- visit(holder, node.initializer);
+ _visit(holder, node.initializer);
} finally {
_inFieldContext = wasInFieldContext;
}
@@ -1434,7 +1434,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
if (element is PropertyInducingElementImpl) {
PropertyInducingElementImpl variable = element as PropertyInducingElementImpl;
if (_inFieldContext) {
- (variable as FieldElementImpl).static = matches((node.parent.parent as FieldDeclaration).staticKeyword, sc.Keyword.STATIC);
+ (variable as FieldElementImpl).static = _matches((node.parent.parent as FieldDeclaration).staticKeyword, sc.Keyword.STATIC);
}
PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(variable);
getter.getter = true;
@@ -1462,7 +1462,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
*
* @param fields the field elements defined in the current class
*/
- void buildFieldMap(List<FieldElement> fields) {
+ void _buildFieldMap(List<FieldElement> fields) {
_fieldMap = new Map<String, FieldElement>();
int count = fields.length;
for (int i = 0; i < count; i++) {
@@ -1477,7 +1477,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
* @param interfaceType the interface type for which to create a default constructor
* @return the [ConstructorElement]s array with the single default constructor element
*/
- List<ConstructorElement> createDefaultConstructors(InterfaceTypeImpl interfaceType) {
+ List<ConstructorElement> _createDefaultConstructors(InterfaceTypeImpl interfaceType) {
ConstructorElementImpl constructor = new ConstructorElementImpl.con1(null);
constructor.synthetic = true;
constructor.returnType = interfaceType;
@@ -1494,7 +1494,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
* @param typeParameters the type parameters for which types are to be created
* @return an array of types corresponding to the given parameters
*/
- List<Type2> createTypeParameterTypes(List<TypeParameterElement> typeParameters) {
+ List<Type2> _createTypeParameterTypes(List<TypeParameterElement> typeParameters) {
int typeParameterCount = typeParameters.length;
List<Type2> typeArguments = new List<Type2>(typeParameterCount);
for (int i = 0; i < typeParameterCount; i++) {
@@ -1513,7 +1513,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
* @param node the parameter contained in the function whose body is to be returned
* @return the body of the function that contains the given parameter
*/
- FunctionBody getFunctionBody(FormalParameter node) {
+ FunctionBody _getFunctionBody(FormalParameter node) {
AstNode parent = node.parent;
while (parent != null) {
if (parent is ConstructorDeclaration) {
@@ -1535,13 +1535,13 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
* @param keyword the keyword being tested for
* @return `true` if the given token is a token for the given keyword
*/
- bool matches(sc.Token token, sc.Keyword keyword) => token != null && identical(token.type, sc.TokenType.KEYWORD) && identical((token as sc.KeywordToken).keyword, keyword);
+ bool _matches(sc.Token token, sc.Keyword keyword) => token != null && identical(token.type, sc.TokenType.KEYWORD) && identical((token as sc.KeywordToken).keyword, keyword);
/**
* Sets the visible source range for formal parameter.
*/
- void setParameterVisibleRange(FormalParameter node, ParameterElementImpl element) {
- FunctionBody body = getFunctionBody(node);
+ void _setParameterVisibleRange(FormalParameter node, ParameterElementImpl element) {
+ FunctionBody body = _getFunctionBody(node);
if (body != null) {
element.setVisibleRange(body.offset, body.length);
}
@@ -1553,7 +1553,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
* @param holder the holder that will gather elements that are built while visiting the children
* @param node the node to be visited
*/
- void visit(ElementHolder holder, AstNode node) {
+ void _visit(ElementHolder holder, AstNode node) {
if (node != null) {
ElementHolder previousHolder = _currentHolder;
_currentHolder = holder;
@@ -1571,7 +1571,7 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
* @param holder the holder that will gather elements that are built while visiting the children
* @param node the node whose children are to be visited
*/
- void visitChildren(ElementHolder holder, AstNode node) {
+ void _visitChildren(ElementHolder holder, AstNode node) {
if (node != null) {
ElementHolder previousHolder = _currentHolder;
_currentHolder = holder;
@@ -2033,12 +2033,12 @@ class HtmlUnitBuilder implements ht.XmlVisitor<Object> {
Object visitHtmlScriptTagNode(ht.HtmlScriptTagNode node) {
if (_parentNodes.contains(node)) {
- return reportCircularity(node);
+ return _reportCircularity(node);
}
_parentNodes.add(node);
try {
Source htmlSource = _htmlElement.source;
- ht.XmlAttributeNode scriptAttribute = getScriptSourcePath(node);
+ ht.XmlAttributeNode scriptAttribute = _getScriptSourcePath(node);
String scriptSourcePath = scriptAttribute == null ? null : scriptAttribute.text;
if (identical(node.attributeEnd.type, ht.TokenType.GT) && scriptSourcePath == null) {
EmbeddedHtmlScriptElementImpl script = new EmbeddedHtmlScriptElementImpl(node);
@@ -2065,10 +2065,10 @@ class HtmlUnitBuilder implements ht.XmlVisitor<Object> {
Source scriptSource = _context.sourceFactory.resolveUri(htmlSource, scriptSourcePath);
script.scriptSource = scriptSource;
if (!_context.exists(scriptSource)) {
- reportValueError(HtmlWarningCode.URI_DOES_NOT_EXIST, scriptAttribute, [scriptSourcePath]);
+ _reportValueError(HtmlWarningCode.URI_DOES_NOT_EXIST, scriptAttribute, [scriptSourcePath]);
}
} on URISyntaxException catch (exception) {
- reportValueError(HtmlWarningCode.INVALID_URI, scriptAttribute, [scriptSourcePath]);
+ _reportValueError(HtmlWarningCode.INVALID_URI, scriptAttribute, [scriptSourcePath]);
}
}
node.scriptElement = script;
@@ -2097,7 +2097,7 @@ class HtmlUnitBuilder implements ht.XmlVisitor<Object> {
Object visitXmlTagNode(ht.XmlTagNode node) {
if (_parentNodes.contains(node)) {
- return reportCircularity(node);
+ return _reportCircularity(node);
}
_parentNodes.add(node);
try {
@@ -2114,7 +2114,7 @@ class HtmlUnitBuilder implements ht.XmlVisitor<Object> {
* @param node the node containing attributes
* @return the source attribute contained in the given tag
*/
- ht.XmlAttributeNode getScriptSourcePath(ht.XmlTagNode node) {
+ ht.XmlAttributeNode _getScriptSourcePath(ht.XmlTagNode node) {
for (ht.XmlAttributeNode attribute in node.attributes) {
if (attribute.name == _SRC) {
return attribute;
@@ -2123,7 +2123,7 @@ class HtmlUnitBuilder implements ht.XmlVisitor<Object> {
return null;
}
- Object reportCircularity(ht.XmlTagNode node) {
+ Object _reportCircularity(ht.XmlTagNode node) {
//
// This should not be possible, but we have an error report that suggests that it happened at
// least once. This code will guard against infinite recursion and might help us identify the
@@ -2160,7 +2160,7 @@ class HtmlUnitBuilder implements ht.XmlVisitor<Object> {
* @param length the number of characters to be highlighted
* @param arguments the arguments used to compose the error message
*/
- void reportErrorForOffset(ErrorCode errorCode, int offset, int length, List<Object> arguments) {
+ void _reportErrorForOffset(ErrorCode errorCode, int offset, int length, List<Object> arguments) {
_errorListener.onError(new AnalysisError.con2(_htmlElement.source, offset, length, errorCode, arguments));
}
@@ -2173,10 +2173,10 @@ class HtmlUnitBuilder implements ht.XmlVisitor<Object> {
* @param length the number of characters to be highlighted
* @param arguments the arguments used to compose the error message
*/
- void reportValueError(ErrorCode errorCode, ht.XmlAttributeNode attribute, List<Object> arguments) {
+ void _reportValueError(ErrorCode errorCode, ht.XmlAttributeNode attribute, List<Object> arguments) {
int offset = attribute.valueToken.offset + 1;
int length = attribute.valueToken.length - 2;
- reportErrorForOffset(errorCode, offset, length, arguments);
+ _reportErrorForOffset(errorCode, offset, length, arguments);
}
}
@@ -2208,9 +2208,9 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
* @return the first parent or grand-parent that is a parenthesized expression, that does not have
* a parenthesized expression parent
*/
- static ParenthesizedExpression wrapParenthesizedExpression(ParenthesizedExpression parenthesizedExpression) {
+ static ParenthesizedExpression _wrapParenthesizedExpression(ParenthesizedExpression parenthesizedExpression) {
if (parenthesizedExpression.parent is ParenthesizedExpression) {
- return wrapParenthesizedExpression(parenthesizedExpression.parent as ParenthesizedExpression);
+ return _wrapParenthesizedExpression(parenthesizedExpression.parent as ParenthesizedExpression);
}
return parenthesizedExpression;
}
@@ -2236,23 +2236,23 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
}
Object visitAsExpression(AsExpression node) {
- checkForUnnecessaryCast(node);
+ _checkForUnnecessaryCast(node);
return super.visitAsExpression(node);
}
Object visitAssignmentExpression(AssignmentExpression node) {
sc.TokenType operatorType = node.operator.type;
if (operatorType != sc.TokenType.EQ) {
- checkForDeprecatedMemberUse(node.bestElement, node);
+ _checkForDeprecatedMemberUse(node.bestElement, node);
} else {
- checkForUseOfVoidResult(node.rightHandSide);
+ _checkForUseOfVoidResult(node.rightHandSide);
}
return super.visitAssignmentExpression(node);
}
Object visitBinaryExpression(BinaryExpression node) {
- checkForDivisionOptimizationHint(node);
- checkForDeprecatedMemberUse(node.bestElement, node);
+ _checkForDivisionOptimizationHint(node);
+ _checkForDeprecatedMemberUse(node.bestElement, node);
return super.visitBinaryExpression(node);
}
@@ -2269,69 +2269,69 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
}
Object visitExportDirective(ExportDirective node) {
- checkForDeprecatedMemberUse(node.uriElement, node);
+ _checkForDeprecatedMemberUse(node.uriElement, node);
return super.visitExportDirective(node);
}
Object visitFunctionDeclaration(FunctionDeclaration node) {
- checkForMissingReturn(node.returnType, node.functionExpression.body);
+ _checkForMissingReturn(node.returnType, node.functionExpression.body);
return super.visitFunctionDeclaration(node);
}
Object visitImportDirective(ImportDirective node) {
- checkForDeprecatedMemberUse(node.uriElement, node);
+ _checkForDeprecatedMemberUse(node.uriElement, node);
return super.visitImportDirective(node);
}
Object visitIndexExpression(IndexExpression node) {
- checkForDeprecatedMemberUse(node.bestElement, node);
+ _checkForDeprecatedMemberUse(node.bestElement, node);
return super.visitIndexExpression(node);
}
Object visitInstanceCreationExpression(InstanceCreationExpression node) {
- checkForDeprecatedMemberUse(node.staticElement, node);
+ _checkForDeprecatedMemberUse(node.staticElement, node);
return super.visitInstanceCreationExpression(node);
}
Object visitIsExpression(IsExpression node) {
- checkAllTypeChecks(node);
+ _checkAllTypeChecks(node);
return super.visitIsExpression(node);
}
Object visitMethodDeclaration(MethodDeclaration node) {
// This was determined to not be a good hint, see: dartbug.com/16029
//checkForOverridingPrivateMember(node);
- checkForMissingReturn(node.returnType, node.body);
+ _checkForMissingReturn(node.returnType, node.body);
return super.visitMethodDeclaration(node);
}
Object visitPostfixExpression(PostfixExpression node) {
- checkForDeprecatedMemberUse(node.bestElement, node);
+ _checkForDeprecatedMemberUse(node.bestElement, node);
return super.visitPostfixExpression(node);
}
Object visitPrefixExpression(PrefixExpression node) {
- checkForDeprecatedMemberUse(node.bestElement, node);
+ _checkForDeprecatedMemberUse(node.bestElement, node);
return super.visitPrefixExpression(node);
}
Object visitRedirectingConstructorInvocation(RedirectingConstructorInvocation node) {
- checkForDeprecatedMemberUse(node.staticElement, node);
+ _checkForDeprecatedMemberUse(node.staticElement, node);
return super.visitRedirectingConstructorInvocation(node);
}
Object visitSimpleIdentifier(SimpleIdentifier node) {
- checkForDeprecatedMemberUseAtIdentifier(node);
+ _checkForDeprecatedMemberUseAtIdentifier(node);
return super.visitSimpleIdentifier(node);
}
Object visitSuperConstructorInvocation(SuperConstructorInvocation node) {
- checkForDeprecatedMemberUse(node.staticElement, node);
+ _checkForDeprecatedMemberUse(node.staticElement, node);
return super.visitSuperConstructorInvocation(node);
}
Object visitVariableDeclaration(VariableDeclaration node) {
- checkForUseOfVoidResult(node.initializer);
+ _checkForUseOfVoidResult(node.initializer);
return super.visitVariableDeclaration(node);
}
@@ -2346,7 +2346,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
* @see HintCode#UNNECESSARY_TYPE_CHECK_TRUE
* @see HintCode#UNNECESSARY_TYPE_CHECK_FALSE
*/
- bool checkAllTypeChecks(IsExpression node) {
+ bool _checkAllTypeChecks(IsExpression node) {
Expression expression = node.expression;
TypeName typeName = node.type;
Type2 lhsType = expression.staticType;
@@ -2402,7 +2402,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if a hint code is generated on the passed node
* @see HintCode#DEPRECATED_MEMBER_USE
*/
- bool checkForDeprecatedMemberUse(Element element, AstNode node) {
+ bool _checkForDeprecatedMemberUse(Element element, AstNode node) {
if (element != null && element.isDeprecated) {
String displayName = element.displayName;
if (element is ConstructorElement) {
@@ -2434,7 +2434,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if a hint code is generated on the passed node
* @see HintCode#DEPRECATED_MEMBER_USE
*/
- bool checkForDeprecatedMemberUseAtIdentifier(SimpleIdentifier identifier) {
+ bool _checkForDeprecatedMemberUseAtIdentifier(SimpleIdentifier identifier) {
if (identifier.inDeclarationContext()) {
return false;
}
@@ -2442,7 +2442,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
if ((parent is ConstructorName && identical(identifier, parent.name)) || (parent is SuperConstructorInvocation && identical(identifier, parent.constructorName)) || parent is HideCombinator) {
return false;
}
- return checkForDeprecatedMemberUse(identifier.bestElement, identifier);
+ return _checkForDeprecatedMemberUse(identifier.bestElement, identifier);
}
/**
@@ -2452,7 +2452,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if a hint code is generated on the passed node
* @see HintCode#DIVISION_OPTIMIZATION
*/
- bool checkForDivisionOptimizationHint(BinaryExpression node) {
+ bool _checkForDivisionOptimizationHint(BinaryExpression node) {
// Return if the operator is not '/'
if (node.operator.type != sc.TokenType.SLASH) {
return false;
@@ -2468,7 +2468,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
}
// Report error if the (x/y) has toInt() invoked on it
if (node.parent is ParenthesizedExpression) {
- ParenthesizedExpression parenthesizedExpression = wrapParenthesizedExpression(node.parent as ParenthesizedExpression);
+ ParenthesizedExpression parenthesizedExpression = _wrapParenthesizedExpression(node.parent as ParenthesizedExpression);
if (parenthesizedExpression.parent is MethodInvocation) {
MethodInvocation methodInvocation = parenthesizedExpression.parent as MethodInvocation;
if (_TO_INT_METHOD_NAME == methodInvocation.methodName.name && methodInvocation.argumentList.arguments.isEmpty) {
@@ -2490,7 +2490,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if a hint code is generated on the passed node
* @see HintCode#MISSING_RETURN
*/
- bool checkForMissingReturn(TypeName returnType, FunctionBody body) {
+ bool _checkForMissingReturn(TypeName returnType, FunctionBody body) {
// Check that the method or function has a return type, and a function body
if (returnType == null || body == null) {
return false;
@@ -2521,7 +2521,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if a hint code is generated on the passed node
* @see HintCode#OVERRIDE_EQUALS_BUT_NOT_HASH_CODE
*/
- bool checkForOverrideEqualsButNotHashCode(ClassDeclaration node) {
+ bool _checkForOverrideEqualsButNotHashCode(ClassDeclaration node) {
ClassElement classElement = node.element;
if (classElement == null) {
return false;
@@ -2545,7 +2545,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if a hint code is generated on the passed node
* @see HintCode#OVERRIDDING_PRIVATE_MEMBER
*/
- bool checkForOverridingPrivateMember(MethodDeclaration node) {
+ bool _checkForOverridingPrivateMember(MethodDeclaration node) {
// If not in an enclosing class, return false
if (_enclosingClass == null) {
return false;
@@ -2613,7 +2613,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if a hint code is generated on the passed node
* @see HintCode#UNNECESSARY_CAST
*/
- bool checkForUnnecessaryCast(AsExpression node) {
+ bool _checkForUnnecessaryCast(AsExpression node) {
Expression expression = node.expression;
TypeName typeName = node.type;
Type2 lhsType = expression.staticType;
@@ -2638,7 +2638,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if a hint code is generated on the passed node
* @see HintCode#USE_OF_VOID_RESULT
*/
- bool checkForUseOfVoidResult(Expression expression) {
+ bool _checkForUseOfVoidResult(Expression expression) {
if (expression == null || expression is! MethodInvocation) {
return false;
}
@@ -2677,7 +2677,7 @@ class Dart2JSVerifier extends RecursiveAstVisitor<Object> {
}
Object visitIsExpression(IsExpression node) {
- checkForIsDoubleHints(node);
+ _checkForIsDoubleHints(node);
return super.visitIsExpression(node);
}
@@ -2692,7 +2692,7 @@ class Dart2JSVerifier extends RecursiveAstVisitor<Object> {
* @see HintCode#IS_NOT_DOUBLE
* @see HintCode#IS_NOT_INT
*/
- bool checkForIsDoubleHints(IsExpression node) {
+ bool _checkForIsDoubleHints(IsExpression node) {
TypeName typeName = node.type;
Type2 type = typeName.type;
if (type != null && type.element != null) {
@@ -2746,20 +2746,20 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
bool isBarBar = identical(operator.type, sc.TokenType.BAR_BAR);
if (isAmpAmp || isBarBar) {
Expression lhsCondition = node.leftOperand;
- if (!isDebugConstant(lhsCondition)) {
- ValidResult lhsResult = getConstantBooleanValue(lhsCondition);
+ if (!_isDebugConstant(lhsCondition)) {
+ ValidResult lhsResult = _getConstantBooleanValue(lhsCondition);
if (lhsResult != null) {
if (lhsResult.isTrue && isBarBar) {
// report error on else block: true || !e!
_errorReporter.reportErrorForNode(HintCode.DEAD_CODE, node.rightOperand, []);
// only visit the LHS:
- safelyVisit(lhsCondition);
+ _safelyVisit(lhsCondition);
return null;
} else if (lhsResult.isFalse && isAmpAmp) {
// report error on if block: false && !e!
_errorReporter.reportErrorForNode(HintCode.DEAD_CODE, node.rightOperand, []);
// only visit the LHS:
- safelyVisit(lhsCondition);
+ _safelyVisit(lhsCondition);
return null;
}
}
@@ -2779,7 +2779,7 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
int size = statements.length;
for (int i = 0; i < size; i++) {
Statement currentStatement = statements[i];
- safelyVisit(currentStatement);
+ _safelyVisit(currentStatement);
if (currentStatement is ReturnStatement && i != size - 1) {
Statement nextStatement = statements[i + 1];
Statement lastStatement = statements[size - 1];
@@ -2794,19 +2794,19 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
Object visitConditionalExpression(ConditionalExpression node) {
Expression conditionExpression = node.condition;
- safelyVisit(conditionExpression);
- if (!isDebugConstant(conditionExpression)) {
- ValidResult result = getConstantBooleanValue(conditionExpression);
+ _safelyVisit(conditionExpression);
+ if (!_isDebugConstant(conditionExpression)) {
+ ValidResult result = _getConstantBooleanValue(conditionExpression);
if (result != null) {
if (result.isTrue) {
// report error on else block: true ? 1 : !2!
_errorReporter.reportErrorForNode(HintCode.DEAD_CODE, node.elseExpression, []);
- safelyVisit(node.thenExpression);
+ _safelyVisit(node.thenExpression);
return null;
} else {
// report error on if block: false ? !1! : 2
_errorReporter.reportErrorForNode(HintCode.DEAD_CODE, node.thenExpression, []);
- safelyVisit(node.elseExpression);
+ _safelyVisit(node.elseExpression);
return null;
}
}
@@ -2816,22 +2816,22 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
Object visitIfStatement(IfStatement node) {
Expression conditionExpression = node.condition;
- safelyVisit(conditionExpression);
- if (!isDebugConstant(conditionExpression)) {
- ValidResult result = getConstantBooleanValue(conditionExpression);
+ _safelyVisit(conditionExpression);
+ if (!_isDebugConstant(conditionExpression)) {
+ ValidResult result = _getConstantBooleanValue(conditionExpression);
if (result != null) {
if (result.isTrue) {
// report error on else block: if(true) {} else {!}
Statement elseStatement = node.elseStatement;
if (elseStatement != null) {
_errorReporter.reportErrorForNode(HintCode.DEAD_CODE, elseStatement, []);
- safelyVisit(node.thenStatement);
+ _safelyVisit(node.thenStatement);
return null;
}
} else {
// report error on if block: if (false) {!} else {}
_errorReporter.reportErrorForNode(HintCode.DEAD_CODE, node.thenStatement, []);
- safelyVisit(node.elseStatement);
+ _safelyVisit(node.elseStatement);
return null;
}
}
@@ -2840,8 +2840,8 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
}
Object visitTryStatement(TryStatement node) {
- safelyVisit(node.body);
- safelyVisit(node.finallyBlock);
+ _safelyVisit(node.body);
+ _safelyVisit(node.finallyBlock);
NodeList<CatchClause> catchClauses = node.catchClauses;
int numOfCatchClauses = catchClauses.length;
List<Type2> visitedTypes = new List<Type2>();
@@ -2857,7 +2857,7 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
// Found catch clause clause that has Object as an exception type, this is equivalent to
// having a catch clause that doesn't have an exception type, visit the block, but
// generate an error on any following catch clauses (and don't visit them).
- safelyVisit(catchClause);
+ _safelyVisit(catchClause);
if (i + 1 != numOfCatchClauses) {
// this catch clause is not the last in the try statement
CatchClause nextCatchClause = catchClauses[i + 1];
@@ -2879,11 +2879,11 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
}
visitedTypes.add(currentType);
}
- safelyVisit(catchClause);
+ _safelyVisit(catchClause);
} else {
// Found catch clause clause that doesn't have an exception type, visit the block, but
// generate an error on any following catch clauses (and don't visit them).
- safelyVisit(catchClause);
+ _safelyVisit(catchClause);
if (i + 1 != numOfCatchClauses) {
// this catch clause is not the last in the try statement
CatchClause nextCatchClause = catchClauses[i + 1];
@@ -2900,9 +2900,9 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
Object visitWhileStatement(WhileStatement node) {
Expression conditionExpression = node.condition;
- safelyVisit(conditionExpression);
- if (!isDebugConstant(conditionExpression)) {
- ValidResult result = getConstantBooleanValue(conditionExpression);
+ _safelyVisit(conditionExpression);
+ if (!_isDebugConstant(conditionExpression)) {
+ ValidResult result = _getConstantBooleanValue(conditionExpression);
if (result != null) {
if (result.isFalse) {
// report error on if block: while (false) {!}
@@ -2911,7 +2911,7 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
}
}
}
- safelyVisit(node.body);
+ _safelyVisit(node.body);
return null;
}
@@ -2925,7 +2925,7 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
* if it is `false`, or `null` if the expression is not a constant boolean
* value
*/
- ValidResult getConstantBooleanValue(Expression expression) {
+ ValidResult _getConstantBooleanValue(Expression expression) {
if (expression is BooleanLiteral) {
if (expression.value) {
return new ValidResult(new DartObjectImpl(null, BoolState.from(true)));
@@ -2962,7 +2962,7 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
* @param expression some conditional expression
* @return `true` if and only if the passed expression is resolved to a constant variable
*/
- bool isDebugConstant(Expression expression) {
+ bool _isDebugConstant(Expression expression) {
Element element = null;
if (expression is Identifier) {
Identifier identifier = expression;
@@ -2984,7 +2984,7 @@ class DeadCodeVerifier extends RecursiveAstVisitor<Object> {
*
* @param node the node to be visited
*/
- void safelyVisit(AstNode node) {
+ void _safelyVisit(AstNode node) {
if (node != null) {
node.accept(this);
}
@@ -3003,7 +3003,7 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
*/
bool _enclosingBlockContainsBreak = false;
- bool visitArgumentList(ArgumentList node) => visitExpressions(node.arguments);
+ bool visitArgumentList(ArgumentList node) => _visitExpressions(node.arguments);
bool visitAsExpression(AsExpression node) => node.expression.accept(this);
@@ -3039,7 +3039,7 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
return lhsExpression.accept(this) || node.rightOperand.accept(this);
}
- bool visitBlock(Block node) => visitStatements(node.statements);
+ bool visitBlock(Block node) => _visitStatements(node.statements);
bool visitBlockFunctionBody(BlockFunctionBody node) => node.block.accept(this);
@@ -3053,7 +3053,7 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
if (target.accept(this)) {
return true;
}
- return visitExpressions(node.cascadeSections);
+ return _visitExpressions(node.cascadeSections);
}
bool visitConditionalExpression(ConditionalExpression node) {
@@ -3115,7 +3115,7 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
bool outerBreakValue = _enclosingBlockContainsBreak;
_enclosingBlockContainsBreak = false;
try {
- if (node.variables != null && visitVariableDeclarations(node.variables.variables)) {
+ if (node.variables != null && _visitVariableDeclarations(node.variables.variables)) {
return true;
}
if (node.initialization != null && node.initialization.accept(this)) {
@@ -3125,7 +3125,7 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
if (conditionExpression != null && conditionExpression.accept(this)) {
return true;
}
- if (visitExpressions(node.updaters)) {
+ if (_visitExpressions(node.updaters)) {
return true;
}
// TODO(jwren) Do we want to take all constant expressions into account?
@@ -3232,9 +3232,9 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
bool visitSuperExpression(SuperExpression node) => false;
- bool visitSwitchCase(SwitchCase node) => visitStatements(node.statements);
+ bool visitSwitchCase(SwitchCase node) => _visitStatements(node.statements);
- bool visitSwitchDefault(SwitchDefault node) => visitStatements(node.statements);
+ bool visitSwitchDefault(SwitchDefault node) => _visitStatements(node.statements);
bool visitSwitchStatement(SwitchStatement node) {
bool outerBreakValue = _enclosingBlockContainsBreak;
@@ -3289,7 +3289,7 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
return false;
}
- bool visitVariableDeclarationList(VariableDeclarationList node) => visitVariableDeclarations(node.variables);
+ bool visitVariableDeclarationList(VariableDeclarationList node) => _visitVariableDeclarations(node.variables);
bool visitVariableDeclarationStatement(VariableDeclarationStatement node) {
NodeList<VariableDeclaration> variables = node.variables.variables;
@@ -3325,7 +3325,7 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
}
}
- bool visitExpressions(NodeList<Expression> expressions) {
+ bool _visitExpressions(NodeList<Expression> expressions) {
for (int i = expressions.length - 1; i >= 0; i--) {
if (expressions[i].accept(this)) {
return true;
@@ -3334,7 +3334,7 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
return false;
}
- bool visitStatements(NodeList<Statement> statements) {
+ bool _visitStatements(NodeList<Statement> statements) {
for (int i = statements.length - 1; i >= 0; i--) {
if (statements[i].accept(this)) {
return true;
@@ -3343,7 +3343,7 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
return false;
}
- bool visitVariableDeclarations(NodeList<VariableDeclaration> variableDeclarations) {
+ bool _visitVariableDeclarations(NodeList<VariableDeclaration> variableDeclarations) {
for (int i = variableDeclarations.length - 1; i >= 0; i--) {
if (variableDeclarations[i].accept(this)) {
return true;
@@ -3393,10 +3393,10 @@ class HintGenerator {
if (element != null) {
if (i == 0) {
_importsVerifier.inDefiningCompilationUnit = true;
- generateForCompilationUnit(_compilationUnits[i], element.source);
+ _generateForCompilationUnit(_compilationUnits[i], element.source);
_importsVerifier.inDefiningCompilationUnit = false;
} else {
- generateForCompilationUnit(_compilationUnits[i], element.source);
+ _generateForCompilationUnit(_compilationUnits[i], element.source);
}
}
}
@@ -3408,7 +3408,7 @@ class HintGenerator {
}
}
- void generateForCompilationUnit(CompilationUnit unit, Source source) {
+ void _generateForCompilationUnit(CompilationUnit unit, Source source) {
ErrorReporter errorReporter = new ErrorReporter(_errorListener, source);
unit.accept(_importsVerifier);
// dead code analysis
@@ -3567,12 +3567,12 @@ class ImportsVerifier extends RecursiveAstVisitor<Object> {
//
// Initialize libraryMap: libraryElement -> importDirective
//
- putIntoLibraryMap(libraryElement, importDirective);
+ _putIntoLibraryMap(libraryElement, importDirective);
//
// For this new addition to the libraryMap, also recursively add any exports from the
// libraryElement
//
- addAdditionalLibrariesForExports(libraryElement, importDirective, new List<LibraryElement>());
+ _addAdditionalLibrariesForExports(libraryElement, importDirective, new List<LibraryElement>());
}
}
}
@@ -3605,17 +3605,17 @@ class ImportsVerifier extends RecursiveAstVisitor<Object> {
}
Object visitExportDirective(ExportDirective node) {
- visitMetadata(node.metadata);
+ _visitMetadata(node.metadata);
return null;
}
Object visitImportDirective(ImportDirective node) {
- visitMetadata(node.metadata);
+ _visitMetadata(node.metadata);
return null;
}
Object visitLibraryDirective(LibraryDirective node) {
- visitMetadata(node.metadata);
+ _visitMetadata(node.metadata);
return null;
}
@@ -3633,14 +3633,14 @@ class ImportsVerifier extends RecursiveAstVisitor<Object> {
return null;
}
// Otherwise, pass the prefixed identifier element and name onto visitIdentifier.
- return visitIdentifier(element, prefixIdentifier.name);
+ return _visitIdentifier(element, prefixIdentifier.name);
}
Object visitSimpleIdentifier(SimpleIdentifier node) {
if (_unusedImports.isEmpty) {
return null;
}
- return visitIdentifier(node.staticElement, node.name);
+ return _visitIdentifier(node.staticElement, node.name);
}
void set inDefiningCompilationUnit(bool inDefiningCompilationUnit) {
@@ -3650,14 +3650,14 @@ class ImportsVerifier extends RecursiveAstVisitor<Object> {
/**
* Recursively add any exported library elements into the [libraryMap].
*/
- void addAdditionalLibrariesForExports(LibraryElement library, ImportDirective importDirective, List<LibraryElement> exportPath) {
+ void _addAdditionalLibrariesForExports(LibraryElement library, ImportDirective importDirective, List<LibraryElement> exportPath) {
if (exportPath.contains(library)) {
return;
}
exportPath.add(library);
for (LibraryElement exportedLibraryElt in library.exportedLibraries) {
- putIntoLibraryMap(exportedLibraryElt, importDirective);
- addAdditionalLibrariesForExports(exportedLibraryElt, importDirective, exportPath);
+ _putIntoLibraryMap(exportedLibraryElt, importDirective);
+ _addAdditionalLibrariesForExports(exportedLibraryElt, importDirective, exportPath);
}
}
@@ -3669,7 +3669,7 @@ class ImportsVerifier extends RecursiveAstVisitor<Object> {
* @param importDirective the import directive used to compute the returned namespace
* @return the computed or looked up [Namespace]
*/
- Namespace computeNamespace(ImportDirective importDirective) {
+ Namespace _computeNamespace(ImportDirective importDirective) {
Namespace namespace = _namespaceMap[importDirective];
if (namespace == null) {
// If the namespace isn't in the namespaceMap, then compute and put it in the map
@@ -3689,7 +3689,7 @@ class ImportsVerifier extends RecursiveAstVisitor<Object> {
* used to simply add the mapping between the library element an an import directive without
* needing to check to see if a list needs to be created.
*/
- void putIntoLibraryMap(LibraryElement libraryElement, ImportDirective importDirective) {
+ void _putIntoLibraryMap(LibraryElement libraryElement, ImportDirective importDirective) {
List<ImportDirective> importList = _libraryMap[libraryElement];
if (importList == null) {
importList = new List<ImportDirective>();
@@ -3698,7 +3698,7 @@ class ImportsVerifier extends RecursiveAstVisitor<Object> {
importList.add(importDirective);
}
- Object visitIdentifier(Element element, String name) {
+ Object _visitIdentifier(Element element, String name) {
if (element == null) {
return null;
}
@@ -3706,7 +3706,7 @@ class ImportsVerifier extends RecursiveAstVisitor<Object> {
if (element is MultiplyDefinedElement) {
MultiplyDefinedElement multiplyDefinedElement = element;
for (Element elt in multiplyDefinedElement.conflictingElements) {
- visitIdentifier(elt, name);
+ _visitIdentifier(elt, name);
}
return null;
} else if (element is PrefixElement) {
@@ -3739,7 +3739,7 @@ class ImportsVerifier extends RecursiveAstVisitor<Object> {
// Otherwise, for each of the imported directives, use the namespaceMap to
for (ImportDirective importDirective in importsFromSameLibrary) {
// Get the namespace for this import
- Namespace namespace = computeNamespace(importDirective);
+ Namespace namespace = _computeNamespace(importDirective);
if (namespace != null && namespace.get(name) != null) {
_unusedImports.remove(importDirective);
}
@@ -3755,10 +3755,10 @@ class ImportsVerifier extends RecursiveAstVisitor<Object> {
*
* @param annotations the list of annotations to visit
*/
- void visitMetadata(NodeList<Annotation> annotations) {
+ void _visitMetadata(NodeList<Annotation> annotations) {
for (Annotation annotation in annotations) {
Identifier name = annotation.name;
- visitIdentifier(name.staticElement, name.name);
+ _visitIdentifier(name.staticElement, name.name);
}
}
}
@@ -3791,8 +3791,8 @@ class OverrideVerifier extends RecursiveAstVisitor<Object> {
Object visitMethodDeclaration(MethodDeclaration node) {
ExecutableElement element = node.element;
- if (isOverride(element)) {
- if (getOverriddenMember(element) == null) {
+ if (_isOverride(element)) {
+ if (_getOverriddenMember(element) == null) {
if (element is MethodElement) {
_errorReporter.reportErrorForNode(HintCode.OVERRIDE_ON_NON_OVERRIDING_METHOD, node.name, []);
} else if (element is PropertyAccessorElement) {
@@ -3813,7 +3813,7 @@ class OverrideVerifier extends RecursiveAstVisitor<Object> {
* @param member the member that overrides the returned member
* @return the member that overrides the given member
*/
- ExecutableElement getOverriddenMember(ExecutableElement member) {
+ ExecutableElement _getOverriddenMember(ExecutableElement member) {
LibraryElement library = member.library;
if (library == null) {
return null;
@@ -3831,7 +3831,7 @@ class OverrideVerifier extends RecursiveAstVisitor<Object> {
* @param element the element being tested
* @return `true` if the element has an override annotation associated with it
*/
- bool isOverride(Element element) => element != null && element.isOverride;
+ bool _isOverride(Element element) => element != null && element.isOverride;
}
/**
@@ -3870,9 +3870,9 @@ class PubVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see PubSuggestionCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE
*/
- bool checkForFileImportInsideLibReferencesFileOutside(StringLiteral uriLiteral, String path) {
- Source source = getSource(uriLiteral);
- String fullName = getSourceFullName(source);
+ bool _checkForFileImportInsideLibReferencesFileOutside(StringLiteral uriLiteral, String path) {
+ Source source = _getSource(uriLiteral);
+ String fullName = _getSourceFullName(source);
if (fullName != null) {
int pathIndex = 0;
int fullNameIndex = fullName.length;
@@ -3907,15 +3907,15 @@ class PubVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see PubSuggestionCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE
*/
- bool checkForFileImportOutsideLibReferencesFileInside(StringLiteral uriLiteral, String path) {
+ bool _checkForFileImportOutsideLibReferencesFileInside(StringLiteral uriLiteral, String path) {
if (StringUtilities.startsWith4(path, 0, 0x6C, 0x69, 0x62, 0x2F)) {
- if (checkForFileImportOutsideLibReferencesFileInsideAtIndex(uriLiteral, path, 0)) {
+ if (_checkForFileImportOutsideLibReferencesFileInsideAtIndex(uriLiteral, path, 0)) {
return true;
}
}
int pathIndex = StringUtilities.indexOf5(path, 0, 0x2F, 0x6C, 0x69, 0x62, 0x2F);
while (pathIndex != -1) {
- if (checkForFileImportOutsideLibReferencesFileInsideAtIndex(uriLiteral, path, pathIndex + 1)) {
+ if (_checkForFileImportOutsideLibReferencesFileInsideAtIndex(uriLiteral, path, pathIndex + 1)) {
return true;
}
pathIndex = StringUtilities.indexOf5(path, pathIndex + 4, 0x2F, 0x6C, 0x69, 0x62, 0x2F);
@@ -3923,14 +3923,14 @@ class PubVerifier extends RecursiveAstVisitor<Object> {
return false;
}
- bool checkForFileImportOutsideLibReferencesFileInsideAtIndex(StringLiteral uriLiteral, String path, int pathIndex) {
- Source source = getSource(uriLiteral);
+ bool _checkForFileImportOutsideLibReferencesFileInsideAtIndex(StringLiteral uriLiteral, String path, int pathIndex) {
+ Source source = _getSource(uriLiteral);
String relativePubspecPath = path.substring(0, pathIndex) + _PUBSPEC_YAML;
Source pubspecSource = _context.sourceFactory.resolveUri(source, relativePubspecPath);
if (!_context.exists(pubspecSource)) {
return false;
}
- String fullName = getSourceFullName(source);
+ String fullName = _getSourceFullName(source);
if (fullName != null) {
if (StringUtilities.indexOf5(fullName, 0, 0x2F, 0x6C, 0x69, 0x62, 0x2F) < 0) {
// Files outside the lib directory hierarchy should not reference files inside
@@ -3950,7 +3950,7 @@ class PubVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT
*/
- bool checkForPackageImportContainsDotDot(StringLiteral uriLiteral, String path) {
+ bool _checkForPackageImportContainsDotDot(StringLiteral uriLiteral, String path) {
if (StringUtilities.startsWith3(path, 0, 0x2E, 0x2E, 0x2F) || StringUtilities.indexOf4(path, 0, 0x2F, 0x2E, 0x2E, 0x2F) >= 0) {
// Package import should not to contain ".."
_errorReporter.reportErrorForNode(PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT, uriLiteral, []);
@@ -3965,7 +3965,7 @@ class PubVerifier extends RecursiveAstVisitor<Object> {
* @param node the node (not `null`)
* @return the source or `null` if it could not be determined
*/
- Source getSource(AstNode node) {
+ Source _getSource(AstNode node) {
Source source = null;
CompilationUnit unit = node.getAncestor((node) => node is CompilationUnit);
if (unit != null) {
@@ -3984,7 +3984,7 @@ class PubVerifier extends RecursiveAstVisitor<Object> {
* @param source the source
* @return the full name or `null` if it could not be determined
*/
- String getSourceFullName(Source source) {
+ String _getSourceFullName(Source source) {
if (source != null) {
String fullName = source.fullName;
if (fullName != null) {
@@ -4020,7 +4020,7 @@ class ToDoFinder {
* @param unit the compilation unit containing the to-do comments
*/
void findIn(CompilationUnit unit) {
- gatherTodoComments(unit.beginToken);
+ _gatherTodoComments(unit.beginToken);
}
/**
@@ -4029,12 +4029,12 @@ class ToDoFinder {
*
* @param token the head of the list of tokens being searched
*/
- void gatherTodoComments(sc.Token token) {
+ void _gatherTodoComments(sc.Token token) {
while (token != null && token.type != sc.TokenType.EOF) {
sc.Token commentToken = token.precedingComments;
while (commentToken != null) {
if (identical(commentToken.type, sc.TokenType.SINGLE_LINE_COMMENT) || identical(commentToken.type, sc.TokenType.MULTI_LINE_COMMENT)) {
- scrapeTodoComment(commentToken);
+ _scrapeTodoComment(commentToken);
}
commentToken = commentToken.next;
}
@@ -4047,7 +4047,7 @@ class ToDoFinder {
*
* @param commentToken the comment token to analyze
*/
- void scrapeTodoComment(sc.Token commentToken) {
+ void _scrapeTodoComment(sc.Token commentToken) {
JavaPatternMatcher matcher = new JavaPatternMatcher(TodoCode.TODO_REGEX, commentToken.lexeme);
if (matcher.find()) {
int offset = commentToken.offset + matcher.start() + matcher.group(1).length;
@@ -4114,8 +4114,8 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
* element model
*/
bool matches(AstNode node, Element element) {
- captureEnclosingElements(element);
- gatherElements(element);
+ _captureEnclosingElements(element);
+ _gatherElements(element);
try {
node.accept(this);
} on DeclarationMatcher_DeclarationMismatchException catch (exception) {
@@ -4128,11 +4128,11 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
SimpleIdentifier exceptionParameter = node.exceptionParameter;
if (exceptionParameter != null) {
List<LocalVariableElement> localVariables = _enclosingExecutable.localVariables;
- LocalVariableElement exceptionElement = findIdentifier(localVariables, exceptionParameter);
+ LocalVariableElement exceptionElement = _findIdentifier(localVariables, exceptionParameter);
processElement(exceptionElement);
SimpleIdentifier stackTraceParameter = node.stackTraceParameter;
if (stackTraceParameter != null) {
- LocalVariableElement stackTraceElement = findIdentifier(localVariables, stackTraceParameter);
+ LocalVariableElement stackTraceElement = _findIdentifier(localVariables, stackTraceParameter);
processElement(stackTraceElement);
}
}
@@ -4143,9 +4143,9 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
ClassElement outerClass = _enclosingClass;
try {
SimpleIdentifier className = node.name;
- _enclosingClass = findIdentifier(_enclosingUnit.types, className);
+ _enclosingClass = _findIdentifier(_enclosingUnit.types, className);
processElement(_enclosingClass);
- if (!hasConstructor(node)) {
+ if (!_hasConstructor(node)) {
ConstructorElement constructor = _enclosingClass.unnamedConstructor;
if (constructor.isSynthetic) {
processElement(constructor);
@@ -4161,7 +4161,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
ClassElement outerClass = _enclosingClass;
try {
SimpleIdentifier className = node.name;
- _enclosingClass = findIdentifier(_enclosingUnit.types, className);
+ _enclosingClass = _findIdentifier(_enclosingUnit.types, className);
processElement(_enclosingClass);
return super.visitClassTypeAlias(node);
} finally {
@@ -4192,14 +4192,14 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
Object visitDeclaredIdentifier(DeclaredIdentifier node) {
SimpleIdentifier variableName = node.identifier;
- LocalVariableElement element = findIdentifier(_enclosingExecutable.localVariables, variableName);
+ LocalVariableElement element = _findIdentifier(_enclosingExecutable.localVariables, variableName);
processElement(element);
return super.visitDeclaredIdentifier(node);
}
Object visitDefaultFormalParameter(DefaultFormalParameter node) {
SimpleIdentifier parameterName = node.parameter.identifier;
- ParameterElement element = getElementForParameter(node, parameterName);
+ ParameterElement element = _getElementForParameter(node, parameterName);
Expression defaultValue = node.defaultValue;
if (defaultValue != null) {
ExecutableElement outerExecutable = _enclosingExecutable;
@@ -4225,10 +4225,10 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
}
Object visitExportDirective(ExportDirective node) {
- String uri = getStringValue(node.uri);
+ String uri = _getStringValue(node.uri);
if (uri != null) {
LibraryElement library = _enclosingUnit.library;
- ExportElement exportElement = findExport(library.exports, _enclosingUnit.context.sourceFactory.resolveUri(_enclosingUnit.source, uri));
+ ExportElement exportElement = _findExport(library.exports, _enclosingUnit.context.sourceFactory.resolveUri(_enclosingUnit.source, uri));
processElement(exportElement);
}
return super.visitExportDirective(node);
@@ -4237,7 +4237,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
Object visitFieldFormalParameter(FieldFormalParameter node) {
if (node.parent is! DefaultFormalParameter) {
SimpleIdentifier parameterName = node.identifier;
- ParameterElement element = getElementForParameter(node, parameterName);
+ ParameterElement element = _getElementForParameter(node, parameterName);
ParameterElement outerParameter = _enclosingParameter;
try {
_enclosingParameter = element;
@@ -4258,12 +4258,12 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
sc.Token property = node.propertyKeyword;
if (property == null) {
if (_enclosingExecutable != null) {
- _enclosingExecutable = findIdentifier(_enclosingExecutable.functions, functionName);
+ _enclosingExecutable = _findIdentifier(_enclosingExecutable.functions, functionName);
} else {
- _enclosingExecutable = findIdentifier(_enclosingUnit.functions, functionName);
+ _enclosingExecutable = _findIdentifier(_enclosingUnit.functions, functionName);
}
} else {
- PropertyAccessorElement accessor = findIdentifier(_enclosingUnit.accessors, functionName);
+ PropertyAccessorElement accessor = _findIdentifier(_enclosingUnit.accessors, functionName);
if (identical((property as sc.KeywordToken).keyword, sc.Keyword.SET)) {
accessor = accessor.variable.setter;
}
@@ -4278,7 +4278,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
Object visitFunctionExpression(FunctionExpression node) {
if (node.parent is! FunctionDeclaration) {
- FunctionElement element = findAtOffset(_enclosingExecutable.functions, node.beginToken.offset);
+ FunctionElement element = _findAtOffset(_enclosingExecutable.functions, node.beginToken.offset);
processElement(element);
}
ExecutableElement outerExecutable = _enclosingExecutable;
@@ -4295,7 +4295,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
FunctionTypeAliasElement outerAlias = _enclosingAlias;
try {
SimpleIdentifier aliasName = node.name;
- _enclosingAlias = findIdentifier(_enclosingUnit.functionTypeAliases, aliasName);
+ _enclosingAlias = _findIdentifier(_enclosingUnit.functionTypeAliases, aliasName);
processElement(_enclosingAlias);
return super.visitFunctionTypeAlias(node);
} finally {
@@ -4306,7 +4306,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
if (node.parent is! DefaultFormalParameter) {
SimpleIdentifier parameterName = node.identifier;
- ParameterElement element = getElementForParameter(node, parameterName);
+ ParameterElement element = _getElementForParameter(node, parameterName);
ParameterElement outerParameter = _enclosingParameter;
try {
_enclosingParameter = element;
@@ -4321,10 +4321,10 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
}
Object visitImportDirective(ImportDirective node) {
- String uri = getStringValue(node.uri);
+ String uri = _getStringValue(node.uri);
if (uri != null) {
LibraryElement library = _enclosingUnit.library;
- ImportElement importElement = findImport(library.imports, _enclosingUnit.context.sourceFactory.resolveUri(_enclosingUnit.source, uri), node.prefix);
+ ImportElement importElement = _findImport(library.imports, _enclosingUnit.context.sourceFactory.resolveUri(_enclosingUnit.source, uri), node.prefix);
processElement(importElement);
}
return super.visitImportDirective(node);
@@ -4333,7 +4333,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
Object visitLabeledStatement(LabeledStatement node) {
for (Label label in node.labels) {
SimpleIdentifier labelName = label.label;
- LabelElement element = findIdentifier(_enclosingExecutable.labels, labelName);
+ LabelElement element = _findIdentifier(_enclosingExecutable.labels, labelName);
processElement(element);
}
return super.visitLabeledStatement(node);
@@ -4349,10 +4349,10 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
nameOfMethod = "unary-";
}
if (property == null) {
- _enclosingExecutable = findWithNameAndOffset(_enclosingClass.methods, nameOfMethod, methodName.offset);
+ _enclosingExecutable = _findWithNameAndOffset(_enclosingClass.methods, nameOfMethod, methodName.offset);
methodName.staticElement = _enclosingExecutable;
} else {
- PropertyAccessorElement accessor = findIdentifier(_enclosingClass.accessors, methodName);
+ PropertyAccessorElement accessor = _findIdentifier(_enclosingClass.accessors, methodName);
if (identical((property as sc.KeywordToken).keyword, sc.Keyword.SET)) {
accessor = accessor.variable.setter;
methodName.staticElement = accessor;
@@ -4367,10 +4367,10 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
}
Object visitPartDirective(PartDirective node) {
- String uri = getStringValue(node.uri);
+ String uri = _getStringValue(node.uri);
if (uri != null) {
Source partSource = _enclosingUnit.context.sourceFactory.resolveUri(_enclosingUnit.source, uri);
- CompilationUnitElement element = findPart(_enclosingUnit.library.parts, partSource);
+ CompilationUnitElement element = _findPart(_enclosingUnit.library.parts, partSource);
processElement(element);
}
return super.visitPartDirective(node);
@@ -4379,7 +4379,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
Object visitSimpleFormalParameter(SimpleFormalParameter node) {
if (node.parent is! DefaultFormalParameter) {
SimpleIdentifier parameterName = node.identifier;
- ParameterElement element = getElementForParameter(node, parameterName);
+ ParameterElement element = _getElementForParameter(node, parameterName);
ParameterElement outerParameter = _enclosingParameter;
try {
_enclosingParameter = element;
@@ -4396,7 +4396,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
Object visitSwitchCase(SwitchCase node) {
for (Label label in node.labels) {
SimpleIdentifier labelName = label.label;
- LabelElement element = findIdentifier(_enclosingExecutable.labels, labelName);
+ LabelElement element = _findIdentifier(_enclosingExecutable.labels, labelName);
processElement(element);
}
return super.visitSwitchCase(node);
@@ -4405,7 +4405,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
Object visitSwitchDefault(SwitchDefault node) {
for (Label label in node.labels) {
SimpleIdentifier labelName = label.label;
- LabelElement element = findIdentifier(_enclosingExecutable.labels, labelName);
+ LabelElement element = _findIdentifier(_enclosingExecutable.labels, labelName);
processElement(element);
}
return super.visitSwitchDefault(node);
@@ -4415,9 +4415,9 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
SimpleIdentifier parameterName = node.name;
TypeParameterElement element = null;
if (_enclosingClass != null) {
- element = findIdentifier(_enclosingClass.typeParameters, parameterName);
+ element = _findIdentifier(_enclosingClass.typeParameters, parameterName);
} else if (_enclosingAlias != null) {
- element = findIdentifier(_enclosingAlias.typeParameters, parameterName);
+ element = _findIdentifier(_enclosingAlias.typeParameters, parameterName);
}
processElement(element);
return super.visitTypeParameter(node);
@@ -4427,13 +4427,13 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
VariableElement element = null;
SimpleIdentifier variableName = node.name;
if (_enclosingExecutable != null) {
- element = findIdentifier(_enclosingExecutable.localVariables, variableName);
+ element = _findIdentifier(_enclosingExecutable.localVariables, variableName);
}
if (element == null && _enclosingClass != null) {
- element = findIdentifier(_enclosingClass.fields, variableName);
+ element = _findIdentifier(_enclosingClass.fields, variableName);
}
if (element == null && _enclosingUnit != null) {
- element = findIdentifier(_enclosingUnit.topLevelVariables, variableName);
+ element = _findIdentifier(_enclosingUnit.topLevelVariables, variableName);
}
Expression initializer = node.initializer;
if (initializer != null) {
@@ -4469,7 +4469,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
*
* @param element the element corresponding to the AST structure to be compared
*/
- void captureEnclosingElements(Element element) {
+ void _captureEnclosingElements(Element element) {
Element parent = element is CompilationUnitElement ? element : element.enclosingElement;
while (parent != null) {
if (parent is CompilationUnitElement) {
@@ -4503,7 +4503,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
* @param offset the offset of the name of the element to be returned
* @return the element at the given offset
*/
- Element findAtOffset(List<Element> elements, int offset) => findWithNameAndOffset(elements, "", offset);
+ Element _findAtOffset(List<Element> elements, int offset) => _findWithNameAndOffset(elements, "", offset);
/**
* Return the export element from the given array whose library has the given source, or
@@ -4514,7 +4514,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
* for
* @return the export element whose library has the given source
*/
- ExportElement findExport(List<ExportElement> exports, Source source) {
+ ExportElement _findExport(List<ExportElement> exports, Source source) {
for (ExportElement export in exports) {
if (export.exportedLibrary.source == source) {
return export;
@@ -4531,7 +4531,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
* @param identifier the name node in the declaration of the element to be returned
* @return the element created for the declaration with the given name
*/
- Element findIdentifier(List<Element> elements, SimpleIdentifier identifier) => findWithNameAndOffset(elements, identifier.name, identifier.offset);
+ Element _findIdentifier(List<Element> elements, SimpleIdentifier identifier) => _findWithNameAndOffset(elements, identifier.name, identifier.offset);
/**
* Return the import element from the given array whose library has the given source and that has
@@ -4543,7 +4543,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
* @param prefix the prefix with which the library was imported
* @return the import element whose library has the given source and prefix
*/
- ImportElement findImport(List<ImportElement> imports, Source source, SimpleIdentifier prefix) {
+ ImportElement _findImport(List<ImportElement> imports, Source source, SimpleIdentifier prefix) {
for (ImportElement element in imports) {
if (element.importedLibrary.source == source) {
PrefixElement prefixElement = element.prefix;
@@ -4569,7 +4569,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
* @param partSource the source for the part whose element is to be returned
* @return the element for the part with the given source
*/
- CompilationUnitElement findPart(List<CompilationUnitElement> parts, Source partSource) {
+ CompilationUnitElement _findPart(List<CompilationUnitElement> parts, Source partSource) {
for (CompilationUnitElement part in parts) {
if (part.source == partSource) {
return part;
@@ -4587,7 +4587,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
* @param offset the offset of the name of the element to be returned
* @return the element with the given name and offset
*/
- Element findWithNameAndOffset(List<Element> elements, String name, int offset) {
+ Element _findWithNameAndOffset(List<Element> elements, String name, int offset) {
for (Element element in elements) {
if (element.displayName == name && element.nameOffset == offset) {
return element;
@@ -4596,7 +4596,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
return null;
}
- void gatherElements(Element element) {
+ void _gatherElements(Element element) {
element.accept(new GeneralizingElementVisitor_DeclarationMatcher_gatherElements(this));
}
@@ -4607,7 +4607,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
* @param parameterName the name of the parameter being searched for
* @return the element representing the parameter with that name
*/
- ParameterElement getElementForParameter(FormalParameter node, SimpleIdentifier parameterName) {
+ ParameterElement _getElementForParameter(FormalParameter node, SimpleIdentifier parameterName) {
List<ParameterElement> parameters = null;
if (_enclosingParameter != null) {
parameters = _enclosingParameter.parameters;
@@ -4618,7 +4618,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
if (parameters == null && _enclosingAlias != null) {
parameters = _enclosingAlias.parameters;
}
- return parameters == null ? null : findIdentifier(parameters, parameterName);
+ return parameters == null ? null : _findIdentifier(parameters, parameterName);
}
/**
@@ -4628,7 +4628,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
* @param literal the string literal whose value is to be returned
* @return the value of the given string literal
*/
- String getStringValue(StringLiteral literal) {
+ String _getStringValue(StringLiteral literal) {
if (literal is StringInterpolation) {
return null;
}
@@ -4641,7 +4641,7 @@ class DeclarationMatcher extends RecursiveAstVisitor<Object> {
* @param node the class being tested
* @return `true` if the class defines at least one constructor
*/
- bool hasConstructor(ClassDeclaration node) {
+ bool _hasConstructor(ClassDeclaration node) {
for (ClassMember member in node.members) {
if (member is ConstructorDeclaration) {
return true;
@@ -4722,10 +4722,10 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
SimpleIdentifier exceptionParameter = node.exceptionParameter;
if (exceptionParameter != null) {
List<LocalVariableElement> localVariables = _enclosingExecutable.localVariables;
- findIdentifier(localVariables, exceptionParameter);
+ _findIdentifier(localVariables, exceptionParameter);
SimpleIdentifier stackTraceParameter = node.stackTraceParameter;
if (stackTraceParameter != null) {
- findIdentifier(localVariables, stackTraceParameter);
+ _findIdentifier(localVariables, stackTraceParameter);
}
}
return super.visitCatchClause(node);
@@ -4735,7 +4735,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
ClassElement outerClass = _enclosingClass;
try {
SimpleIdentifier className = node.name;
- _enclosingClass = findIdentifier(_enclosingUnit.types, className);
+ _enclosingClass = _findIdentifier(_enclosingUnit.types, className);
return super.visitClassDeclaration(node);
} finally {
_enclosingClass = outerClass;
@@ -4746,7 +4746,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
ClassElement outerClass = _enclosingClass;
try {
SimpleIdentifier className = node.name;
- _enclosingClass = findIdentifier(_enclosingUnit.types, className);
+ _enclosingClass = _findIdentifier(_enclosingUnit.types, className);
return super.visitClassTypeAlias(node);
} finally {
_enclosingClass = outerClass;
@@ -4772,13 +4772,13 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
Object visitDeclaredIdentifier(DeclaredIdentifier node) {
SimpleIdentifier variableName = node.identifier;
- findIdentifier(_enclosingExecutable.localVariables, variableName);
+ _findIdentifier(_enclosingExecutable.localVariables, variableName);
return super.visitDeclaredIdentifier(node);
}
Object visitDefaultFormalParameter(DefaultFormalParameter node) {
SimpleIdentifier parameterName = node.parameter.identifier;
- ParameterElement element = getElementForParameter(node, parameterName);
+ ParameterElement element = _getElementForParameter(node, parameterName);
Expression defaultValue = node.defaultValue;
if (defaultValue != null) {
ExecutableElement outerExecutable = _enclosingExecutable;
@@ -4802,10 +4802,10 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
}
Object visitExportDirective(ExportDirective node) {
- String uri = getStringValue(node.uri);
+ String uri = _getStringValue(node.uri);
if (uri != null) {
LibraryElement library = _enclosingUnit.library;
- ExportElement exportElement = findExport(library.exports, _enclosingUnit.context.sourceFactory.resolveUri(_enclosingUnit.source, uri));
+ ExportElement exportElement = _findExport(library.exports, _enclosingUnit.context.sourceFactory.resolveUri(_enclosingUnit.source, uri));
node.element = exportElement;
}
return super.visitExportDirective(node);
@@ -4814,7 +4814,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
Object visitFieldFormalParameter(FieldFormalParameter node) {
if (node.parent is! DefaultFormalParameter) {
SimpleIdentifier parameterName = node.identifier;
- ParameterElement element = getElementForParameter(node, parameterName);
+ ParameterElement element = _getElementForParameter(node, parameterName);
ParameterElement outerParameter = _enclosingParameter;
try {
_enclosingParameter = element;
@@ -4834,12 +4834,12 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
sc.Token property = node.propertyKeyword;
if (property == null) {
if (_enclosingExecutable != null) {
- _enclosingExecutable = findIdentifier(_enclosingExecutable.functions, functionName);
+ _enclosingExecutable = _findIdentifier(_enclosingExecutable.functions, functionName);
} else {
- _enclosingExecutable = findIdentifier(_enclosingUnit.functions, functionName);
+ _enclosingExecutable = _findIdentifier(_enclosingUnit.functions, functionName);
}
} else {
- PropertyAccessorElement accessor = findIdentifier(_enclosingUnit.accessors, functionName);
+ PropertyAccessorElement accessor = _findIdentifier(_enclosingUnit.accessors, functionName);
if (identical((property as sc.KeywordToken).keyword, sc.Keyword.SET)) {
accessor = accessor.variable.setter;
functionName.staticElement = accessor;
@@ -4855,7 +4855,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
Object visitFunctionExpression(FunctionExpression node) {
if (node.parent is! FunctionDeclaration) {
- FunctionElement element = findAtOffset(_enclosingExecutable.functions, node.beginToken.offset);
+ FunctionElement element = _findAtOffset(_enclosingExecutable.functions, node.beginToken.offset);
node.element = element;
}
ExecutableElement outerExecutable = _enclosingExecutable;
@@ -4871,7 +4871,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
FunctionTypeAliasElement outerAlias = _enclosingAlias;
try {
SimpleIdentifier aliasName = node.name;
- _enclosingAlias = findIdentifier(_enclosingUnit.functionTypeAliases, aliasName);
+ _enclosingAlias = _findIdentifier(_enclosingUnit.functionTypeAliases, aliasName);
return super.visitFunctionTypeAlias(node);
} finally {
_enclosingAlias = outerAlias;
@@ -4881,7 +4881,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
if (node.parent is! DefaultFormalParameter) {
SimpleIdentifier parameterName = node.identifier;
- ParameterElement element = getElementForParameter(node, parameterName);
+ ParameterElement element = _getElementForParameter(node, parameterName);
ParameterElement outerParameter = _enclosingParameter;
try {
_enclosingParameter = element;
@@ -4895,10 +4895,10 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
}
Object visitImportDirective(ImportDirective node) {
- String uri = getStringValue(node.uri);
+ String uri = _getStringValue(node.uri);
if (uri != null) {
LibraryElement library = _enclosingUnit.library;
- ImportElement importElement = findImport(library.imports, _enclosingUnit.context.sourceFactory.resolveUri(_enclosingUnit.source, uri), node.prefix);
+ ImportElement importElement = _findImport(library.imports, _enclosingUnit.context.sourceFactory.resolveUri(_enclosingUnit.source, uri), node.prefix);
node.element = importElement;
}
return super.visitImportDirective(node);
@@ -4907,7 +4907,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
Object visitLabeledStatement(LabeledStatement node) {
for (Label label in node.labels) {
SimpleIdentifier labelName = label.label;
- findIdentifier(_enclosingExecutable.labels, labelName);
+ _findIdentifier(_enclosingExecutable.labels, labelName);
}
return super.visitLabeledStatement(node);
}
@@ -4927,10 +4927,10 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
nameOfMethod = "unary-";
}
if (property == null) {
- _enclosingExecutable = findWithNameAndOffset(_enclosingClass.methods, nameOfMethod, methodName.offset);
+ _enclosingExecutable = _findWithNameAndOffset(_enclosingClass.methods, nameOfMethod, methodName.offset);
methodName.staticElement = _enclosingExecutable;
} else {
- PropertyAccessorElement accessor = findIdentifier(_enclosingClass.accessors, methodName);
+ PropertyAccessorElement accessor = _findIdentifier(_enclosingClass.accessors, methodName);
if (identical((property as sc.KeywordToken).keyword, sc.Keyword.SET)) {
accessor = accessor.variable.setter;
methodName.staticElement = accessor;
@@ -4944,10 +4944,10 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
}
Object visitPartDirective(PartDirective node) {
- String uri = getStringValue(node.uri);
+ String uri = _getStringValue(node.uri);
if (uri != null) {
Source partSource = _enclosingUnit.context.sourceFactory.resolveUri(_enclosingUnit.source, uri);
- node.element = findPart(_enclosingUnit.library.parts, partSource);
+ node.element = _findPart(_enclosingUnit.library.parts, partSource);
}
return super.visitPartDirective(node);
}
@@ -4960,7 +4960,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
Object visitSimpleFormalParameter(SimpleFormalParameter node) {
if (node.parent is! DefaultFormalParameter) {
SimpleIdentifier parameterName = node.identifier;
- ParameterElement element = getElementForParameter(node, parameterName);
+ ParameterElement element = _getElementForParameter(node, parameterName);
ParameterElement outerParameter = _enclosingParameter;
try {
_enclosingParameter = element;
@@ -4976,7 +4976,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
Object visitSwitchCase(SwitchCase node) {
for (Label label in node.labels) {
SimpleIdentifier labelName = label.label;
- findIdentifier(_enclosingExecutable.labels, labelName);
+ _findIdentifier(_enclosingExecutable.labels, labelName);
}
return super.visitSwitchCase(node);
}
@@ -4984,7 +4984,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
Object visitSwitchDefault(SwitchDefault node) {
for (Label label in node.labels) {
SimpleIdentifier labelName = label.label;
- findIdentifier(_enclosingExecutable.labels, labelName);
+ _findIdentifier(_enclosingExecutable.labels, labelName);
}
return super.visitSwitchDefault(node);
}
@@ -4992,9 +4992,9 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
Object visitTypeParameter(TypeParameter node) {
SimpleIdentifier parameterName = node.name;
if (_enclosingClass != null) {
- findIdentifier(_enclosingClass.typeParameters, parameterName);
+ _findIdentifier(_enclosingClass.typeParameters, parameterName);
} else if (_enclosingAlias != null) {
- findIdentifier(_enclosingAlias.typeParameters, parameterName);
+ _findIdentifier(_enclosingAlias.typeParameters, parameterName);
}
return super.visitTypeParameter(node);
}
@@ -5003,13 +5003,13 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
VariableElement element = null;
SimpleIdentifier variableName = node.name;
if (_enclosingExecutable != null) {
- element = findIdentifier(_enclosingExecutable.localVariables, variableName);
+ element = _findIdentifier(_enclosingExecutable.localVariables, variableName);
}
if (element == null && _enclosingClass != null) {
- element = findIdentifier(_enclosingClass.fields, variableName);
+ element = _findIdentifier(_enclosingClass.fields, variableName);
}
if (element == null && _enclosingUnit != null) {
- element = findIdentifier(_enclosingUnit.topLevelVariables, variableName);
+ element = _findIdentifier(_enclosingUnit.topLevelVariables, variableName);
}
Expression initializer = node.initializer;
if (initializer != null) {
@@ -5035,7 +5035,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
* @param offset the offset of the name of the element to be returned
* @return the element at the given offset
*/
- Element findAtOffset(List<Element> elements, int offset) => findWithNameAndOffset(elements, "", offset);
+ Element _findAtOffset(List<Element> elements, int offset) => _findWithNameAndOffset(elements, "", offset);
/**
* Return the export element from the given array whose library has the given source, or
@@ -5046,7 +5046,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
* for
* @return the export element whose library has the given source
*/
- ExportElement findExport(List<ExportElement> exports, Source source) {
+ ExportElement _findExport(List<ExportElement> exports, Source source) {
for (ExportElement export in exports) {
if (export.exportedLibrary.source == source) {
return export;
@@ -5063,8 +5063,8 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
* @param identifier the name node in the declaration of the element to be returned
* @return the element created for the declaration with the given name
*/
- Element findIdentifier(List<Element> elements, SimpleIdentifier identifier) {
- Element element = findWithNameAndOffset(elements, identifier.name, identifier.offset);
+ Element _findIdentifier(List<Element> elements, SimpleIdentifier identifier) {
+ Element element = _findWithNameAndOffset(elements, identifier.name, identifier.offset);
identifier.staticElement = element;
return element;
}
@@ -5079,7 +5079,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
* @param prefix the prefix with which the library was imported
* @return the import element whose library has the given source and prefix
*/
- ImportElement findImport(List<ImportElement> imports, Source source, SimpleIdentifier prefix) {
+ ImportElement _findImport(List<ImportElement> imports, Source source, SimpleIdentifier prefix) {
for (ImportElement element in imports) {
if (element.importedLibrary.source == source) {
PrefixElement prefixElement = element.prefix;
@@ -5105,7 +5105,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
* @param partSource the source for the part whose element is to be returned
* @return the element for the part with the given source
*/
- CompilationUnitElement findPart(List<CompilationUnitElement> parts, Source partSource) {
+ CompilationUnitElement _findPart(List<CompilationUnitElement> parts, Source partSource) {
for (CompilationUnitElement part in parts) {
if (part.source == partSource) {
return part;
@@ -5123,7 +5123,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
* @param offset the offset of the name of the element to be returned
* @return the element with the given name and offset
*/
- Element findWithNameAndOffset(List<Element> elements, String name, int offset) {
+ Element _findWithNameAndOffset(List<Element> elements, String name, int offset) {
for (Element element in elements) {
if (element.displayName == name && element.nameOffset == offset) {
return element;
@@ -5139,7 +5139,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
* @param parameterName the name of the parameter being searched for
* @return the element representing the parameter with that name
*/
- ParameterElement getElementForParameter(FormalParameter node, SimpleIdentifier parameterName) {
+ ParameterElement _getElementForParameter(FormalParameter node, SimpleIdentifier parameterName) {
List<ParameterElement> parameters = null;
if (_enclosingParameter != null) {
parameters = _enclosingParameter.parameters;
@@ -5150,7 +5150,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
if (parameters == null && _enclosingAlias != null) {
parameters = _enclosingAlias.parameters;
}
- ParameterElement element = parameters == null ? null : findIdentifier(parameters, parameterName);
+ ParameterElement element = parameters == null ? null : _findIdentifier(parameters, parameterName);
if (element == null) {
PrintStringWriter writer = new PrintStringWriter();
writer.println("Invalid state found in the Analysis Engine:");
@@ -5174,7 +5174,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
* @param literal the string literal whose value is to be returned
* @return the value of the given string literal
*/
- String getStringValue(StringLiteral literal) {
+ String _getStringValue(StringLiteral literal) {
if (literal is StringInterpolation) {
return null;
}
@@ -5256,7 +5256,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
*
* @return `true` if the given identifier is the return type of a constructor declaration.
*/
- static bool isConstructorReturnType(SimpleIdentifier identifier) {
+ static bool _isConstructorReturnType(SimpleIdentifier identifier) {
AstNode parent = identifier.parent;
if (parent is ConstructorDeclaration) {
return identical(parent.returnType, identifier);
@@ -5270,7 +5270,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @return `true` if the given identifier is the return type of a factory constructor
* declaration.
*/
- static bool isFactoryConstructorReturnType(SimpleIdentifier node) {
+ static bool _isFactoryConstructorReturnType(SimpleIdentifier node) {
AstNode parent = node.parent;
if (parent is ConstructorDeclaration) {
ConstructorDeclaration constructor = parent;
@@ -5285,7 +5285,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param node the 'super' expression to analyze
* @return `true` if the 'super' expression is in a valid context
*/
- static bool isSuperInValidContext(SuperExpression node) {
+ static bool _isSuperInValidContext(SuperExpression node) {
for (AstNode n = node; n != null; n = n.parent) {
if (n is CompilationUnit) {
return false;
@@ -5372,19 +5372,19 @@ class ElementResolver extends SimpleAstVisitor<Object> {
sc.Token operator = node.operator;
sc.TokenType operatorType = operator.type;
if (operatorType != sc.TokenType.EQ) {
- operatorType = operatorFromCompoundAssignment(operatorType);
+ operatorType = _operatorFromCompoundAssignment(operatorType);
Expression leftHandSide = node.leftHandSide;
if (leftHandSide != null) {
String methodName = operatorType.lexeme;
- Type2 staticType = getStaticType(leftHandSide);
- MethodElement staticMethod = lookUpMethod(leftHandSide, staticType, methodName);
+ Type2 staticType = _getStaticType(leftHandSide);
+ MethodElement staticMethod = _lookUpMethod(leftHandSide, staticType, methodName);
node.staticElement = staticMethod;
- Type2 propagatedType = getPropagatedType(leftHandSide);
- MethodElement propagatedMethod = lookUpMethod(leftHandSide, propagatedType, methodName);
+ Type2 propagatedType = _getPropagatedType(leftHandSide);
+ MethodElement propagatedMethod = _lookUpMethod(leftHandSide, propagatedType, methodName);
node.propagatedElement = propagatedMethod;
- if (shouldReportMissingMember(staticType, staticMethod)) {
+ if (_shouldReportMissingMember(staticType, staticMethod)) {
_resolver.reportErrorProxyConditionalAnalysisError(staticType.element, StaticTypeWarningCode.UNDEFINED_METHOD, operator, [methodName, staticType.displayName]);
- } else if (_enableHints && shouldReportMissingMember(propagatedType, propagatedMethod) && !memberFoundInSubclass(propagatedType.element, methodName, true, false)) {
+ } else if (_enableHints && _shouldReportMissingMember(propagatedType, propagatedMethod) && !_memberFoundInSubclass(propagatedType.element, methodName, true, false)) {
_resolver.reportErrorProxyConditionalAnalysisError(propagatedType.element, HintCode.UNDEFINED_METHOD, operator, [methodName, propagatedType.displayName]);
}
}
@@ -5398,15 +5398,15 @@ class ElementResolver extends SimpleAstVisitor<Object> {
Expression leftOperand = node.leftOperand;
if (leftOperand != null) {
String methodName = operator.lexeme;
- Type2 staticType = getStaticType(leftOperand);
- MethodElement staticMethod = lookUpMethod(leftOperand, staticType, methodName);
+ Type2 staticType = _getStaticType(leftOperand);
+ MethodElement staticMethod = _lookUpMethod(leftOperand, staticType, methodName);
node.staticElement = staticMethod;
- Type2 propagatedType = getPropagatedType(leftOperand);
- MethodElement propagatedMethod = lookUpMethod(leftOperand, propagatedType, methodName);
+ Type2 propagatedType = _getPropagatedType(leftOperand);
+ MethodElement propagatedMethod = _lookUpMethod(leftOperand, propagatedType, methodName);
node.propagatedElement = propagatedMethod;
- if (shouldReportMissingMember(staticType, staticMethod)) {
+ if (_shouldReportMissingMember(staticType, staticMethod)) {
_resolver.reportErrorProxyConditionalAnalysisError(staticType.element, StaticTypeWarningCode.UNDEFINED_OPERATOR, operator, [methodName, staticType.displayName]);
- } else if (_enableHints && shouldReportMissingMember(propagatedType, propagatedMethod) && !memberFoundInSubclass(propagatedType.element, methodName, true, false)) {
+ } else if (_enableHints && _shouldReportMissingMember(propagatedType, propagatedMethod) && !_memberFoundInSubclass(propagatedType.element, methodName, true, false)) {
_resolver.reportErrorProxyConditionalAnalysisError(propagatedType.element, HintCode.UNDEFINED_OPERATOR, operator, [methodName, propagatedType.displayName]);
}
}
@@ -5415,17 +5415,17 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
Object visitBreakStatement(BreakStatement node) {
- lookupLabel(node, node.label);
+ _lookupLabel(node, node.label);
return null;
}
Object visitClassDeclaration(ClassDeclaration node) {
- setMetadata(node.element, node);
+ _setMetadata(node.element, node);
return null;
}
Object visitClassTypeAlias(ClassTypeAlias node) {
- setMetadata(node.element, node);
+ _setMetadata(node.element, node);
return null;
}
@@ -5433,12 +5433,12 @@ class ElementResolver extends SimpleAstVisitor<Object> {
Identifier identifier = node.identifier;
if (identifier is SimpleIdentifier) {
SimpleIdentifier simpleIdentifier = identifier;
- Element element = resolveSimpleIdentifier(simpleIdentifier);
+ Element element = _resolveSimpleIdentifier(simpleIdentifier);
if (element == null) {
//
// This might be a reference to an imported name that is missing the prefix.
//
- element = findImportWithoutPrefix(simpleIdentifier);
+ element = _findImportWithoutPrefix(simpleIdentifier);
if (element is MultiplyDefinedElement) {
// TODO(brianwilkerson) Report this error?
element = null;
@@ -5464,7 +5464,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
PrefixedIdentifier prefixedIdentifier = identifier;
SimpleIdentifier prefix = prefixedIdentifier.prefix;
SimpleIdentifier name = prefixedIdentifier.identifier;
- Element element = resolveSimpleIdentifier(prefix);
+ Element element = _resolveSimpleIdentifier(prefix);
if (element == null) {
} else {
if (element is PrefixElement) {
@@ -5483,11 +5483,11 @@ class ElementResolver extends SimpleAstVisitor<Object> {
name.staticElement = element;
if (node.newKeyword == null) {
if (element is ClassElement) {
- Element memberElement = lookupGetterOrMethod((element as ClassElement).type, name.name);
+ Element memberElement = _lookupGetterOrMethod((element as ClassElement).type, name.name);
if (memberElement == null) {
memberElement = (element as ClassElement).getNamedConstructor(name.name);
if (memberElement == null) {
- memberElement = lookUpSetter(prefix, (element as ClassElement).type, name.name);
+ memberElement = _lookUpSetter(prefix, (element as ClassElement).type, name.name);
}
}
if (memberElement == null) {
@@ -5530,7 +5530,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
}
}
- setMetadata(constructorElement, node);
+ _setMetadata(constructorElement, node);
}
return null;
}
@@ -5576,12 +5576,12 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
Object visitContinueStatement(ContinueStatement node) {
- lookupLabel(node, node.label);
+ _lookupLabel(node, node.label);
return null;
}
Object visitDeclaredIdentifier(DeclaredIdentifier node) {
- setMetadata(node.element, node);
+ _setMetadata(node.element, node);
return null;
}
@@ -5591,19 +5591,19 @@ class ElementResolver extends SimpleAstVisitor<Object> {
// The element is null when the URI is invalid
// TODO(brianwilkerson) Figure out whether the element can ever be something other than an
// ExportElement
- resolveCombinators(exportElement.exportedLibrary, node.combinators);
- setMetadata(exportElement, node);
+ _resolveCombinators(exportElement.exportedLibrary, node.combinators);
+ _setMetadata(exportElement, node);
}
return null;
}
Object visitFieldFormalParameter(FieldFormalParameter node) {
- setMetadataForParameter(node.element, node);
+ _setMetadataForParameter(node.element, node);
return super.visitFieldFormalParameter(node);
}
Object visitFunctionDeclaration(FunctionDeclaration node) {
- setMetadata(node.element, node);
+ _setMetadata(node.element, node);
return null;
}
@@ -5614,7 +5614,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
FunctionExpression functionExpression = expression;
ExecutableElement functionElement = functionExpression.element;
ArgumentList argumentList = node.argumentList;
- List<ParameterElement> parameters = resolveArgumentsToFunction(false, argumentList, functionElement);
+ List<ParameterElement> parameters = _resolveArgumentsToFunction(false, argumentList, functionElement);
if (parameters != null) {
argumentList.correspondingStaticParameters = parameters;
}
@@ -5623,12 +5623,12 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
Object visitFunctionTypeAlias(FunctionTypeAlias node) {
- setMetadata(node.element, node);
+ _setMetadata(node.element, node);
return null;
}
Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
- setMetadataForParameter(node.element, node);
+ _setMetadataForParameter(node.element, node);
return null;
}
@@ -5648,56 +5648,56 @@ class ElementResolver extends SimpleAstVisitor<Object> {
// The element is null when the URI is invalid
LibraryElement library = importElement.importedLibrary;
if (library != null) {
- resolveCombinators(library, node.combinators);
+ _resolveCombinators(library, node.combinators);
}
- setMetadata(importElement, node);
+ _setMetadata(importElement, node);
}
return null;
}
Object visitIndexExpression(IndexExpression node) {
Expression target = node.realTarget;
- Type2 staticType = getStaticType(target);
- Type2 propagatedType = getPropagatedType(target);
+ Type2 staticType = _getStaticType(target);
+ Type2 propagatedType = _getPropagatedType(target);
String getterMethodName = sc.TokenType.INDEX.lexeme;
String setterMethodName = sc.TokenType.INDEX_EQ.lexeme;
bool isInGetterContext = node.inGetterContext();
bool isInSetterContext = node.inSetterContext();
if (isInGetterContext && isInSetterContext) {
// lookup setter
- MethodElement setterStaticMethod = lookUpMethod(target, staticType, setterMethodName);
- MethodElement setterPropagatedMethod = lookUpMethod(target, propagatedType, setterMethodName);
+ MethodElement setterStaticMethod = _lookUpMethod(target, staticType, setterMethodName);
+ MethodElement setterPropagatedMethod = _lookUpMethod(target, propagatedType, setterMethodName);
// set setter element
node.staticElement = setterStaticMethod;
node.propagatedElement = setterPropagatedMethod;
// generate undefined method warning
- checkForUndefinedIndexOperator(node, target, getterMethodName, setterStaticMethod, setterPropagatedMethod, staticType, propagatedType);
+ _checkForUndefinedIndexOperator(node, target, getterMethodName, setterStaticMethod, setterPropagatedMethod, staticType, propagatedType);
// lookup getter method
- MethodElement getterStaticMethod = lookUpMethod(target, staticType, getterMethodName);
- MethodElement getterPropagatedMethod = lookUpMethod(target, propagatedType, getterMethodName);
+ MethodElement getterStaticMethod = _lookUpMethod(target, staticType, getterMethodName);
+ MethodElement getterPropagatedMethod = _lookUpMethod(target, propagatedType, getterMethodName);
// set getter element
AuxiliaryElements auxiliaryElements = new AuxiliaryElements(getterStaticMethod, getterPropagatedMethod);
node.auxiliaryElements = auxiliaryElements;
// generate undefined method warning
- checkForUndefinedIndexOperator(node, target, getterMethodName, getterStaticMethod, getterPropagatedMethod, staticType, propagatedType);
+ _checkForUndefinedIndexOperator(node, target, getterMethodName, getterStaticMethod, getterPropagatedMethod, staticType, propagatedType);
} else if (isInGetterContext) {
// lookup getter method
- MethodElement staticMethod = lookUpMethod(target, staticType, getterMethodName);
- MethodElement propagatedMethod = lookUpMethod(target, propagatedType, getterMethodName);
+ MethodElement staticMethod = _lookUpMethod(target, staticType, getterMethodName);
+ MethodElement propagatedMethod = _lookUpMethod(target, propagatedType, getterMethodName);
// set getter element
node.staticElement = staticMethod;
node.propagatedElement = propagatedMethod;
// generate undefined method warning
- checkForUndefinedIndexOperator(node, target, getterMethodName, staticMethod, propagatedMethod, staticType, propagatedType);
+ _checkForUndefinedIndexOperator(node, target, getterMethodName, staticMethod, propagatedMethod, staticType, propagatedType);
} else if (isInSetterContext) {
// lookup setter method
- MethodElement staticMethod = lookUpMethod(target, staticType, setterMethodName);
- MethodElement propagatedMethod = lookUpMethod(target, propagatedType, setterMethodName);
+ MethodElement staticMethod = _lookUpMethod(target, staticType, setterMethodName);
+ MethodElement propagatedMethod = _lookUpMethod(target, propagatedType, setterMethodName);
// set setter element
node.staticElement = staticMethod;
node.propagatedElement = propagatedMethod;
// generate undefined method warning
- checkForUndefinedIndexOperator(node, target, setterMethodName, staticMethod, propagatedMethod, staticType, propagatedType);
+ _checkForUndefinedIndexOperator(node, target, setterMethodName, staticMethod, propagatedMethod, staticType, propagatedType);
}
return null;
}
@@ -5706,7 +5706,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
ConstructorElement invokedConstructor = node.constructorName.staticElement;
node.staticElement = invokedConstructor;
ArgumentList argumentList = node.argumentList;
- List<ParameterElement> parameters = resolveArgumentsToFunction(node.isConst, argumentList, invokedConstructor);
+ List<ParameterElement> parameters = _resolveArgumentsToFunction(node.isConst, argumentList, invokedConstructor);
if (parameters != null) {
argumentList.correspondingStaticParameters = parameters;
}
@@ -5714,12 +5714,12 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
Object visitLibraryDirective(LibraryDirective node) {
- setMetadata(node.element, node);
+ _setMetadata(node.element, node);
return null;
}
Object visitMethodDeclaration(MethodDeclaration node) {
- setMetadata(node.element, node);
+ _setMetadata(node.element, node);
return null;
}
@@ -5737,16 +5737,16 @@ class ElementResolver extends SimpleAstVisitor<Object> {
// propagated type information.
//
Expression target = node.realTarget;
- if (target is SuperExpression && !isSuperInValidContext(target)) {
+ if (target is SuperExpression && !_isSuperInValidContext(target)) {
return null;
}
Element staticElement;
Element propagatedElement;
if (target == null) {
- staticElement = resolveInvokedElement(methodName);
+ staticElement = _resolveInvokedElement(methodName);
propagatedElement = null;
} else {
- Type2 staticType = getStaticType(target);
+ Type2 staticType = _getStaticType(target);
//
// If this method invocation is of the form 'C.m' where 'C' is a class, then we don't call
// resolveInvokedElement(..) which walks up the class hierarchy, instead we just look for the
@@ -5754,14 +5754,14 @@ class ElementResolver extends SimpleAstVisitor<Object> {
//
ClassElementImpl typeReference = getTypeReference(target);
if (typeReference != null) {
- staticElement = propagatedElement = resolveElement(typeReference, methodName);
+ staticElement = propagatedElement = _resolveElement(typeReference, methodName);
} else {
- staticElement = resolveInvokedElementWithTarget(target, staticType, methodName);
- propagatedElement = resolveInvokedElementWithTarget(target, getPropagatedType(target), methodName);
+ staticElement = _resolveInvokedElementWithTarget(target, staticType, methodName);
+ propagatedElement = _resolveInvokedElementWithTarget(target, _getPropagatedType(target), methodName);
}
}
- staticElement = convertSetterToGetter(staticElement);
- propagatedElement = convertSetterToGetter(propagatedElement);
+ staticElement = _convertSetterToGetter(staticElement);
+ propagatedElement = _convertSetterToGetter(propagatedElement);
//
// Record the results.
//
@@ -5769,13 +5769,13 @@ class ElementResolver extends SimpleAstVisitor<Object> {
methodName.propagatedElement = propagatedElement;
ArgumentList argumentList = node.argumentList;
if (staticElement != null) {
- List<ParameterElement> parameters = computeCorrespondingParameters(argumentList, staticElement);
+ List<ParameterElement> parameters = _computeCorrespondingParameters(argumentList, staticElement);
if (parameters != null) {
argumentList.correspondingStaticParameters = parameters;
}
}
if (propagatedElement != null) {
- List<ParameterElement> parameters = computeCorrespondingParameters(argumentList, propagatedElement);
+ List<ParameterElement> parameters = _computeCorrespondingParameters(argumentList, propagatedElement);
if (parameters != null) {
argumentList.correspondingPropagatedParameters = parameters;
}
@@ -5783,10 +5783,10 @@ class ElementResolver extends SimpleAstVisitor<Object> {
//
// Then check for error conditions.
//
- ErrorCode errorCode = checkForInvocationError(target, true, staticElement);
+ ErrorCode errorCode = _checkForInvocationError(target, true, staticElement);
bool generatedWithTypePropagation = false;
if (_enableHints && errorCode == null && staticElement == null) {
- errorCode = checkForInvocationError(target, false, propagatedElement);
+ errorCode = _checkForInvocationError(target, false, propagatedElement);
if (identical(errorCode, StaticTypeWarningCode.UNDEFINED_METHOD)) {
ClassElement classElementContext = null;
if (target == null) {
@@ -5831,12 +5831,12 @@ class ElementResolver extends SimpleAstVisitor<Object> {
// propagation here as well)
Type2 targetType = null;
if (!generatedWithTypePropagation) {
- targetType = getStaticType(target);
+ targetType = _getStaticType(target);
} else {
// choose the best type
- targetType = getPropagatedType(target);
+ targetType = _getPropagatedType(target);
if (targetType == null) {
- targetType = getStaticType(target);
+ targetType = _getStaticType(target);
}
}
if (targetType != null && targetType.isDartCoreFunction && methodName.name == CALL_METHOD_NAME) {
@@ -5851,7 +5851,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
} else if (identical(errorCode, StaticTypeWarningCode.UNDEFINED_SUPER_METHOD)) {
// Generate the type name.
// The error code will never be generated via type propagation
- Type2 targetType = getStaticType(target);
+ Type2 targetType = _getStaticType(target);
String targetTypeName = targetType == null ? null : targetType.name;
_resolver.reportErrorForNode(StaticTypeWarningCode.UNDEFINED_SUPER_METHOD, methodName, [methodName.name, targetTypeName]);
}
@@ -5859,27 +5859,27 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
Object visitPartDirective(PartDirective node) {
- setMetadata(node.element, node);
+ _setMetadata(node.element, node);
return null;
}
Object visitPartOfDirective(PartOfDirective node) {
- setMetadata(node.element, node);
+ _setMetadata(node.element, node);
return null;
}
Object visitPostfixExpression(PostfixExpression node) {
Expression operand = node.operand;
- String methodName = getPostfixOperator(node);
- Type2 staticType = getStaticType(operand);
- MethodElement staticMethod = lookUpMethod(operand, staticType, methodName);
+ String methodName = _getPostfixOperator(node);
+ Type2 staticType = _getStaticType(operand);
+ MethodElement staticMethod = _lookUpMethod(operand, staticType, methodName);
node.staticElement = staticMethod;
- Type2 propagatedType = getPropagatedType(operand);
- MethodElement propagatedMethod = lookUpMethod(operand, propagatedType, methodName);
+ Type2 propagatedType = _getPropagatedType(operand);
+ MethodElement propagatedMethod = _lookUpMethod(operand, propagatedType, methodName);
node.propagatedElement = propagatedMethod;
- if (shouldReportMissingMember(staticType, staticMethod)) {
+ if (_shouldReportMissingMember(staticType, staticMethod)) {
_resolver.reportErrorProxyConditionalAnalysisError(staticType.element, StaticTypeWarningCode.UNDEFINED_OPERATOR, node.operator, [methodName, staticType.displayName]);
- } else if (_enableHints && shouldReportMissingMember(propagatedType, propagatedMethod) && !memberFoundInSubclass(propagatedType.element, methodName, true, false)) {
+ } else if (_enableHints && _shouldReportMissingMember(propagatedType, propagatedMethod) && !_memberFoundInSubclass(propagatedType.element, methodName, true, false)) {
_resolver.reportErrorProxyConditionalAnalysisError(propagatedType.element, HintCode.UNDEFINED_OPERATOR, node.operator, [methodName, propagatedType.displayName]);
}
return null;
@@ -5924,7 +5924,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
// Validate annotation element.
if (node.parent is Annotation) {
Annotation annotation = node.parent as Annotation;
- resolveAnnotationElement(annotation);
+ _resolveAnnotationElement(annotation);
return null;
}
return null;
@@ -5932,13 +5932,13 @@ class ElementResolver extends SimpleAstVisitor<Object> {
// May be annotation, resolve invocation of "const" constructor.
if (node.parent is Annotation) {
Annotation annotation = node.parent as Annotation;
- resolveAnnotationElement(annotation);
+ _resolveAnnotationElement(annotation);
}
//
// Otherwise, the prefix is really an expression that happens to be a simple identifier and this
// is really equivalent to a property access node.
//
- resolvePropertyAccess(prefix, identifier);
+ _resolvePropertyAccess(prefix, identifier);
return null;
}
@@ -5947,16 +5947,16 @@ class ElementResolver extends SimpleAstVisitor<Object> {
sc.TokenType operatorType = operator.type;
if (operatorType.isUserDefinableOperator || identical(operatorType, sc.TokenType.PLUS_PLUS) || identical(operatorType, sc.TokenType.MINUS_MINUS)) {
Expression operand = node.operand;
- String methodName = getPrefixOperator(node);
- Type2 staticType = getStaticType(operand);
- MethodElement staticMethod = lookUpMethod(operand, staticType, methodName);
+ String methodName = _getPrefixOperator(node);
+ Type2 staticType = _getStaticType(operand);
+ MethodElement staticMethod = _lookUpMethod(operand, staticType, methodName);
node.staticElement = staticMethod;
- Type2 propagatedType = getPropagatedType(operand);
- MethodElement propagatedMethod = lookUpMethod(operand, propagatedType, methodName);
+ Type2 propagatedType = _getPropagatedType(operand);
+ MethodElement propagatedMethod = _lookUpMethod(operand, propagatedType, methodName);
node.propagatedElement = propagatedMethod;
- if (shouldReportMissingMember(staticType, staticMethod)) {
+ if (_shouldReportMissingMember(staticType, staticMethod)) {
_resolver.reportErrorProxyConditionalAnalysisError(staticType.element, StaticTypeWarningCode.UNDEFINED_OPERATOR, operator, [methodName, staticType.displayName]);
- } else if (_enableHints && shouldReportMissingMember(propagatedType, propagatedMethod) && !memberFoundInSubclass(propagatedType.element, methodName, true, false)) {
+ } else if (_enableHints && _shouldReportMissingMember(propagatedType, propagatedMethod) && !_memberFoundInSubclass(propagatedType.element, methodName, true, false)) {
_resolver.reportErrorProxyConditionalAnalysisError(propagatedType.element, HintCode.UNDEFINED_OPERATOR, operator, [methodName, propagatedType.displayName]);
}
}
@@ -5965,11 +5965,11 @@ class ElementResolver extends SimpleAstVisitor<Object> {
Object visitPropertyAccess(PropertyAccess node) {
Expression target = node.realTarget;
- if (target is SuperExpression && !isSuperInValidContext(target)) {
+ if (target is SuperExpression && !_isSuperInValidContext(target)) {
return null;
}
SimpleIdentifier propertyName = node.propertyName;
- resolvePropertyAccess(target, propertyName);
+ _resolvePropertyAccess(target, propertyName);
return null;
}
@@ -5995,7 +5995,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
node.staticElement = element;
ArgumentList argumentList = node.argumentList;
- List<ParameterElement> parameters = resolveArgumentsToFunction(false, argumentList, element);
+ List<ParameterElement> parameters = _resolveArgumentsToFunction(false, argumentList, element);
if (parameters != null) {
argumentList.correspondingStaticParameters = parameters;
}
@@ -6003,7 +6003,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
Object visitSimpleFormalParameter(SimpleFormalParameter node) {
- setMetadataForParameter(node.element, node);
+ _setMetadataForParameter(node.element, node);
return null;
}
@@ -6032,16 +6032,16 @@ class ElementResolver extends SimpleAstVisitor<Object> {
//
// Otherwise, the node should be resolved.
//
- Element element = resolveSimpleIdentifier(node);
+ Element element = _resolveSimpleIdentifier(node);
ClassElement enclosingClass = _resolver.enclosingClass;
- if (isFactoryConstructorReturnType(node) && element != enclosingClass) {
+ if (_isFactoryConstructorReturnType(node) && element != enclosingClass) {
_resolver.reportErrorForNode(CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS, node, []);
- } else if (isConstructorReturnType(node) && element != enclosingClass) {
+ } else if (_isConstructorReturnType(node) && element != enclosingClass) {
_resolver.reportErrorForNode(CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME, node, []);
element = null;
- } else if (element == null || (element is PrefixElement && !isValidAsPrefix(node))) {
+ } else if (element == null || (element is PrefixElement && !_isValidAsPrefix(node))) {
// TODO(brianwilkerson) Recover from this error.
- if (isConstructorReturnType(node)) {
+ if (_isConstructorReturnType(node)) {
_resolver.reportErrorForNode(CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME, node, []);
} else if (node.parent is Annotation) {
Annotation annotation = node.parent as Annotation;
@@ -6053,7 +6053,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
node.staticElement = element;
if (node.inSetterContext() && node.inGetterContext() && enclosingClass != null) {
InterfaceType enclosingType = enclosingClass.type;
- AuxiliaryElements auxiliaryElements = new AuxiliaryElements(lookUpGetter(null, enclosingType, node.name), null);
+ AuxiliaryElements auxiliaryElements = new AuxiliaryElements(_lookUpGetter(null, enclosingType, node.name), null);
node.auxiliaryElements = auxiliaryElements;
}
//
@@ -6061,7 +6061,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
//
if (node.parent is Annotation) {
Annotation annotation = node.parent as Annotation;
- resolveAnnotationElement(annotation);
+ _resolveAnnotationElement(annotation);
}
return null;
}
@@ -6097,7 +6097,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
node.staticElement = element;
ArgumentList argumentList = node.argumentList;
- List<ParameterElement> parameters = resolveArgumentsToFunction(isInConstConstructor, argumentList, element);
+ List<ParameterElement> parameters = _resolveArgumentsToFunction(isInConstConstructor, argumentList, element);
if (parameters != null) {
argumentList.correspondingStaticParameters = parameters;
}
@@ -6105,19 +6105,19 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
Object visitSuperExpression(SuperExpression node) {
- if (!isSuperInValidContext(node)) {
+ if (!_isSuperInValidContext(node)) {
_resolver.reportErrorForNode(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, node, []);
}
return super.visitSuperExpression(node);
}
Object visitTypeParameter(TypeParameter node) {
- setMetadata(node.element, node);
+ _setMetadata(node.element, node);
return null;
}
Object visitVariableDeclaration(VariableDeclaration node) {
- setMetadata(node.element, node);
+ _setMetadata(node.element, node);
return null;
}
@@ -6128,7 +6128,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param annotationList the list of elements to which new elements are to be added
* @param annotations the AST nodes used to generate new elements
*/
- void addAnnotations(List<ElementAnnotationImpl> annotationList, NodeList<Annotation> annotations) {
+ void _addAnnotations(List<ElementAnnotationImpl> annotationList, NodeList<Annotation> annotations) {
int annotationCount = annotations.length;
for (int i = 0; i < annotationCount; i++) {
Element resolvedElement = annotations[i].element;
@@ -6147,7 +6147,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param element the element to be invoked
* @return the error code that should be reported
*/
- ErrorCode checkForInvocationError(Expression target, bool useStaticContext, Element element) {
+ ErrorCode _checkForInvocationError(Expression target, bool useStaticContext, Element element) {
// Prefix is not declared, instead "prefix.id" are declared.
if (element is PrefixElement) {
element = null;
@@ -6160,7 +6160,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
FunctionType getterType = element.type;
if (getterType != null) {
Type2 returnType = getterType.returnType;
- if (!isExecutableType(returnType)) {
+ if (!_isExecutableType(returnType)) {
return StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION;
}
}
@@ -6181,13 +6181,13 @@ class ElementResolver extends SimpleAstVisitor<Object> {
FunctionType getterType = getter.type;
if (getterType != null) {
Type2 returnType = getterType.returnType;
- if (!isExecutableType(returnType)) {
+ if (!_isExecutableType(returnType)) {
return StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION;
}
}
} else if (element is VariableElement) {
Type2 variableType = element.type;
- if (!isExecutableType(variableType)) {
+ if (!_isExecutableType(variableType)) {
return StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION;
}
} else {
@@ -6204,7 +6204,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
} else {
Type2 targetType;
if (useStaticContext) {
- targetType = getStaticType(target);
+ targetType = _getStaticType(target);
} else {
// Compute and use the propagated type, if it is null, then it may be the case that
// static type is some type, in which the static type should be used.
@@ -6232,9 +6232,9 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* index expression
* @return `true` if and only if an error code is generated on the passed node
*/
- bool checkForUndefinedIndexOperator(IndexExpression node, Expression target, String methodName, MethodElement staticMethod, MethodElement propagatedMethod, Type2 staticType, Type2 propagatedType) {
- bool shouldReportMissingMember_static = shouldReportMissingMember(staticType, staticMethod);
- bool shouldReportMissingMember_propagated = !shouldReportMissingMember_static && _enableHints && shouldReportMissingMember(propagatedType, propagatedMethod) && !memberFoundInSubclass(propagatedType.element, methodName, true, false);
+ bool _checkForUndefinedIndexOperator(IndexExpression node, Expression target, String methodName, MethodElement staticMethod, MethodElement propagatedMethod, Type2 staticType, Type2 propagatedType) {
+ bool shouldReportMissingMember_static = _shouldReportMissingMember(staticType, staticMethod);
+ bool shouldReportMissingMember_propagated = !shouldReportMissingMember_static && _enableHints && _shouldReportMissingMember(propagatedType, propagatedMethod) && !_memberFoundInSubclass(propagatedType.element, methodName, true, false);
if (shouldReportMissingMember_static || shouldReportMissingMember_propagated) {
sc.Token leftBracket = node.leftBracket;
sc.Token rightBracket = node.rightBracket;
@@ -6264,7 +6264,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param executableElement the element that will be invoked with the arguments
* @return the parameters that correspond to the arguments
*/
- List<ParameterElement> computeCorrespondingParameters(ArgumentList argumentList, Element element) {
+ List<ParameterElement> _computeCorrespondingParameters(ArgumentList argumentList, Element element) {
if (element is PropertyAccessorElement) {
//
// This is an invocation of the call method defined on the value returned by the getter.
@@ -6275,30 +6275,30 @@ class ElementResolver extends SimpleAstVisitor<Object> {
if (getterReturnType is InterfaceType) {
MethodElement callMethod = getterReturnType.lookUpMethod(CALL_METHOD_NAME, _definingLibrary);
if (callMethod != null) {
- return resolveArgumentsToFunction(false, argumentList, callMethod);
+ return _resolveArgumentsToFunction(false, argumentList, callMethod);
}
} else if (getterReturnType is FunctionType) {
Element functionElement = getterReturnType.element;
if (functionElement is ExecutableElement) {
- return resolveArgumentsToFunction(false, argumentList, functionElement);
+ return _resolveArgumentsToFunction(false, argumentList, functionElement);
}
}
}
} else if (element is ExecutableElement) {
- return resolveArgumentsToFunction(false, argumentList, element);
+ return _resolveArgumentsToFunction(false, argumentList, element);
} else if (element is VariableElement) {
VariableElement variable = element;
Type2 type = _promoteManager.getStaticType(variable);
if (type is FunctionType) {
FunctionType functionType = type;
List<ParameterElement> parameters = functionType.parameters;
- return resolveArgumentsToParameters(false, argumentList, parameters);
+ return _resolveArgumentsToParameters(false, argumentList, parameters);
} else if (type is InterfaceType) {
// "call" invocation
MethodElement callMethod = type.lookUpMethod(CALL_METHOD_NAME, _definingLibrary);
if (callMethod != null) {
List<ParameterElement> parameters = callMethod.parameters;
- return resolveArgumentsToParameters(false, argumentList, parameters);
+ return _resolveArgumentsToParameters(false, argumentList, parameters);
}
}
}
@@ -6312,7 +6312,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param element the element to be normalized
* @return a non-setter element derived from the given element
*/
- Element convertSetterToGetter(Element element) {
+ Element _convertSetterToGetter(Element element) {
// TODO(brianwilkerson) Determine whether and why the element could ever be a setter.
if (element is PropertyAccessorElement) {
return element.variable.getter;
@@ -6327,7 +6327,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param identifier the identifier that might have been imported using a prefix
* @return the element that was found
*/
- Element findImportWithoutPrefix(SimpleIdentifier identifier) {
+ Element _findImportWithoutPrefix(SimpleIdentifier identifier) {
Element element = null;
Scope nameScope = _resolver.nameScope;
for (ImportElement importElement in _definingLibrary.imports) {
@@ -6353,7 +6353,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param node the postfix expression being invoked
* @return the name of the method invoked by the expression
*/
- String getPostfixOperator(PostfixExpression node) => (identical(node.operator.type, sc.TokenType.PLUS_PLUS)) ? sc.TokenType.PLUS.lexeme : sc.TokenType.MINUS.lexeme;
+ String _getPostfixOperator(PostfixExpression node) => (identical(node.operator.type, sc.TokenType.PLUS_PLUS)) ? sc.TokenType.PLUS.lexeme : sc.TokenType.MINUS.lexeme;
/**
* Return the name of the method invoked by the given postfix expression.
@@ -6361,7 +6361,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param node the postfix expression being invoked
* @return the name of the method invoked by the expression
*/
- String getPrefixOperator(PrefixExpression node) {
+ String _getPrefixOperator(PrefixExpression node) {
sc.Token operator = node.operator;
sc.TokenType operatorType = operator.type;
if (identical(operatorType, sc.TokenType.PLUS_PLUS)) {
@@ -6381,8 +6381,8 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param expression the expression whose type is to be returned
* @return the type of the given expression
*/
- Type2 getPropagatedType(Expression expression) {
- Type2 propagatedType = resolveTypeParameter(expression.propagatedType);
+ Type2 _getPropagatedType(Expression expression) {
+ Type2 propagatedType = _resolveTypeParameter(expression.propagatedType);
if (propagatedType is FunctionType) {
//
// All function types are subtypes of 'Function', which is itself a subclass of 'Object'.
@@ -6398,11 +6398,11 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param expression the expression whose type is to be returned
* @return the type of the given expression
*/
- Type2 getStaticType(Expression expression) {
+ Type2 _getStaticType(Expression expression) {
if (expression is NullLiteral) {
return _resolver.typeProvider.bottomType;
}
- Type2 staticType = resolveTypeParameter(expression.staticType);
+ Type2 staticType = _resolveTypeParameter(expression.staticType);
if (staticType is FunctionType) {
//
// All function types are subtypes of 'Function', which is itself a subclass of 'Object'.
@@ -6419,7 +6419,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param type the type being tested
* @return `true` if the given type represents an object that could be invoked
*/
- bool isExecutableType(Type2 type) {
+ bool _isExecutableType(Type2 type) {
if (type.isDynamic || (type is FunctionType) || type.isDartCoreFunction || type.isObject) {
return true;
} else if (type is InterfaceType) {
@@ -6447,7 +6447,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param element the element being tested
* @return `true` if the given element is a static element
*/
- bool isStatic(Element element) {
+ bool _isStatic(Element element) {
if (element is ExecutableElement) {
return element.isStatic;
} else if (element is PropertyInducingElement) {
@@ -6464,7 +6464,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param node the node being tested
* @return `true` if the given node is the prefix in an import directive
*/
- bool isValidAsPrefix(SimpleIdentifier node) {
+ bool _isValidAsPrefix(SimpleIdentifier node) {
AstNode parent = node.parent;
if (parent is ImportDirective) {
return identical(parent.prefix, node);
@@ -6485,8 +6485,8 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param getterName the name of the getter being looked up
* @return the element representing the getter that was found
*/
- PropertyAccessorElement lookUpGetter(Expression target, Type2 type, String getterName) {
- type = resolveTypeParameter(type);
+ PropertyAccessorElement _lookUpGetter(Expression target, Type2 type, String getterName) {
+ type = _resolveTypeParameter(type);
if (type is InterfaceType) {
InterfaceType interfaceType = type;
PropertyAccessorElement accessor;
@@ -6498,7 +6498,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
if (accessor != null) {
return accessor;
}
- return lookUpGetterInInterfaces(interfaceType, false, getterName, new Set<ClassElement>());
+ return _lookUpGetterInInterfaces(interfaceType, false, getterName, new Set<ClassElement>());
}
return null;
}
@@ -6515,7 +6515,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* to prevent infinite recursion and to optimize the search
* @return the element representing the getter that was found
*/
- PropertyAccessorElement lookUpGetterInInterfaces(InterfaceType targetType, bool includeTargetType, String getterName, Set<ClassElement> visitedInterfaces) {
+ PropertyAccessorElement _lookUpGetterInInterfaces(InterfaceType targetType, bool includeTargetType, String getterName, Set<ClassElement> visitedInterfaces) {
// TODO(brianwilkerson) This isn't correct. Section 8.1.1 of the specification (titled
// "Inheritance and Overriding" under "Interfaces") describes a much more complex scheme for
// finding the inherited member. We need to follow that scheme. The code below should cover the
@@ -6532,13 +6532,13 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
}
for (InterfaceType interfaceType in targetType.interfaces) {
- PropertyAccessorElement getter = lookUpGetterInInterfaces(interfaceType, true, getterName, visitedInterfaces);
+ PropertyAccessorElement getter = _lookUpGetterInInterfaces(interfaceType, true, getterName, visitedInterfaces);
if (getter != null) {
return getter;
}
}
for (InterfaceType mixinType in targetType.mixins) {
- PropertyAccessorElement getter = lookUpGetterInInterfaces(mixinType, true, getterName, visitedInterfaces);
+ PropertyAccessorElement getter = _lookUpGetterInInterfaces(mixinType, true, getterName, visitedInterfaces);
if (getter != null) {
return getter;
}
@@ -6547,7 +6547,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
if (superclass == null) {
return null;
}
- return lookUpGetterInInterfaces(superclass, true, getterName, visitedInterfaces);
+ return _lookUpGetterInInterfaces(superclass, true, getterName, visitedInterfaces);
}
/**
@@ -6559,8 +6559,8 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param memberName the name of the method or getter being looked up
* @return the element representing the method or getter that was found
*/
- ExecutableElement lookupGetterOrMethod(Type2 type, String memberName) {
- type = resolveTypeParameter(type);
+ ExecutableElement _lookupGetterOrMethod(Type2 type, String memberName) {
+ type = _resolveTypeParameter(type);
if (type is InterfaceType) {
InterfaceType interfaceType = type;
ExecutableElement member = interfaceType.lookUpMethod(memberName, _definingLibrary);
@@ -6571,7 +6571,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
if (member != null) {
return member;
}
- return lookUpGetterOrMethodInInterfaces(interfaceType, false, memberName, new Set<ClassElement>());
+ return _lookUpGetterOrMethodInInterfaces(interfaceType, false, memberName, new Set<ClassElement>());
}
return null;
}
@@ -6588,7 +6588,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* to prevent infinite recursion and to optimize the search
* @return the element representing the method or getter that was found
*/
- ExecutableElement lookUpGetterOrMethodInInterfaces(InterfaceType targetType, bool includeTargetType, String memberName, Set<ClassElement> visitedInterfaces) {
+ ExecutableElement _lookUpGetterOrMethodInInterfaces(InterfaceType targetType, bool includeTargetType, String memberName, Set<ClassElement> visitedInterfaces) {
// TODO(brianwilkerson) This isn't correct. Section 8.1.1 of the specification (titled
// "Inheritance and Overriding" under "Interfaces") describes a much more complex scheme for
// finding the inherited member. We need to follow that scheme. The code below should cover the
@@ -6609,13 +6609,13 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
}
for (InterfaceType interfaceType in targetType.interfaces) {
- ExecutableElement member = lookUpGetterOrMethodInInterfaces(interfaceType, true, memberName, visitedInterfaces);
+ ExecutableElement member = _lookUpGetterOrMethodInInterfaces(interfaceType, true, memberName, visitedInterfaces);
if (member != null) {
return member;
}
}
for (InterfaceType mixinType in targetType.mixins) {
- ExecutableElement member = lookUpGetterOrMethodInInterfaces(mixinType, true, memberName, visitedInterfaces);
+ ExecutableElement member = _lookUpGetterOrMethodInInterfaces(mixinType, true, memberName, visitedInterfaces);
if (member != null) {
return member;
}
@@ -6624,7 +6624,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
if (superclass == null) {
return null;
}
- return lookUpGetterOrMethodInInterfaces(superclass, true, memberName, visitedInterfaces);
+ return _lookUpGetterOrMethodInInterfaces(superclass, true, memberName, visitedInterfaces);
}
/**
@@ -6634,7 +6634,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param labelNode the node representing the label being looked up
* @return the element corresponding to the given label node in the current scope
*/
- LabelElementImpl lookupLabel(AstNode parentNode, SimpleIdentifier labelNode) {
+ LabelElementImpl _lookupLabel(AstNode parentNode, SimpleIdentifier labelNode) {
LabelScope labelScope = _resolver.labelScope;
LabelElementImpl labelElement = null;
if (labelNode == null) {
@@ -6680,8 +6680,8 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param methodName the name of the method being looked up
* @return the element representing the method that was found
*/
- MethodElement lookUpMethod(Expression target, Type2 type, String methodName) {
- type = resolveTypeParameter(type);
+ MethodElement _lookUpMethod(Expression target, Type2 type, String methodName) {
+ type = _resolveTypeParameter(type);
if (type is InterfaceType) {
InterfaceType interfaceType = type;
MethodElement method;
@@ -6693,7 +6693,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
if (method != null) {
return method;
}
- return lookUpMethodInInterfaces(interfaceType, false, methodName, new Set<ClassElement>());
+ return _lookUpMethodInInterfaces(interfaceType, false, methodName, new Set<ClassElement>());
}
return null;
}
@@ -6710,7 +6710,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* to prevent infinite recursion and to optimize the search
* @return the element representing the method that was found
*/
- MethodElement lookUpMethodInInterfaces(InterfaceType targetType, bool includeTargetType, String methodName, Set<ClassElement> visitedInterfaces) {
+ MethodElement _lookUpMethodInInterfaces(InterfaceType targetType, bool includeTargetType, String methodName, Set<ClassElement> visitedInterfaces) {
// TODO(brianwilkerson) This isn't correct. Section 8.1.1 of the specification (titled
// "Inheritance and Overriding" under "Interfaces") describes a much more complex scheme for
// finding the inherited member. We need to follow that scheme. The code below should cover the
@@ -6727,13 +6727,13 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
}
for (InterfaceType interfaceType in targetType.interfaces) {
- MethodElement method = lookUpMethodInInterfaces(interfaceType, true, methodName, visitedInterfaces);
+ MethodElement method = _lookUpMethodInInterfaces(interfaceType, true, methodName, visitedInterfaces);
if (method != null) {
return method;
}
}
for (InterfaceType mixinType in targetType.mixins) {
- MethodElement method = lookUpMethodInInterfaces(mixinType, true, methodName, visitedInterfaces);
+ MethodElement method = _lookUpMethodInInterfaces(mixinType, true, methodName, visitedInterfaces);
if (method != null) {
return method;
}
@@ -6742,7 +6742,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
if (superclass == null) {
return null;
}
- return lookUpMethodInInterfaces(superclass, true, methodName, visitedInterfaces);
+ return _lookUpMethodInInterfaces(superclass, true, methodName, visitedInterfaces);
}
/**
@@ -6754,8 +6754,8 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param setterName the name of the setter being looked up
* @return the element representing the setter that was found
*/
- PropertyAccessorElement lookUpSetter(Expression target, Type2 type, String setterName) {
- type = resolveTypeParameter(type);
+ PropertyAccessorElement _lookUpSetter(Expression target, Type2 type, String setterName) {
+ type = _resolveTypeParameter(type);
if (type is InterfaceType) {
InterfaceType interfaceType = type;
PropertyAccessorElement accessor;
@@ -6767,7 +6767,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
if (accessor != null) {
return accessor;
}
- return lookUpSetterInInterfaces(interfaceType, false, setterName, new Set<ClassElement>());
+ return _lookUpSetterInInterfaces(interfaceType, false, setterName, new Set<ClassElement>());
}
return null;
}
@@ -6784,7 +6784,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* to prevent infinite recursion and to optimize the search
* @return the element representing the setter that was found
*/
- PropertyAccessorElement lookUpSetterInInterfaces(InterfaceType targetType, bool includeTargetType, String setterName, Set<ClassElement> visitedInterfaces) {
+ PropertyAccessorElement _lookUpSetterInInterfaces(InterfaceType targetType, bool includeTargetType, String setterName, Set<ClassElement> visitedInterfaces) {
// TODO(brianwilkerson) This isn't correct. Section 8.1.1 of the specification (titled
// "Inheritance and Overriding" under "Interfaces") describes a much more complex scheme for
// finding the inherited member. We need to follow that scheme. The code below should cover the
@@ -6801,13 +6801,13 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
}
for (InterfaceType interfaceType in targetType.interfaces) {
- PropertyAccessorElement setter = lookUpSetterInInterfaces(interfaceType, true, setterName, visitedInterfaces);
+ PropertyAccessorElement setter = _lookUpSetterInInterfaces(interfaceType, true, setterName, visitedInterfaces);
if (setter != null) {
return setter;
}
}
for (InterfaceType mixinType in targetType.mixins) {
- PropertyAccessorElement setter = lookUpSetterInInterfaces(mixinType, true, setterName, visitedInterfaces);
+ PropertyAccessorElement setter = _lookUpSetterInInterfaces(mixinType, true, setterName, visitedInterfaces);
if (setter != null) {
return setter;
}
@@ -6816,7 +6816,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
if (superclass == null) {
return null;
}
- return lookUpSetterInInterfaces(superclass, true, setterName, visitedInterfaces);
+ return _lookUpSetterInInterfaces(superclass, true, setterName, visitedInterfaces);
}
/**
@@ -6832,7 +6832,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* the subtypes
* @return `true` if and only if the passed memberName was found in a subtype
*/
- bool memberFoundInSubclass(Element element, String memberName, bool asMethod, bool asAccessor) {
+ bool _memberFoundInSubclass(Element element, String memberName, bool asMethod, bool asAccessor) {
if (element is ClassElement) {
_subtypeManager.ensureLibraryVisited(_definingLibrary);
Set<ClassElement> subtypeElements = _subtypeManager.computeAllSubtypes(element);
@@ -6853,7 +6853,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param operator the assignment operator being mapped
* @return the binary operator that invoked by the given assignment operator
*/
- sc.TokenType operatorFromCompoundAssignment(sc.TokenType operator) {
+ sc.TokenType _operatorFromCompoundAssignment(sc.TokenType operator) {
while (true) {
if (operator == sc.TokenType.AMPERSAND_EQ) {
return sc.TokenType.AMPERSAND;
@@ -6886,14 +6886,14 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
}
- void resolveAnnotationConstructorInvocationArguments(Annotation annotation, ConstructorElement constructor) {
+ void _resolveAnnotationConstructorInvocationArguments(Annotation annotation, ConstructorElement constructor) {
ArgumentList argumentList = annotation.arguments;
// error will be reported in ConstantVerifier
if (argumentList == null) {
return;
}
// resolve arguments to parameters
- List<ParameterElement> parameters = resolveArgumentsToFunction(true, argumentList, constructor);
+ List<ParameterElement> parameters = _resolveArgumentsToFunction(true, argumentList, constructor);
if (parameters != null) {
argumentList.correspondingStaticParameters = parameters;
}
@@ -6904,7 +6904,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
*
* @param annotation the [Annotation] to resolve
*/
- void resolveAnnotationElement(Annotation annotation) {
+ void _resolveAnnotationElement(Annotation annotation) {
SimpleIdentifier nameNode1;
SimpleIdentifier nameNode2;
{
@@ -6927,7 +6927,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
Element element1 = nameNode1.staticElement;
// CONST
if (element1 is PropertyAccessorElement) {
- resolveAnnotationElementGetter(annotation, element1);
+ _resolveAnnotationElementGetter(annotation, element1);
return;
}
// Class(args)
@@ -6951,7 +6951,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
if (element2 is PropertyAccessorElement) {
nameNode2.staticElement = element2;
annotation.element = element2;
- resolveAnnotationElementGetter(annotation, element2 as PropertyAccessorElement);
+ _resolveAnnotationElementGetter(annotation, element2 as PropertyAccessorElement);
return;
}
// prefix.Class()
@@ -6980,7 +6980,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
if (getter != null) {
nameNode3.staticElement = getter;
annotation.element = element2;
- resolveAnnotationElementGetter(annotation, getter);
+ _resolveAnnotationElementGetter(annotation, getter);
return;
}
// prefix.Class.constructor(args)
@@ -6996,10 +6996,10 @@ class ElementResolver extends SimpleAstVisitor<Object> {
// record element
annotation.element = constructor;
// resolve arguments
- resolveAnnotationConstructorInvocationArguments(annotation, constructor);
+ _resolveAnnotationConstructorInvocationArguments(annotation, constructor);
}
- void resolveAnnotationElementGetter(Annotation annotation, PropertyAccessorElement accessorElement) {
+ void _resolveAnnotationElementGetter(Annotation annotation, PropertyAccessorElement accessorElement) {
// accessor should be synthetic
if (!accessorElement.isSynthetic) {
_resolver.reportErrorForNode(CompileTimeErrorCode.INVALID_ANNOTATION, annotation, []);
@@ -7025,12 +7025,12 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param executableElement the element that will be invoked with the arguments
* @return the parameters that correspond to the arguments
*/
- List<ParameterElement> resolveArgumentsToFunction(bool reportError, ArgumentList argumentList, ExecutableElement executableElement) {
+ List<ParameterElement> _resolveArgumentsToFunction(bool reportError, ArgumentList argumentList, ExecutableElement executableElement) {
if (executableElement == null) {
return null;
}
List<ParameterElement> parameters = executableElement.parameters;
- return resolveArgumentsToParameters(reportError, argumentList, parameters);
+ return _resolveArgumentsToParameters(reportError, argumentList, parameters);
}
/**
@@ -7044,7 +7044,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param parameters the of the function that will be invoked with the arguments
* @return the parameters that correspond to the arguments
*/
- List<ParameterElement> resolveArgumentsToParameters(bool reportError, ArgumentList argumentList, List<ParameterElement> parameters) {
+ List<ParameterElement> _resolveArgumentsToParameters(bool reportError, ArgumentList argumentList, List<ParameterElement> parameters) {
List<ParameterElement> requiredParameters = new List<ParameterElement>();
List<ParameterElement> positionalParameters = new List<ParameterElement>();
Map<String, ParameterElement> namedParameters = new Map<String, ParameterElement>();
@@ -7106,7 +7106,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param library the library that defines the names
* @param combinators the combinators containing the names to be resolved
*/
- void resolveCombinators(LibraryElement library, NodeList<Combinator> combinators) {
+ void _resolveCombinators(LibraryElement library, NodeList<Combinator> combinators) {
if (library == null) {
//
// The library will be null if the directive containing the combinators has a URI that is not
@@ -7138,7 +7138,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param classElement the class element
* @param nameNode the member name node
*/
- Element resolveElement(ClassElementImpl classElement, SimpleIdentifier nameNode) {
+ Element _resolveElement(ClassElementImpl classElement, SimpleIdentifier nameNode) {
String name = nameNode.name;
Element element = null;
element = classElement.getMethod(name);
@@ -7163,7 +7163,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param methodName the name of the method being invoked ('m')
* @return the element being invoked
*/
- Element resolveInvokedElement(SimpleIdentifier methodName) {
+ Element _resolveInvokedElement(SimpleIdentifier methodName) {
//
// Look first in the lexical scope.
//
@@ -7176,12 +7176,12 @@ class ElementResolver extends SimpleAstVisitor<Object> {
ClassElement enclosingClass = _resolver.enclosingClass;
if (enclosingClass != null) {
InterfaceType enclosingType = enclosingClass.type;
- element = lookUpMethod(null, enclosingType, methodName.name);
+ element = _lookUpMethod(null, enclosingType, methodName.name);
if (element == null) {
//
// If there's no method, then it's possible that 'm' is a getter that returns a function.
//
- element = lookUpGetter(null, enclosingType, methodName.name);
+ element = _lookUpGetter(null, enclosingType, methodName.name);
}
}
}
@@ -7200,15 +7200,15 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param methodName the name of the method being invoked ('m')
* @return the element being invoked
*/
- Element resolveInvokedElementWithTarget(Expression target, Type2 targetType, SimpleIdentifier methodName) {
+ Element _resolveInvokedElementWithTarget(Expression target, Type2 targetType, SimpleIdentifier methodName) {
if (targetType is InterfaceType) {
InterfaceType classType = targetType;
- Element element = lookUpMethod(target, classType, methodName.name);
+ Element element = _lookUpMethod(target, classType, methodName.name);
if (element == null) {
//
// If there's no method, then it's possible that 'm' is a getter that returns a function.
//
- element = lookUpGetter(target, classType, methodName.name);
+ element = _lookUpGetter(target, classType, methodName.name);
}
return element;
} else if (target is SimpleIdentifier) {
@@ -7241,23 +7241,23 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param propertyName the name of the property being accessed
* @return the element that represents the property
*/
- ExecutableElement resolveProperty(Expression target, Type2 targetType, SimpleIdentifier propertyName) {
+ ExecutableElement _resolveProperty(Expression target, Type2 targetType, SimpleIdentifier propertyName) {
ExecutableElement memberElement = null;
if (propertyName.inSetterContext()) {
- memberElement = lookUpSetter(target, targetType, propertyName.name);
+ memberElement = _lookUpSetter(target, targetType, propertyName.name);
}
if (memberElement == null) {
- memberElement = lookUpGetter(target, targetType, propertyName.name);
+ memberElement = _lookUpGetter(target, targetType, propertyName.name);
}
if (memberElement == null) {
- memberElement = lookUpMethod(target, targetType, propertyName.name);
+ memberElement = _lookUpMethod(target, targetType, propertyName.name);
}
return memberElement;
}
- void resolvePropertyAccess(Expression target, SimpleIdentifier propertyName) {
- Type2 staticType = getStaticType(target);
- Type2 propagatedType = getPropagatedType(target);
+ void _resolvePropertyAccess(Expression target, SimpleIdentifier propertyName) {
+ Type2 staticType = _getStaticType(target);
+ Type2 propagatedType = _getPropagatedType(target);
Element staticElement = null;
Element propagatedElement = null;
//
@@ -7267,10 +7267,10 @@ class ElementResolver extends SimpleAstVisitor<Object> {
//
ClassElementImpl typeReference = getTypeReference(target);
if (typeReference != null) {
- staticElement = propagatedElement = resolveElement(typeReference, propertyName);
+ staticElement = propagatedElement = _resolveElement(typeReference, propertyName);
} else {
- staticElement = resolveProperty(target, staticType, propertyName);
- propagatedElement = resolveProperty(target, propagatedType, propertyName);
+ staticElement = _resolveProperty(target, staticType, propertyName);
+ propagatedElement = _resolveProperty(target, propagatedType, propertyName);
}
// May be part of annotation, record property element only if exists.
// Error was already reported in validateAnnotationElement().
@@ -7282,12 +7282,12 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
propertyName.staticElement = staticElement;
propertyName.propagatedElement = propagatedElement;
- bool shouldReportMissingMember_static = shouldReportMissingMember(staticType, staticElement);
- bool shouldReportMissingMember_propagated = !shouldReportMissingMember_static && _enableHints ? shouldReportMissingMember(propagatedType, propagatedElement) : false;
+ bool shouldReportMissingMember_static = _shouldReportMissingMember(staticType, staticElement);
+ bool shouldReportMissingMember_propagated = !shouldReportMissingMember_static && _enableHints ? _shouldReportMissingMember(propagatedType, propagatedElement) : false;
// If we are about to generate the hint (propagated version of this warning), then check
// that the member is not in a subtype of the propagated type.
if (shouldReportMissingMember_propagated) {
- if (memberFoundInSubclass(propagatedType.element, propertyName.name, false, true)) {
+ if (_memberFoundInSubclass(propagatedType.element, propertyName.name, false, true)) {
shouldReportMissingMember_propagated = false;
}
}
@@ -7305,7 +7305,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
}
Element staticOrPropagatedEnclosingElt = shouldReportMissingMember_static ? staticType.element : propagatedType.element;
if (staticOrPropagatedEnclosingElt != null) {
- bool isStaticProperty = isStatic(staticOrPropagatedEnclosingElt);
+ bool isStaticProperty = _isStatic(staticOrPropagatedEnclosingElt);
if (propertyName.inSetterContext()) {
if (isStaticProperty) {
ErrorCode errorCode = (shouldReportMissingMember_static ? StaticWarningCode.UNDEFINED_SETTER : HintCode.UNDEFINED_SETTER) as ErrorCode;
@@ -7345,7 +7345,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param node the identifier to be resolved
* @return the element to which the identifier could be resolved
*/
- Element resolveSimpleIdentifier(SimpleIdentifier node) {
+ Element _resolveSimpleIdentifier(SimpleIdentifier node) {
Element element = _resolver.nameScope.lookup(node, _definingLibrary);
if (element is PropertyAccessorElement && node.inSetterContext()) {
PropertyInducingElement variable = (element as PropertyAccessorElement).variable;
@@ -7357,7 +7357,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
//
ClassElement enclosingClass = _resolver.enclosingClass;
if (enclosingClass != null) {
- setter = lookUpSetter(null, enclosingClass.type, node.name);
+ setter = _lookUpSetter(null, enclosingClass.type, node.name);
}
}
if (setter != null) {
@@ -7371,13 +7371,13 @@ class ElementResolver extends SimpleAstVisitor<Object> {
if (element == null && enclosingClass != null) {
InterfaceType enclosingType = enclosingClass.type;
if (element == null && node.inSetterContext()) {
- element = lookUpSetter(null, enclosingType, node.name);
+ element = _lookUpSetter(null, enclosingType, node.name);
}
if (element == null && node.inGetterContext()) {
- element = lookUpGetter(null, enclosingType, node.name);
+ element = _lookUpGetter(null, enclosingType, node.name);
}
if (element == null) {
- element = lookUpMethod(null, enclosingType, node.name);
+ element = _lookUpMethod(null, enclosingType, node.name);
}
}
return element;
@@ -7391,7 +7391,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @return the type that should be used in place of the argument if it is a type parameter, or the
* original argument if it isn't a type parameter
*/
- Type2 resolveTypeParameter(Type2 type) {
+ Type2 _resolveTypeParameter(Type2 type) {
if (type is TypeParameterType) {
Type2 bound = type.element.bound;
if (bound == null) {
@@ -7410,21 +7410,21 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param element the element to which the node has been resolved
* @param node the node that can have annotations associated with it
*/
- void setMetadata(Element element, AnnotatedNode node) {
+ void _setMetadata(Element element, AnnotatedNode node) {
if (element is! ElementImpl) {
return;
}
List<ElementAnnotationImpl> annotationList = new List<ElementAnnotationImpl>();
- addAnnotations(annotationList, node.metadata);
+ _addAnnotations(annotationList, node.metadata);
if (node is VariableDeclaration && node.parent is VariableDeclarationList) {
VariableDeclarationList list = node.parent as VariableDeclarationList;
- addAnnotations(annotationList, list.metadata);
+ _addAnnotations(annotationList, list.metadata);
if (list.parent is FieldDeclaration) {
FieldDeclaration fieldDeclaration = list.parent as FieldDeclaration;
- addAnnotations(annotationList, fieldDeclaration.metadata);
+ _addAnnotations(annotationList, fieldDeclaration.metadata);
} else if (list.parent is TopLevelVariableDeclaration) {
TopLevelVariableDeclaration variableDeclaration = list.parent as TopLevelVariableDeclaration;
- addAnnotations(annotationList, variableDeclaration.metadata);
+ _addAnnotations(annotationList, variableDeclaration.metadata);
}
}
if (!annotationList.isEmpty) {
@@ -7440,12 +7440,12 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param element the element to which the node has been resolved
* @param node the node that can have annotations associated with it
*/
- void setMetadataForParameter(Element element, NormalFormalParameter node) {
+ void _setMetadataForParameter(Element element, NormalFormalParameter node) {
if (element is! ElementImpl) {
return;
}
List<ElementAnnotationImpl> annotationList = new List<ElementAnnotationImpl>();
- addAnnotations(annotationList, node.metadata);
+ _addAnnotations(annotationList, node.metadata);
if (!annotationList.isEmpty) {
(element as ElementImpl).metadata = new List.from(annotationList);
}
@@ -7459,7 +7459,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* @param member the result of the look-up
* @return `true` if we should report an error
*/
- bool shouldReportMissingMember(Type2 type, Element member) {
+ bool _shouldReportMissingMember(Type2 type, Element member) {
if (member != null || type == null || type.isDynamic || type.isBottom) {
return false;
}
@@ -7554,14 +7554,14 @@ class IncrementalResolver {
* @throws AnalysisException if the node could not be resolved
*/
void resolve(AstNode node) {
- AstNode rootNode = findResolutionRoot(node);
+ AstNode rootNode = _findResolutionRoot(node);
Scope scope = ScopeBuilder.scopeFor(rootNode, _errorListener);
- if (elementModelChanged(rootNode.parent)) {
+ if (_elementModelChanged(rootNode.parent)) {
throw new AnalysisException.con1("Cannot resolve node: element model changed");
}
- resolveTypes(node, scope);
- resolveVariables(node, scope);
- resolveReferences(node, scope);
+ _resolveTypes(node, scope);
+ _resolveVariables(node, scope);
+ _resolveReferences(node, scope);
}
/**
@@ -7572,7 +7572,7 @@ class IncrementalResolver {
* @param node the node being tested
* @return `true` if the given node can be resolved independently of any other nodes
*/
- bool canBeResolved(AstNode node) => node is ClassDeclaration || node is ClassTypeAlias || node is CompilationUnit || node is ConstructorDeclaration || node is FunctionDeclaration || node is FunctionTypeAlias || node is MethodDeclaration;
+ bool _canBeResolved(AstNode node) => node is ClassDeclaration || node is ClassTypeAlias || node is CompilationUnit || node is ConstructorDeclaration || node is FunctionDeclaration || node is FunctionTypeAlias || node is MethodDeclaration;
/**
* Return `true` if the portion of the element model defined by the given node has changed.
@@ -7581,8 +7581,8 @@ class IncrementalResolver {
* @return `true` if the element model defined by the given node has changed
* @throws AnalysisException if the correctness of the element model cannot be determined
*/
- bool elementModelChanged(AstNode node) {
- Element element = getElement(node);
+ bool _elementModelChanged(AstNode node) {
+ Element element = _getElement(node);
if (element == null) {
throw new AnalysisException.con1("Cannot resolve node: a ${node.runtimeType.toString()} does not define an element");
}
@@ -7598,10 +7598,10 @@ class IncrementalResolver {
* @return the smallest AST node that can be resolved independently of any other nodes
* @throws AnalysisException if there is no such node
*/
- AstNode findResolutionRoot(AstNode node) {
+ AstNode _findResolutionRoot(AstNode node) {
AstNode result = node;
AstNode parent = result.parent;
- while (parent != null && !canBeResolved(parent)) {
+ while (parent != null && !_canBeResolved(parent)) {
result = parent;
parent = result.parent;
}
@@ -7618,7 +7618,7 @@ class IncrementalResolver {
* @param node the node defining the element to be returned
* @return the element defined by the given node
*/
- Element getElement(AstNode node) {
+ Element _getElement(AstNode node) {
if (node is Declaration) {
return node.element;
} else if (node is CompilationUnit) {
@@ -7627,7 +7627,7 @@ class IncrementalResolver {
return null;
}
- void resolveReferences(AstNode node, Scope scope) {
+ void _resolveReferences(AstNode node, Scope scope) {
ResolverVisitor visitor = new ResolverVisitor.con3(_definingLibrary, _source, _typeProvider, scope, _errorListener);
node.accept(visitor);
for (ProxyConditionalAnalysisError conditionalCode in visitor.proxyConditionalAnalysisErrors) {
@@ -7637,12 +7637,12 @@ class IncrementalResolver {
}
}
- void resolveTypes(AstNode node, Scope scope) {
+ void _resolveTypes(AstNode node, Scope scope) {
TypeResolverVisitor visitor = new TypeResolverVisitor.con3(_definingLibrary, _source, _typeProvider, scope, _errorListener);
node.accept(visitor);
}
- void resolveVariables(AstNode node, Scope scope) {
+ void _resolveVariables(AstNode node, Scope scope) {
VariableResolverVisitor visitor = new VariableResolverVisitor.con2(_definingLibrary, _source, _typeProvider, scope, _errorListener);
node.accept(visitor);
}
@@ -7662,26 +7662,26 @@ class InheritanceManager {
* TODO (jwren) Associate a propagated type to the synthetic method element using least upper
* bound calls
*/
- static ExecutableElement computeMergedExecutableElement(List<ExecutableElement> elementArrayToMerge) {
- int h = getNumOfPositionalParameters(elementArrayToMerge[0]);
- int r = getNumOfRequiredParameters(elementArrayToMerge[0]);
+ static ExecutableElement _computeMergedExecutableElement(List<ExecutableElement> elementArrayToMerge) {
+ int h = _getNumOfPositionalParameters(elementArrayToMerge[0]);
+ int r = _getNumOfRequiredParameters(elementArrayToMerge[0]);
Set<String> namedParametersList = new Set<String>();
for (int i = 1; i < elementArrayToMerge.length; i++) {
ExecutableElement element = elementArrayToMerge[i];
- int numOfPositionalParams = getNumOfPositionalParameters(element);
+ int numOfPositionalParams = _getNumOfPositionalParameters(element);
if (h < numOfPositionalParams) {
h = numOfPositionalParams;
}
- int numOfRequiredParams = getNumOfRequiredParameters(element);
+ int numOfRequiredParams = _getNumOfRequiredParameters(element);
if (r > numOfRequiredParams) {
r = numOfRequiredParams;
}
- namedParametersList.addAll(getNamedParameterNames(element));
+ namedParametersList.addAll(_getNamedParameterNames(element));
}
if (r > h) {
return null;
}
- return createSyntheticExecutableElement(elementArrayToMerge, elementArrayToMerge[0].displayName, r, h - r, new List.from(namedParametersList));
+ return _createSyntheticExecutableElement(elementArrayToMerge, elementArrayToMerge[0].displayName, r, h - r, new List.from(namedParametersList));
}
/**
@@ -7695,7 +7695,7 @@ class InheritanceManager {
* @param namedParameters the list of [String]s that are the named parameters
* @return the created synthetic element
*/
- static ExecutableElement createSyntheticExecutableElement(List<ExecutableElement> elementArrayToMerge, String name, int numOfRequiredParameters, int numOfPositionalParameters, List<String> namedParameters) {
+ static ExecutableElement _createSyntheticExecutableElement(List<ExecutableElement> elementArrayToMerge, String name, int numOfRequiredParameters, int numOfPositionalParameters, List<String> namedParameters) {
DynamicTypeImpl dynamicType = DynamicTypeImpl.instance;
SimpleIdentifier nameIdentifier = new SimpleIdentifier(new sc.StringToken(sc.TokenType.IDENTIFIER, name, 0));
ExecutableElementImpl executable;
@@ -7741,7 +7741,7 @@ class InheritanceManager {
/**
* Given some [ExecutableElement], return the list of named parameters.
*/
- static List<String> getNamedParameterNames(ExecutableElement executableElement) {
+ static List<String> _getNamedParameterNames(ExecutableElement executableElement) {
List<String> namedParameterNames = new List<String>();
List<ParameterElement> parameters = executableElement.parameters;
for (int i = 0; i < parameters.length; i++) {
@@ -7756,7 +7756,7 @@ class InheritanceManager {
/**
* Given some [ExecutableElement] return the number of parameters of the specified kind.
*/
- static int getNumOfParameters(ExecutableElement executableElement, ParameterKind parameterKind) {
+ static int _getNumOfParameters(ExecutableElement executableElement, ParameterKind parameterKind) {
int parameterCount = 0;
List<ParameterElement> parameters = executableElement.parameters;
for (int i = 0; i < parameters.length; i++) {
@@ -7773,12 +7773,12 @@ class InheritanceManager {
*
* Note: by positional we mean [ParameterKind#REQUIRED] or [ParameterKind#POSITIONAL].
*/
- static int getNumOfPositionalParameters(ExecutableElement executableElement) => getNumOfParameters(executableElement, ParameterKind.REQUIRED) + getNumOfParameters(executableElement, ParameterKind.POSITIONAL);
+ static int _getNumOfPositionalParameters(ExecutableElement executableElement) => _getNumOfParameters(executableElement, ParameterKind.REQUIRED) + _getNumOfParameters(executableElement, ParameterKind.POSITIONAL);
/**
* Given some [ExecutableElement] return the number of required parameters.
*/
- static int getNumOfRequiredParameters(ExecutableElement executableElement) => getNumOfParameters(executableElement, ParameterKind.REQUIRED);
+ static int _getNumOfRequiredParameters(ExecutableElement executableElement) => _getNumOfParameters(executableElement, ParameterKind.REQUIRED);
/**
* Given some [ExecutableElement] returns `true` if it is an abstract member of a
@@ -7787,7 +7787,7 @@ class InheritanceManager {
* @param executableElement some [ExecutableElement] to evaluate
* @return `true` if the given element is an abstract member of a class
*/
- static bool isAbstract(ExecutableElement executableElement) {
+ static bool _isAbstract(ExecutableElement executableElement) {
if (executableElement is MethodElement) {
return executableElement.isAbstract;
} else if (executableElement is PropertyAccessorElement) {
@@ -7848,7 +7848,7 @@ class InheritanceManager {
* @return a mapping between the set of all members inherited from the passed [ClassElement]
* superclass hierarchy, and the associated [ExecutableElement]
*/
- MemberMap getMapOfMembersInheritedFromClasses(ClassElement classElt) => computeClassChainLookupMap(classElt, new Set<ClassElement>());
+ MemberMap getMapOfMembersInheritedFromClasses(ClassElement classElt) => _computeClassChainLookupMap(classElt, new Set<ClassElement>());
/**
* Get and return a mapping between the set of all string names of the members inherited from the
@@ -7858,7 +7858,7 @@ class InheritanceManager {
* @return a mapping between the set of all string names of the members inherited from the passed
* [ClassElement] interface hierarchy, and the associated [ExecutableElement].
*/
- MemberMap getMapOfMembersInheritedFromInterfaces(ClassElement classElt) => computeInterfaceLookupMap(classElt, new Set<ClassElement>());
+ MemberMap getMapOfMembersInheritedFromInterfaces(ClassElement classElt) => _computeInterfaceLookupMap(classElt, new Set<ClassElement>());
/**
* Given some [ClassElement] and some member name, this returns the
@@ -7875,9 +7875,9 @@ class InheritanceManager {
if (memberName == null || memberName.isEmpty) {
return null;
}
- ExecutableElement executable = computeClassChainLookupMap(classElt, new Set<ClassElement>()).get(memberName);
+ ExecutableElement executable = _computeClassChainLookupMap(classElt, new Set<ClassElement>()).get(memberName);
if (executable == null) {
- return computeInterfaceLookupMap(classElt, new Set<ClassElement>()).get(memberName);
+ return _computeInterfaceLookupMap(classElt, new Set<ClassElement>()).get(memberName);
}
return executable;
}
@@ -7893,7 +7893,7 @@ class InheritanceManager {
* member exists
*/
ExecutableElement lookupMember(ClassElement classElt, String memberName) {
- ExecutableElement element = lookupMemberInClass(classElt, memberName);
+ ExecutableElement element = _lookupMemberInClass(classElt, memberName);
if (element != null) {
return element;
}
@@ -7944,7 +7944,7 @@ class InheritanceManager {
}
// First, generate the path from the defining type to the overridden member
Queue<InterfaceType> inheritancePath = new Queue<InterfaceType>();
- computeInheritancePath(inheritancePath, definingType, memberName);
+ _computeInheritancePath(inheritancePath, definingType, memberName);
if (inheritancePath == null || inheritancePath.isEmpty) {
// TODO(jwren) log analysis engine error
return baseFunctionType;
@@ -7971,7 +7971,7 @@ class InheritanceManager {
* @return a mapping between the set of all string names of the members inherited from the passed
* [ClassElement] superclass hierarchy, and the associated [ExecutableElement]
*/
- MemberMap computeClassChainLookupMap(ClassElement classElt, Set<ClassElement> visitedClasses) {
+ MemberMap _computeClassChainLookupMap(ClassElement classElt, Set<ClassElement> visitedClasses) {
MemberMap resultMap = _classLookup[classElt];
if (resultMap != null) {
return resultMap;
@@ -7991,15 +7991,15 @@ class InheritanceManager {
if (!visitedClasses.contains(superclassElt)) {
visitedClasses.add(superclassElt);
try {
- resultMap = new MemberMap.con2(computeClassChainLookupMap(superclassElt, visitedClasses));
+ resultMap = new MemberMap.con2(_computeClassChainLookupMap(superclassElt, visitedClasses));
//
// Substitute the super types down the hierarchy.
//
- substituteTypeParametersDownHierarchy(supertype, resultMap);
+ _substituteTypeParametersDownHierarchy(supertype, resultMap);
//
// Include the members from the superclass in the resultMap.
//
- recordMapWithClassMembers(resultMap, supertype, false);
+ _recordMapWithClassMembers(resultMap, supertype, false);
} finally {
visitedClasses.remove(superclassElt);
}
@@ -8020,15 +8020,15 @@ class InheritanceManager {
if (!visitedClasses.contains(mixinElement)) {
visitedClasses.add(mixinElement);
try {
- MemberMap map = new MemberMap.con2(computeClassChainLookupMap(mixinElement, visitedClasses));
+ MemberMap map = new MemberMap.con2(_computeClassChainLookupMap(mixinElement, visitedClasses));
//
// Substitute the super types down the hierarchy.
//
- substituteTypeParametersDownHierarchy(mixins[i], map);
+ _substituteTypeParametersDownHierarchy(mixins[i], map);
//
// Include the members from the superclass in the resultMap.
//
- recordMapWithClassMembers(map, mixins[i], false);
+ _recordMapWithClassMembers(map, mixins[i], false);
//
// Add the members from map into result map.
//
@@ -8036,7 +8036,7 @@ class InheritanceManager {
String key = map.getKey(j);
ExecutableElement value = map.getValue(j);
if (key != null) {
- if (resultMap.get(key) == null || (resultMap.get(key) != null && !isAbstract(value))) {
+ if (resultMap.get(key) == null || (resultMap.get(key) != null && !_isAbstract(value))) {
resultMap.put(key, value);
}
}
@@ -8065,7 +8065,7 @@ class InheritanceManager {
* @param currentType the current type in the inheritance path
* @param memberName the name of the member that is being looked up the inheritance path
*/
- void computeInheritancePath(Queue<InterfaceType> chain, InterfaceType currentType, String memberName) {
+ void _computeInheritancePath(Queue<InterfaceType> chain, InterfaceType currentType, String memberName) {
// TODO (jwren) create a public version of this method which doesn't require the initial chain
// to be provided, then provided tests for this functionality in InheritanceManagerTest
chain.add(currentType);
@@ -8081,7 +8081,7 @@ class InheritanceManager {
// We are not done if this is the first recursive call on this method.
if (chain.length != 1) {
// We are done however if the member is in this classElt
- if (lookupMemberInClass(classElt, memberName) != null) {
+ if (_lookupMemberInClass(classElt, memberName) != null) {
return;
}
}
@@ -8090,7 +8090,7 @@ class InheritanceManager {
for (int i = mixins.length - 1; i >= 0; i--) {
ClassElement mixinElement = mixins[i].element;
if (mixinElement != null) {
- ExecutableElement elt = lookupMemberInClass(mixinElement, memberName);
+ ExecutableElement elt = _lookupMemberInClass(mixinElement, memberName);
if (elt != null) {
// this is equivalent (but faster than) calling this method recursively
// (return computeInheritancePath(chain, mixins[i], memberName);)
@@ -8102,7 +8102,7 @@ class InheritanceManager {
// Superclass
ClassElement superclassElt = supertype.element;
if (lookupMember(superclassElt, memberName) != null) {
- computeInheritancePath(chain, supertype, memberName);
+ _computeInheritancePath(chain, supertype, memberName);
return;
}
// Interfaces
@@ -8110,7 +8110,7 @@ class InheritanceManager {
for (InterfaceType interfaceType in interfaces) {
ClassElement interfaceElement = interfaceType.element;
if (interfaceElement != null && lookupMember(interfaceElement, memberName) != null) {
- computeInheritancePath(chain, interfaceType, memberName);
+ _computeInheritancePath(chain, interfaceType, memberName);
return;
}
}
@@ -8127,7 +8127,7 @@ class InheritanceManager {
* @return a mapping between the set of all string names of the members inherited from the passed
* [ClassElement] interface hierarchy, and the associated [ExecutableElement]
*/
- MemberMap computeInterfaceLookupMap(ClassElement classElt, Set<ClassElement> visitedInterfaces) {
+ MemberMap _computeInterfaceLookupMap(ClassElement classElt, Set<ClassElement> visitedInterfaces) {
MemberMap resultMap = _interfaceLookup[classElt];
if (resultMap != null) {
return resultMap;
@@ -8150,16 +8150,16 @@ class InheritanceManager {
//
// Recursively compute the map for the super type.
//
- MemberMap map = computeInterfaceLookupMap(superclassElement, visitedInterfaces);
+ MemberMap map = _computeInterfaceLookupMap(superclassElement, visitedInterfaces);
map = new MemberMap.con2(map);
//
// Substitute the super type down the hierarchy.
//
- substituteTypeParametersDownHierarchy(supertype, map);
+ _substituteTypeParametersDownHierarchy(supertype, map);
//
// Add any members from the super type into the map as well.
//
- recordMapWithClassMembers(map, supertype, true);
+ _recordMapWithClassMembers(map, supertype, true);
lookupMaps.add(map);
} finally {
visitedInterfaces.remove(superclassElement);
@@ -8187,16 +8187,16 @@ class InheritanceManager {
//
// Recursively compute the map for the mixin.
//
- MemberMap map = computeInterfaceLookupMap(mixinElement, visitedInterfaces);
+ MemberMap map = _computeInterfaceLookupMap(mixinElement, visitedInterfaces);
map = new MemberMap.con2(map);
//
// Substitute the mixin type down the hierarchy.
//
- substituteTypeParametersDownHierarchy(mixinType, map);
+ _substituteTypeParametersDownHierarchy(mixinType, map);
//
// Add any members from the mixin type into the map as well.
//
- recordMapWithClassMembers(map, mixinType, true);
+ _recordMapWithClassMembers(map, mixinType, true);
lookupMaps.add(map);
} finally {
visitedInterfaces.remove(mixinElement);
@@ -8224,16 +8224,16 @@ class InheritanceManager {
//
// Recursively compute the map for the interfaces.
//
- MemberMap map = computeInterfaceLookupMap(interfaceElement, visitedInterfaces);
+ MemberMap map = _computeInterfaceLookupMap(interfaceElement, visitedInterfaces);
map = new MemberMap.con2(map);
//
// Substitute the supertypes down the hierarchy
//
- substituteTypeParametersDownHierarchy(interfaceType, map);
+ _substituteTypeParametersDownHierarchy(interfaceType, map);
//
// And add any members from the interface into the map as well.
//
- recordMapWithClassMembers(map, interfaceType, true);
+ _recordMapWithClassMembers(map, interfaceType, true);
lookupMaps.add(map);
} finally {
visitedInterfaces.remove(interfaceElement);
@@ -8386,7 +8386,7 @@ class InheritanceManager {
// of the other, we create a warning, and have this class inherit nothing.
//
String firstTwoFuntionTypesStr = "${executableElementTypes[0].toString()}, ${executableElementTypes[1].toString()}";
- reportError(classElt, classElt.nameOffset, classElt.displayName.length, StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE, [key, firstTwoFuntionTypesStr]);
+ _reportError(classElt, classElt.nameOffset, classElt.displayName.length, StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE, [key, firstTwoFuntionTypesStr]);
} else {
//
// Example: class A inherits 2 methods named 'm'. One has the function type
@@ -8399,14 +8399,14 @@ class InheritanceManager {
for (int i = 0; i < elementArrayToMerge.length; i++) {
elementArrayToMerge[i] = elements[subtypesOfAllOtherTypesIndexes[i]];
}
- ExecutableElement mergedExecutableElement = computeMergedExecutableElement(elementArrayToMerge);
+ ExecutableElement mergedExecutableElement = _computeMergedExecutableElement(elementArrayToMerge);
if (mergedExecutableElement != null) {
resultMap.put(key, mergedExecutableElement);
}
}
}
} else {
- reportError(classElt, classElt.nameOffset, classElt.displayName.length, StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD, [key]);
+ _reportError(classElt, classElt.nameOffset, classElt.displayName.length, StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD, [key]);
}
}
}
@@ -8423,7 +8423,7 @@ class InheritanceManager {
* @param memberName the name of the member to lookup in the class
* @return the found [ExecutableElement], or `null` if no such member was found
*/
- ExecutableElement lookupMemberInClass(ClassElement classElt, String memberName) {
+ ExecutableElement _lookupMemberInClass(ClassElement classElt, String memberName) {
List<MethodElement> methods = classElt.methods;
for (MethodElement method in methods) {
if (memberName == method.name && method.isAccessibleIn(_library) && !method.isStatic) {
@@ -8448,7 +8448,7 @@ class InheritanceManager {
* @param type the type that will be recorded into the passed map
* @param doIncludeAbstract `true` if abstract members will be put into the map
*/
- void recordMapWithClassMembers(MemberMap map, InterfaceType type, bool doIncludeAbstract) {
+ void _recordMapWithClassMembers(MemberMap map, InterfaceType type, bool doIncludeAbstract) {
List<MethodElement> methods = type.methods;
for (MethodElement method in methods) {
if (method.isAccessibleIn(_library) && !method.isStatic && (doIncludeAbstract || !method.isAbstract)) {
@@ -8474,7 +8474,7 @@ class InheritanceManager {
* @param errorCode the error code to be associated with this error
* @param arguments the arguments used to build the error message
*/
- void reportError(ClassElement classElt, int offset, int length, ErrorCode errorCode, List<Object> arguments) {
+ void _reportError(ClassElement classElt, int offset, int length, ErrorCode errorCode, List<Object> arguments) {
Set<AnalysisError> errorSet = _errorsInClassElement[classElt];
if (errorSet == null) {
errorSet = new Set<AnalysisError>();
@@ -8490,7 +8490,7 @@ class InheritanceManager {
* @param superType the supertype to substitute into the members of the [MemberMap]
* @param map the MemberMap to perform the substitutions on
*/
- void substituteTypeParametersDownHierarchy(InterfaceType superType, MemberMap map) {
+ void _substituteTypeParametersDownHierarchy(InterfaceType superType, MemberMap map) {
for (int i = 0; i < map.size; i++) {
ExecutableElement executableElement = map.getValue(i);
if (executableElement is MethodMember) {
@@ -8855,7 +8855,7 @@ class LibraryElementBuilder {
NodeList<Directive> directives = definingCompilationUnit.directives;
LibraryIdentifier libraryNameNode = null;
bool hasPartDirective = false;
- FunctionElement entryPoint = findEntryPoint(definingCompilationUnitElement);
+ FunctionElement entryPoint = _findEntryPoint(definingCompilationUnitElement);
List<Directive> directivesToResolve = new List<Directive>();
List<CompilationUnitElementImpl> sourcedCompilationUnits = new List<CompilationUnitElementImpl>();
for (Directive directive in directives) {
@@ -8881,7 +8881,7 @@ class LibraryElementBuilder {
//
// Validate that the part contains a part-of directive with the same name as the library.
//
- String partLibraryName = getPartLibraryName(library, partSource, directivesToResolve);
+ String partLibraryName = _getPartLibraryName(library, partSource, directivesToResolve);
if (partLibraryName == null) {
_errorListener.onError(new AnalysisError.con2(librarySource, partUri.offset, partUri.length, CompileTimeErrorCode.PART_OF_NON_PART, [partUri.toSource()]));
} else if (libraryNameNode == null) {
@@ -8889,7 +8889,7 @@ class LibraryElementBuilder {
_errorListener.onError(new AnalysisError.con2(librarySource, partUri.offset, partUri.length, StaticWarningCode.PART_OF_DIFFERENT_LIBRARY, [libraryNameNode.name, partLibraryName]));
}
if (entryPoint == null) {
- entryPoint = findEntryPoint(part);
+ entryPoint = _findEntryPoint(part);
}
directive.element = part;
sourcedCompilationUnits.add(part);
@@ -8914,7 +8914,7 @@ class LibraryElementBuilder {
}
library.libraryElement = libraryElement;
if (sourcedUnitCount > 0) {
- patchTopLevelAccessors(libraryElement);
+ _patchTopLevelAccessors(libraryElement);
}
return libraryElement;
}
@@ -8927,7 +8927,7 @@ class LibraryElementBuilder {
* @param setters the list to which setters are to be added
* @param unit the compilation unit defining the accessors that are potentially being added
*/
- void collectAccessors(Map<String, PropertyAccessorElement> getters, List<PropertyAccessorElement> setters, CompilationUnitElement unit) {
+ void _collectAccessors(Map<String, PropertyAccessorElement> getters, List<PropertyAccessorElement> setters, CompilationUnitElement unit) {
for (PropertyAccessorElement accessor in unit.accessors) {
if (accessor.isGetter) {
if (!accessor.isSynthetic && accessor.correspondingSetter == null) {
@@ -8948,7 +8948,7 @@ class LibraryElementBuilder {
* @return the entry point that was found, or `null` if the compilation unit does not define
* an entry point
*/
- FunctionElement findEntryPoint(CompilationUnitElementImpl element) {
+ FunctionElement _findEntryPoint(CompilationUnitElementImpl element) {
for (FunctionElement function in element.functions) {
if (function.name == ENTRY_POINT_NAME) {
return function;
@@ -8967,7 +8967,7 @@ class LibraryElementBuilder {
* built
* @return the name of the library that the given part is declared to be a part of
*/
- String getPartLibraryName(Library library, Source partSource, List<Directive> directivesToResolve) {
+ String _getPartLibraryName(Library library, Source partSource, List<Directive> directivesToResolve) {
try {
CompilationUnit partUnit = library.getAST(partSource);
for (Directive directive in partUnit.directives) {
@@ -8991,12 +8991,12 @@ class LibraryElementBuilder {
*
* @param libraryElement the library defining the compilation units to be processed
*/
- void patchTopLevelAccessors(LibraryElementImpl libraryElement) {
+ void _patchTopLevelAccessors(LibraryElementImpl libraryElement) {
Map<String, PropertyAccessorElement> getters = new Map<String, PropertyAccessorElement>();
List<PropertyAccessorElement> setters = new List<PropertyAccessorElement>();
- collectAccessors(getters, setters, libraryElement.definingCompilationUnit);
+ _collectAccessors(getters, setters, libraryElement.definingCompilationUnit);
for (CompilationUnitElement unit in libraryElement.parts) {
- collectAccessors(getters, setters, unit);
+ _collectAccessors(getters, setters, unit);
}
for (PropertyAccessorElement setter in setters) {
PropertyAccessorElement getter = getters[setter.displayName];
@@ -9096,7 +9096,7 @@ class LibraryResolver {
//
// Create the objects representing the library being resolved and the core library.
//
- Library targetLibrary = createLibraryWithUnit(librarySource, modificationStamp, unit);
+ Library targetLibrary = _createLibraryWithUnit(librarySource, modificationStamp, unit);
_coreLibrary = _libraryMap[_coreLibrarySource];
if (_coreLibrary == null) {
// This will be true unless the library being analyzed is the core library.
@@ -9106,8 +9106,8 @@ class LibraryResolver {
//
// Compute the set of libraries that need to be resolved together.
//
- computeEmbeddedLibraryDependencies(targetLibrary, unit);
- _librariesInCycles = computeLibrariesInCycles(targetLibrary);
+ _computeEmbeddedLibraryDependencies(targetLibrary, unit);
+ _librariesInCycles = _computeLibrariesInCycles(targetLibrary);
//
// Build the element models representing the libraries being resolved. This is done in three
// steps:
@@ -9122,16 +9122,16 @@ class LibraryResolver {
// requires that we be able to compute the names visible in the libraries being resolved,
// which in turn requires that we have resolved the import directives.
//
- buildElementModels();
+ _buildElementModels();
instrumentation.metric3("buildElementModels", "complete");
LibraryElement coreElement = _coreLibrary.libraryElement;
if (coreElement == null) {
throw new AnalysisException.con1("Could not resolve dart:core");
}
- buildDirectiveModels();
+ _buildDirectiveModels();
instrumentation.metric3("buildDirectiveModels", "complete");
_typeProvider = new TypeProviderImpl(coreElement);
- buildTypeHierarchies();
+ _buildTypeHierarchies();
instrumentation.metric3("buildTypeHierarchies", "complete");
//
// Perform resolution and type analysis.
@@ -9143,12 +9143,12 @@ class LibraryResolver {
// possibility is to add a parameter to this method and punt the decision to the clients.
//
//if (analyzeAll) {
- resolveReferencesAndTypes();
+ _resolveReferencesAndTypes();
instrumentation.metric3("resolveReferencesAndTypes", "complete");
//} else {
// resolveReferencesAndTypes(targetLibrary);
//}
- performConstantEvaluation();
+ _performConstantEvaluation();
instrumentation.metric3("performConstantEvaluation", "complete");
return targetLibrary.libraryElement;
} finally {
@@ -9181,7 +9181,7 @@ class LibraryResolver {
_coreLibrary = _libraryMap[_coreLibrarySource];
if (_coreLibrary == null) {
// This will be true unless the library being analyzed is the core library.
- _coreLibrary = createLibraryOrNull(_coreLibrarySource);
+ _coreLibrary = _createLibraryOrNull(_coreLibrarySource);
if (_coreLibrary == null) {
throw new AnalysisException.con1("Core library does not exist");
}
@@ -9190,8 +9190,8 @@ class LibraryResolver {
//
// Compute the set of libraries that need to be resolved together.
//
- computeLibraryDependencies(targetLibrary);
- _librariesInCycles = computeLibrariesInCycles(targetLibrary);
+ _computeLibraryDependencies(targetLibrary);
+ _librariesInCycles = _computeLibrariesInCycles(targetLibrary);
//
// Build the element models representing the libraries being resolved. This is done in three
// steps:
@@ -9206,16 +9206,16 @@ class LibraryResolver {
// requires that we be able to compute the names visible in the libraries being resolved,
// which in turn requires that we have resolved the import directives.
//
- buildElementModels();
+ _buildElementModels();
instrumentation.metric3("buildElementModels", "complete");
LibraryElement coreElement = _coreLibrary.libraryElement;
if (coreElement == null) {
throw new AnalysisException.con1("Could not resolve dart:core");
}
- buildDirectiveModels();
+ _buildDirectiveModels();
instrumentation.metric3("buildDirectiveModels", "complete");
_typeProvider = new TypeProviderImpl(coreElement);
- buildTypeHierarchies();
+ _buildTypeHierarchies();
instrumentation.metric3("buildTypeHierarchies", "complete");
//
// Perform resolution and type analysis.
@@ -9227,12 +9227,12 @@ class LibraryResolver {
// possibility is to add a parameter to this method and punt the decision to the clients.
//
//if (analyzeAll) {
- resolveReferencesAndTypes();
+ _resolveReferencesAndTypes();
instrumentation.metric3("resolveReferencesAndTypes", "complete");
//} else {
// resolveReferencesAndTypes(targetLibrary);
//}
- performConstantEvaluation();
+ _performConstantEvaluation();
instrumentation.metric3("performConstantEvaluation", "complete");
instrumentation.metric2("librariesInCycles", _librariesInCycles.length);
for (Library lib in _librariesInCycles) {
@@ -9245,13 +9245,27 @@ class LibraryResolver {
}
/**
+ * Create an object to represent the information about the library defined by the compilation unit
+ * with the given source.
+ *
+ * @param librarySource the source of the library's defining compilation unit
+ * @return the library object that was created
+ * @throws AnalysisException if the library source is not valid
+ */
+ Library createLibrary(Source librarySource) {
+ Library library = new Library(analysisContext, _errorListener, librarySource);
+ _libraryMap[librarySource] = library;
+ return library;
+ }
+
+ /**
* Add a dependency to the given map from the referencing library to the referenced library.
*
* @param dependencyMap the map to which the dependency is to be added
* @param referencingLibrary the library that references the referenced library
* @param referencedLibrary the library referenced by the referencing library
*/
- void addDependencyToMap(Map<Library, List<Library>> dependencyMap, Library referencingLibrary, Library referencedLibrary) {
+ void _addDependencyToMap(Map<Library, List<Library>> dependencyMap, Library referencingLibrary, Library referencedLibrary) {
List<Library> dependentLibraries = dependencyMap[referencedLibrary];
if (dependentLibraries == null) {
dependentLibraries = new List<Library>();
@@ -9270,12 +9284,12 @@ class LibraryResolver {
* @param dependencyMap a table mapping libraries to the collection of libraries from which those
* libraries are referenced
*/
- void addLibrariesInCycle(Library library, Set<Library> librariesInCycle, Map<Library, List<Library>> dependencyMap) {
+ void _addLibrariesInCycle(Library library, Set<Library> librariesInCycle, Map<Library, List<Library>> dependencyMap) {
if (librariesInCycle.add(library)) {
List<Library> dependentLibraries = dependencyMap[library];
if (dependentLibraries != null) {
for (Library dependentLibrary in dependentLibraries) {
- addLibrariesInCycle(dependentLibrary, librariesInCycle, dependencyMap);
+ _addLibrariesInCycle(dependentLibrary, librariesInCycle, dependencyMap);
}
}
}
@@ -9290,14 +9304,14 @@ class LibraryResolver {
* @param visitedLibraries the libraries that have already been visited, used to prevent infinite
* recursion
*/
- void addToDependencyMap(Library library, Map<Library, List<Library>> dependencyMap, Set<Library> visitedLibraries) {
+ void _addToDependencyMap(Library library, Map<Library, List<Library>> dependencyMap, Set<Library> visitedLibraries) {
if (visitedLibraries.add(library)) {
for (Library referencedLibrary in library.importsAndExports) {
- addDependencyToMap(dependencyMap, library, referencedLibrary);
- addToDependencyMap(referencedLibrary, dependencyMap, visitedLibraries);
+ _addDependencyToMap(dependencyMap, library, referencedLibrary);
+ _addToDependencyMap(referencedLibrary, dependencyMap, visitedLibraries);
}
if (!library.explicitlyImportsCore && library != _coreLibrary) {
- addDependencyToMap(dependencyMap, library, _coreLibrary);
+ _addDependencyToMap(dependencyMap, library, _coreLibrary);
}
}
}
@@ -9308,18 +9322,18 @@ class LibraryResolver {
* @param directive the directive that declares the combinators
* @return an array containing the import combinators that were built
*/
- List<NamespaceCombinator> buildCombinators(NamespaceDirective directive) {
+ List<NamespaceCombinator> _buildCombinators(NamespaceDirective directive) {
List<NamespaceCombinator> combinators = new List<NamespaceCombinator>();
for (Combinator combinator in directive.combinators) {
if (combinator is HideCombinator) {
HideElementCombinatorImpl hide = new HideElementCombinatorImpl();
- hide.hiddenNames = getIdentifiers(combinator.hiddenNames);
+ hide.hiddenNames = _getIdentifiers(combinator.hiddenNames);
combinators.add(hide);
} else {
ShowElementCombinatorImpl show = new ShowElementCombinatorImpl();
show.offset = combinator.offset;
show.end = combinator.end;
- show.shownNames = getIdentifiers((combinator as ShowCombinator).shownNames);
+ show.shownNames = _getIdentifiers((combinator as ShowCombinator).shownNames);
combinators.add(show);
}
}
@@ -9333,7 +9347,7 @@ class LibraryResolver {
* @throws AnalysisException if the defining compilation unit for any of the libraries could not
* be accessed
*/
- void buildDirectiveModels() {
+ void _buildDirectiveModels() {
for (Library library in _librariesInCycles) {
Map<String, PrefixElementImpl> nameToPrefixMap = new Map<String, PrefixElementImpl>();
List<ImportElement> imports = new List<ImportElement>();
@@ -9352,7 +9366,7 @@ class LibraryResolver {
importElement.uriEnd = uriLiteral.end;
}
importElement.uri = library.getUri(importDirective);
- importElement.combinators = buildCombinators(importDirective);
+ importElement.combinators = _buildCombinators(importDirective);
LibraryElement importedLibraryElement = importedLibrary.libraryElement;
if (importedLibraryElement != null) {
importElement.importedLibrary = importedLibraryElement;
@@ -9385,7 +9399,7 @@ class LibraryResolver {
if (exportedLibrary != null) {
ExportElementImpl exportElement = new ExportElementImpl();
exportElement.uri = library.getUri(exportDirective);
- exportElement.combinators = buildCombinators(exportDirective);
+ exportElement.combinators = _buildCombinators(exportDirective);
LibraryElement exportedLibraryElement = exportedLibrary.libraryElement;
if (exportedLibraryElement != null) {
exportElement.exportedLibrary = exportedLibraryElement;
@@ -9425,7 +9439,7 @@ class LibraryResolver {
*
* @throws AnalysisException if any of the element models cannot be built
*/
- void buildElementModels() {
+ void _buildElementModels() {
for (Library library in _librariesInCycles) {
LibraryElementBuilder builder = new LibraryElementBuilder(this);
LibraryElementImpl libraryElement = builder.buildLibrary(library);
@@ -9439,7 +9453,7 @@ class LibraryResolver {
*
* @throws AnalysisException if any of the type hierarchies could not be resolved
*/
- void buildTypeHierarchies() {
+ void _buildTypeHierarchies() {
TimeCounter_TimeCounterHandle timeCounter = PerformanceStatistics.resolve.start();
try {
for (Library library in _librariesInCycles) {
@@ -9464,9 +9478,9 @@ class LibraryResolver {
*
* @param library the library currently being added to the dependency map
*/
- Map<Library, List<Library>> computeDependencyMap(Library library) {
+ Map<Library, List<Library>> _computeDependencyMap(Library library) {
Map<Library, List<Library>> dependencyMap = new Map<Library, List<Library>>();
- addToDependencyMap(library, dependencyMap, new Set<Library>());
+ _addToDependencyMap(library, dependencyMap, new Set<Library>());
return dependencyMap;
}
@@ -9477,24 +9491,24 @@ class LibraryResolver {
* @param library the library to be processed to find libraries that have not yet been traversed
* @throws AnalysisException if some portion of the library graph could not be traversed
*/
- void computeEmbeddedLibraryDependencies(Library library, CompilationUnit unit) {
+ void _computeEmbeddedLibraryDependencies(Library library, CompilationUnit unit) {
Source librarySource = library.librarySource;
Set<Source> exportedSources = new Set<Source>();
Set<Source> importedSources = new Set<Source>();
for (Directive directive in unit.directives) {
if (directive is ExportDirective) {
- Source exportSource = resolveSource(librarySource, directive);
+ Source exportSource = _resolveSource(librarySource, directive);
if (exportSource != null) {
exportedSources.add(exportSource);
}
} else if (directive is ImportDirective) {
- Source importSource = resolveSource(librarySource, directive);
+ Source importSource = _resolveSource(librarySource, directive);
if (importSource != null) {
importedSources.add(importSource);
}
}
}
- computeLibraryDependenciesFromDirectives(library, new List.from(importedSources), new List.from(exportedSources));
+ _computeLibraryDependenciesFromDirectives(library, new List.from(importedSources), new List.from(exportedSources));
}
/**
@@ -9505,10 +9519,10 @@ class LibraryResolver {
* @return all of the libraries referenced by the given library that have a circular reference
* back to the given library
*/
- Set<Library> computeLibrariesInCycles(Library library) {
- Map<Library, List<Library>> dependencyMap = computeDependencyMap(library);
+ Set<Library> _computeLibrariesInCycles(Library library) {
+ Map<Library, List<Library>> dependencyMap = _computeDependencyMap(library);
Set<Library> librariesInCycle = new Set<Library>();
- addLibrariesInCycle(library, librariesInCycle, dependencyMap);
+ _addLibrariesInCycle(library, librariesInCycle, dependencyMap);
return librariesInCycle;
}
@@ -9519,9 +9533,9 @@ class LibraryResolver {
* @param library the library to be processed to find libraries that have not yet been traversed
* @throws AnalysisException if some portion of the library graph could not be traversed
*/
- void computeLibraryDependencies(Library library) {
+ void _computeLibraryDependencies(Library library) {
Source librarySource = library.librarySource;
- computeLibraryDependenciesFromDirectives(library, analysisContext.computeImportedLibraries(librarySource), analysisContext.computeExportedLibraries(librarySource));
+ _computeLibraryDependenciesFromDirectives(library, analysisContext.computeImportedLibraries(librarySource), analysisContext.computeExportedLibraries(librarySource));
}
/**
@@ -9533,7 +9547,7 @@ class LibraryResolver {
* @param exportedSources an array containing the sources that are exported from the given library
* @throws AnalysisException if some portion of the library graph could not be traversed
*/
- void computeLibraryDependenciesFromDirectives(Library library, List<Source> importedSources, List<Source> exportedSources) {
+ void _computeLibraryDependenciesFromDirectives(Library library, List<Source> importedSources, List<Source> exportedSources) {
List<Library> importedLibraries = new List<Library>();
bool explicitlyImportsCore = false;
for (Source importedSource in importedSources) {
@@ -9542,9 +9556,9 @@ class LibraryResolver {
}
Library importedLibrary = _libraryMap[importedSource];
if (importedLibrary == null) {
- importedLibrary = createLibraryOrNull(importedSource);
+ importedLibrary = _createLibraryOrNull(importedSource);
if (importedLibrary != null) {
- computeLibraryDependencies(importedLibrary);
+ _computeLibraryDependencies(importedLibrary);
}
}
if (importedLibrary != null) {
@@ -9556,9 +9570,9 @@ class LibraryResolver {
for (Source exportedSource in exportedSources) {
Library exportedLibrary = _libraryMap[exportedSource];
if (exportedLibrary == null) {
- exportedLibrary = createLibraryOrNull(exportedSource);
+ exportedLibrary = _createLibraryOrNull(exportedSource);
if (exportedLibrary != null) {
- computeLibraryDependencies(exportedLibrary);
+ _computeLibraryDependencies(exportedLibrary);
}
}
if (exportedLibrary != null) {
@@ -9570,9 +9584,9 @@ class LibraryResolver {
if (!explicitlyImportsCore && _coreLibrarySource != library.librarySource) {
Library importedLibrary = _libraryMap[_coreLibrarySource];
if (importedLibrary == null) {
- importedLibrary = createLibraryOrNull(_coreLibrarySource);
+ importedLibrary = _createLibraryOrNull(_coreLibrarySource);
if (importedLibrary != null) {
- computeLibraryDependencies(importedLibrary);
+ _computeLibraryDependencies(importedLibrary);
}
}
}
@@ -9580,27 +9594,13 @@ class LibraryResolver {
/**
* Create an object to represent the information about the library defined by the compilation unit
- * with the given source.
- *
- * @param librarySource the source of the library's defining compilation unit
- * @return the library object that was created
- * @throws AnalysisException if the library source is not valid
- */
- Library createLibrary(Source librarySource) {
- Library library = new Library(analysisContext, _errorListener, librarySource);
- _libraryMap[librarySource] = library;
- return library;
- }
-
- /**
- * Create an object to represent the information about the library defined by the compilation unit
* with the given source. Return the library object that was created, or `null` if the
* source is not valid.
*
* @param librarySource the source of the library's defining compilation unit
* @return the library object that was created
*/
- Library createLibraryOrNull(Source librarySource) {
+ Library _createLibraryOrNull(Source librarySource) {
if (!analysisContext.exists(librarySource)) {
return null;
}
@@ -9620,7 +9620,7 @@ class LibraryResolver {
* @return the library object that was created
* @throws AnalysisException if the library source is not valid
*/
- Library createLibraryWithUnit(Source librarySource, int modificationStamp, CompilationUnit unit) {
+ Library _createLibraryWithUnit(Source librarySource, int modificationStamp, CompilationUnit unit) {
Library library = new Library(analysisContext, _errorListener, librarySource);
library.setDefiningCompilationUnit(modificationStamp, unit);
_libraryMap[librarySource] = library;
@@ -9633,7 +9633,7 @@ class LibraryResolver {
* @param names the AST nodes representing the identifiers
* @return the lexical identifiers associated with the nodes in the list
*/
- List<String> getIdentifiers(NodeList<SimpleIdentifier> names) {
+ List<String> _getIdentifiers(NodeList<SimpleIdentifier> names) {
int count = names.length;
List<String> identifiers = new List<String>(count);
for (int i = 0; i < count; i++) {
@@ -9645,7 +9645,7 @@ class LibraryResolver {
/**
* Compute a value for all of the constants in the libraries being analyzed.
*/
- void performConstantEvaluation() {
+ void _performConstantEvaluation() {
TimeCounter_TimeCounterHandle timeCounter = PerformanceStatistics.resolve.start();
try {
ConstantValueComputer computer = new ConstantValueComputer(_typeProvider);
@@ -9673,9 +9673,9 @@ class LibraryResolver {
* @throws AnalysisException if any of the identifiers could not be resolved or if any of the
* libraries could not have their types analyzed
*/
- void resolveReferencesAndTypes() {
+ void _resolveReferencesAndTypes() {
for (Library library in _librariesInCycles) {
- resolveReferencesAndTypesInLibrary(library);
+ _resolveReferencesAndTypesInLibrary(library);
}
}
@@ -9686,7 +9686,7 @@ class LibraryResolver {
* @throws AnalysisException if any of the identifiers could not be resolved or if the types in
* the library cannot be analyzed
*/
- void resolveReferencesAndTypesInLibrary(Library library) {
+ void _resolveReferencesAndTypesInLibrary(Library library) {
TimeCounter_TimeCounterHandle timeCounter = PerformanceStatistics.resolve.start();
try {
for (Source source in library.compilationUnitSources) {
@@ -9723,7 +9723,7 @@ class LibraryResolver {
* @param directive the directive which URI should be resolved
* @return the result of resolving the URI against the URI of the library
*/
- Source resolveSource(Source librarySource, UriBasedDirective directive) {
+ Source _resolveSource(Source librarySource, UriBasedDirective directive) {
StringLiteral uriLiteral = directive.uri;
if (uriLiteral is StringInterpolation) {
return null;
@@ -9768,14 +9768,14 @@ class MemberMap {
* @param initialCapacity the initial capacity
*/
MemberMap.con1(int initialCapacity) {
- initArrays(initialCapacity);
+ _initArrays(initialCapacity);
}
/**
* Copy constructor.
*/
MemberMap.con2(MemberMap memberMap) {
- initArrays(memberMap._size + 5);
+ _initArrays(memberMap._size + 5);
for (int i = 0; i < memberMap._size; i++) {
_keys[i] = memberMap._keys[i];
_values[i] = memberMap._values[i];
@@ -9894,7 +9894,7 @@ class MemberMap {
/**
* Initializes [keys] and [values].
*/
- void initArrays(int initialCapacity) {
+ void _initArrays(int initialCapacity) {
_keys = new List<String>(initialCapacity);
_values = new List<ExecutableElement>(initialCapacity);
}
@@ -10067,7 +10067,7 @@ class ResolverVisitor extends ScopedVisitor {
Object visitAssertStatement(AssertStatement node) {
super.visitAssertStatement(node);
- propagateTrueState(node.condition);
+ _propagateTrueState(node.condition);
return null;
}
@@ -10081,12 +10081,12 @@ class ResolverVisitor extends ScopedVisitor {
try {
_overrideManager.enterScope();
_promoteManager.enterScope();
- propagateTrueState(leftOperand);
+ _propagateTrueState(leftOperand);
// Type promotion.
- promoteTypes(leftOperand);
- clearTypePromotionsIfPotentiallyMutatedIn(leftOperand);
- clearTypePromotionsIfPotentiallyMutatedIn(rightOperand);
- clearTypePromotionsIfAccessedInClosureAndProtentiallyMutated(rightOperand);
+ _promoteTypes(leftOperand);
+ _clearTypePromotionsIfPotentiallyMutatedIn(leftOperand);
+ _clearTypePromotionsIfPotentiallyMutatedIn(rightOperand);
+ _clearTypePromotionsIfAccessedInClosureAndProtentiallyMutated(rightOperand);
// Visit right operand.
rightOperand.accept(this);
} finally {
@@ -10099,7 +10099,7 @@ class ResolverVisitor extends ScopedVisitor {
if (rightOperand != null) {
try {
_overrideManager.enterScope();
- propagateFalseState(leftOperand);
+ _propagateFalseState(leftOperand);
rightOperand.accept(this);
} finally {
_overrideManager.exitScope();
@@ -10214,11 +10214,11 @@ class ResolverVisitor extends ScopedVisitor {
try {
_overrideManager.enterScope();
_promoteManager.enterScope();
- propagateTrueState(condition);
+ _propagateTrueState(condition);
// Type promotion.
- promoteTypes(condition);
- clearTypePromotionsIfPotentiallyMutatedIn(thenExpression);
- clearTypePromotionsIfAccessedInClosureAndProtentiallyMutated(thenExpression);
+ _promoteTypes(condition);
+ _clearTypePromotionsIfPotentiallyMutatedIn(thenExpression);
+ _clearTypePromotionsIfAccessedInClosureAndProtentiallyMutated(thenExpression);
// Visit "then" expression.
thenExpression.accept(this);
} finally {
@@ -10230,7 +10230,7 @@ class ResolverVisitor extends ScopedVisitor {
if (elseExpression != null) {
try {
_overrideManager.enterScope();
- propagateFalseState(condition);
+ _propagateFalseState(condition);
elseExpression.accept(this);
} finally {
_overrideManager.exitScope();
@@ -10238,14 +10238,14 @@ class ResolverVisitor extends ScopedVisitor {
}
node.accept(_elementResolver);
node.accept(_typeAnalyzer);
- bool thenIsAbrupt = isAbruptTerminationExpression(thenExpression);
- bool elseIsAbrupt = isAbruptTerminationExpression(elseExpression);
+ bool thenIsAbrupt = _isAbruptTerminationExpression(thenExpression);
+ bool elseIsAbrupt = _isAbruptTerminationExpression(elseExpression);
if (elseIsAbrupt && !thenIsAbrupt) {
- propagateTrueState(condition);
- propagateState(thenExpression);
+ _propagateTrueState(condition);
+ _propagateState(thenExpression);
} else if (thenIsAbrupt && !elseIsAbrupt) {
- propagateFalseState(condition);
- propagateState(elseExpression);
+ _propagateFalseState(condition);
+ _propagateState(elseExpression);
}
return null;
}
@@ -10379,7 +10379,7 @@ class ResolverVisitor extends ScopedVisitor {
Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
safelyVisit(node.function);
node.accept(_elementResolver);
- inferFunctionExpressionsParametersTypes(node.argumentList);
+ _inferFunctionExpressionsParametersTypes(node.argumentList);
safelyVisit(node.argumentList);
node.accept(_typeAnalyzer);
return null;
@@ -10396,11 +10396,11 @@ class ResolverVisitor extends ScopedVisitor {
try {
_overrideManager.enterScope();
_promoteManager.enterScope();
- propagateTrueState(condition);
+ _propagateTrueState(condition);
// Type promotion.
- promoteTypes(condition);
- clearTypePromotionsIfPotentiallyMutatedIn(thenStatement);
- clearTypePromotionsIfAccessedInClosureAndProtentiallyMutated(thenStatement);
+ _promoteTypes(condition);
+ _clearTypePromotionsIfPotentiallyMutatedIn(thenStatement);
+ _clearTypePromotionsIfAccessedInClosureAndProtentiallyMutated(thenStatement);
// Visit "then".
visitStatementInScope(thenStatement);
} finally {
@@ -10414,7 +10414,7 @@ class ResolverVisitor extends ScopedVisitor {
if (elseStatement != null) {
try {
_overrideManager.enterScope();
- propagateFalseState(condition);
+ _propagateFalseState(condition);
visitStatementInScope(elseStatement);
} finally {
elseOverrides = _overrideManager.captureLocalOverrides();
@@ -10423,15 +10423,15 @@ class ResolverVisitor extends ScopedVisitor {
}
node.accept(_elementResolver);
node.accept(_typeAnalyzer);
- bool thenIsAbrupt = isAbruptTerminationStatement(thenStatement);
- bool elseIsAbrupt = isAbruptTerminationStatement(elseStatement);
+ bool thenIsAbrupt = _isAbruptTerminationStatement(thenStatement);
+ bool elseIsAbrupt = _isAbruptTerminationStatement(elseStatement);
if (elseIsAbrupt && !thenIsAbrupt) {
- propagateTrueState(condition);
+ _propagateTrueState(condition);
if (thenOverrides != null) {
_overrideManager.applyOverrides(thenOverrides);
}
} else if (thenIsAbrupt && !elseIsAbrupt) {
- propagateFalseState(condition);
+ _propagateFalseState(condition);
if (elseOverrides != null) {
_overrideManager.applyOverrides(elseOverrides);
}
@@ -10461,7 +10461,7 @@ class ResolverVisitor extends ScopedVisitor {
//
safelyVisit(node.target);
node.accept(_elementResolver);
- inferFunctionExpressionsParametersTypes(node.argumentList);
+ _inferFunctionExpressionsParametersTypes(node.argumentList);
safelyVisit(node.argumentList);
node.accept(_typeAnalyzer);
return null;
@@ -10561,7 +10561,7 @@ class ResolverVisitor extends ScopedVisitor {
if (body != null) {
try {
_overrideManager.enterScope();
- propagateTrueState(condition);
+ _propagateTrueState(condition);
visitStatementInScope(body);
} finally {
_overrideManager.exitScope();
@@ -10701,7 +10701,7 @@ class ResolverVisitor extends ScopedVisitor {
return;
}
}
- Type2 currentType = getBestType(element);
+ Type2 currentType = _getBestType(element);
if (currentType == null || !currentType.isMoreSpecificThan(potentialType)) {
_overrideManager.setType(element, potentialType);
}
@@ -10762,16 +10762,16 @@ class ResolverVisitor extends ScopedVisitor {
if (loopVariable != null && iterator != null) {
LocalVariableElement loopElement = loopVariable.element;
if (loopElement != null) {
- Type2 iteratorElementType = getIteratorElementType(iterator);
+ Type2 iteratorElementType = _getIteratorElementType(iterator);
overrideVariable(loopElement, iteratorElementType);
- recordPropagatedType(loopVariable.identifier, iteratorElementType);
+ _recordPropagatedType(loopVariable.identifier, iteratorElementType);
}
} else if (identifier != null && iterator != null) {
Element identifierElement = identifier.staticElement;
if (identifierElement is VariableElement) {
- Type2 iteratorElementType = getIteratorElementType(iterator);
+ Type2 iteratorElementType = _getIteratorElementType(iterator);
overrideVariable(identifierElement, iteratorElementType);
- recordPropagatedType(identifier, iteratorElementType);
+ _recordPropagatedType(identifier, iteratorElementType);
}
}
visitStatementInScope(body);
@@ -10789,7 +10789,7 @@ class ResolverVisitor extends ScopedVisitor {
safelyVisit(node.condition);
_overrideManager.enterScope();
try {
- propagateTrueState(node.condition);
+ _propagateTrueState(node.condition);
visitStatementInScope(node.body);
node.updaters.accept(this);
} finally {
@@ -10804,10 +10804,10 @@ class ResolverVisitor extends ScopedVisitor {
* If the variable <i>v</i> is accessed by a closure in <i>s<sub>1</sub></i> then the variable
* <i>v</i> is not potentially mutated anywhere in the scope of <i>v</i>.
*/
- void clearTypePromotionsIfAccessedInClosureAndProtentiallyMutated(AstNode target) {
+ void _clearTypePromotionsIfAccessedInClosureAndProtentiallyMutated(AstNode target) {
for (Element element in _promoteManager.promotedElements) {
if ((element as VariableElementImpl).isPotentiallyMutatedInScope) {
- if (isVariableAccessedInClosure(element, target)) {
+ if (_isVariableAccessedInClosure(element, target)) {
_promoteManager.setType(element, null);
}
}
@@ -10820,9 +10820,9 @@ class ResolverVisitor extends ScopedVisitor {
*
* <i>v</i> is not potentially mutated in <i>s<sub>1</sub></i> or within a closure.
*/
- void clearTypePromotionsIfPotentiallyMutatedIn(AstNode target) {
+ void _clearTypePromotionsIfPotentiallyMutatedIn(AstNode target) {
for (Element element in _promoteManager.promotedElements) {
- if (isVariablePotentiallyMutatedIn(element, target)) {
+ if (_isVariablePotentiallyMutatedIn(element, target)) {
_promoteManager.setType(element, null);
}
}
@@ -10835,7 +10835,7 @@ class ResolverVisitor extends ScopedVisitor {
* @param element the element for which type information is to be returned
* @return the best type information available for the given element
*/
- Type2 getBestType(Element element) {
+ Type2 _getBestType(Element element) {
Type2 bestType = _overrideManager.getType(element);
if (bestType == null) {
if (element is LocalVariableElement) {
@@ -10855,7 +10855,7 @@ class ResolverVisitor extends ScopedVisitor {
* @param iterator the iterator for a for-each statement
* @return the type of objects that will be assigned to the loop variable
*/
- Type2 getIteratorElementType(Expression iteratorExpression) {
+ Type2 _getIteratorElementType(Expression iteratorExpression) {
Type2 expressionType = iteratorExpression.staticType;
if (expressionType is InterfaceType) {
InterfaceType interfaceType = expressionType;
@@ -10882,7 +10882,7 @@ class ResolverVisitor extends ScopedVisitor {
* If given "mayBeClosure" is [FunctionExpression] without explicit parameters types and its
* required type is [FunctionType], then infer parameters types from [FunctionType].
*/
- void inferFunctionExpressionParametersTypes(Expression mayBeClosure, Type2 mayByFunctionType) {
+ void _inferFunctionExpressionParametersTypes(Expression mayBeClosure, Type2 mayByFunctionType) {
// prepare closure
if (mayBeClosure is! FunctionExpression) {
return;
@@ -10901,7 +10901,7 @@ class ResolverVisitor extends ScopedVisitor {
for (int i = 0; i < parameters.length && i < expectedParameters.length; i++) {
FormalParameter parameter = parameters[i];
ParameterElement element = parameter.element;
- Type2 currentType = getBestType(element);
+ Type2 currentType = _getBestType(element);
// may be override the type
Type2 expectedType = expectedParameters[i].type;
if (currentType == null || expectedType.isMoreSpecificThan(currentType)) {
@@ -10913,14 +10913,14 @@ class ResolverVisitor extends ScopedVisitor {
/**
* Try to infer types of parameters of the [FunctionExpression] arguments.
*/
- void inferFunctionExpressionsParametersTypes(ArgumentList argumentList) {
+ void _inferFunctionExpressionsParametersTypes(ArgumentList argumentList) {
for (Expression argument in argumentList.arguments) {
ParameterElement parameter = argument.propagatedParameterElement;
if (parameter == null) {
parameter = argument.staticParameterElement;
}
if (parameter != null) {
- inferFunctionExpressionParametersTypes(argument, parameter.type);
+ _inferFunctionExpressionParametersTypes(argument, parameter.type);
}
}
}
@@ -10932,7 +10932,7 @@ class ResolverVisitor extends ScopedVisitor {
* @param expression the expression being tested
* @return `true` if the given expression terminates abruptly
*/
- bool isAbruptTerminationExpression(Expression expression) {
+ bool _isAbruptTerminationExpression(Expression expression) {
// TODO(brianwilkerson) This needs to be significantly improved. Ideally we would eventually
// turn this into a method on Expression that returns a termination indication (normal, abrupt
// with no exception, abrupt with an exception).
@@ -10949,21 +10949,21 @@ class ResolverVisitor extends ScopedVisitor {
* @param statement the statement being tested
* @return `true` if the given statement terminates abruptly
*/
- bool isAbruptTerminationStatement(Statement statement) {
+ bool _isAbruptTerminationStatement(Statement statement) {
// TODO(brianwilkerson) This needs to be significantly improved. Ideally we would eventually
// turn this into a method on Statement that returns a termination indication (normal, abrupt
// with no exception, abrupt with an exception).
if (statement is ReturnStatement || statement is BreakStatement || statement is ContinueStatement) {
return true;
} else if (statement is ExpressionStatement) {
- return isAbruptTerminationExpression(statement.expression);
+ return _isAbruptTerminationExpression(statement.expression);
} else if (statement is Block) {
NodeList<Statement> statements = statement.statements;
int size = statements.length;
if (size == 0) {
return false;
}
- return isAbruptTerminationStatement(statements[size - 1]);
+ return _isAbruptTerminationStatement(statements[size - 1]);
}
return false;
}
@@ -10977,7 +10977,7 @@ class ResolverVisitor extends ScopedVisitor {
* @param target the [AstNode] to check within
* @return `true` if this variable is potentially mutated somewhere in the given ASTNode
*/
- bool isVariableAccessedInClosure(Element variable, AstNode target) {
+ bool _isVariableAccessedInClosure(Element variable, AstNode target) {
List<bool> result = [false];
target.accept(new RecursiveAstVisitor_ResolverVisitor_isVariableAccessedInClosure(result, variable));
return result[0];
@@ -10991,7 +10991,7 @@ class ResolverVisitor extends ScopedVisitor {
* @param target the [AstNode] to check within
* @return `true` if this variable is potentially mutated somewhere in the given ASTNode
*/
- bool isVariablePotentiallyMutatedIn(Element variable, AstNode target) {
+ bool _isVariablePotentiallyMutatedIn(Element variable, AstNode target) {
List<bool> result = [false];
target.accept(new RecursiveAstVisitor_ResolverVisitor_isVariablePotentiallyMutatedIn(result, variable));
return result[0];
@@ -11006,7 +11006,7 @@ class ResolverVisitor extends ScopedVisitor {
* promoted
* @param potentialType the potential type of the elements
*/
- void promote(Expression expression, Type2 potentialType) {
+ void _promote(Expression expression, Type2 potentialType) {
VariableElement element = getPromotionStaticElement(expression);
if (element != null) {
// may be mutated somewhere in closure
@@ -11038,23 +11038,23 @@ class ResolverVisitor extends ScopedVisitor {
/**
* Promotes type information using given condition.
*/
- void promoteTypes(Expression condition) {
+ void _promoteTypes(Expression condition) {
if (condition is BinaryExpression) {
BinaryExpression binary = condition;
if (identical(binary.operator.type, sc.TokenType.AMPERSAND_AMPERSAND)) {
Expression left = binary.leftOperand;
Expression right = binary.rightOperand;
- promoteTypes(left);
- promoteTypes(right);
- clearTypePromotionsIfPotentiallyMutatedIn(right);
+ _promoteTypes(left);
+ _promoteTypes(right);
+ _clearTypePromotionsIfPotentiallyMutatedIn(right);
}
} else if (condition is IsExpression) {
IsExpression is2 = condition;
if (is2.notOperator == null) {
- promote(is2.expression, is2.type.type);
+ _promote(is2.expression, is2.type.type);
}
} else if (condition is ParenthesizedExpression) {
- promoteTypes(condition.expression);
+ _promoteTypes(condition.expression);
}
}
@@ -11064,12 +11064,12 @@ class ResolverVisitor extends ScopedVisitor {
*
* @param condition the condition that will have evaluated to 'false'
*/
- void propagateFalseState(Expression condition) {
+ void _propagateFalseState(Expression condition) {
if (condition is BinaryExpression) {
BinaryExpression binary = condition;
if (identical(binary.operator.type, sc.TokenType.BAR_BAR)) {
- propagateFalseState(binary.leftOperand);
- propagateFalseState(binary.rightOperand);
+ _propagateFalseState(binary.leftOperand);
+ _propagateFalseState(binary.rightOperand);
}
} else if (condition is IsExpression) {
IsExpression is2 = condition;
@@ -11079,10 +11079,10 @@ class ResolverVisitor extends ScopedVisitor {
} else if (condition is PrefixExpression) {
PrefixExpression prefix = condition;
if (identical(prefix.operator.type, sc.TokenType.BANG)) {
- propagateTrueState(prefix.operand);
+ _propagateTrueState(prefix.operand);
}
} else if (condition is ParenthesizedExpression) {
- propagateFalseState(condition.expression);
+ _propagateFalseState(condition.expression);
}
}
@@ -11092,7 +11092,7 @@ class ResolverVisitor extends ScopedVisitor {
*
* @param expression the expression that will have been evaluated
*/
- void propagateState(Expression expression) {
+ void _propagateState(Expression expression) {
}
/**
@@ -11101,12 +11101,12 @@ class ResolverVisitor extends ScopedVisitor {
*
* @param condition the condition that will have evaluated to 'true'
*/
- void propagateTrueState(Expression condition) {
+ void _propagateTrueState(Expression condition) {
if (condition is BinaryExpression) {
BinaryExpression binary = condition;
if (identical(binary.operator.type, sc.TokenType.AMPERSAND_AMPERSAND)) {
- propagateTrueState(binary.leftOperand);
- propagateTrueState(binary.rightOperand);
+ _propagateTrueState(binary.leftOperand);
+ _propagateTrueState(binary.rightOperand);
}
} else if (condition is IsExpression) {
IsExpression is2 = condition;
@@ -11116,10 +11116,10 @@ class ResolverVisitor extends ScopedVisitor {
} else if (condition is PrefixExpression) {
PrefixExpression prefix = condition;
if (identical(prefix.operator.type, sc.TokenType.BANG)) {
- propagateFalseState(prefix.operand);
+ _propagateFalseState(prefix.operand);
}
} else if (condition is ParenthesizedExpression) {
- propagateTrueState(condition.expression);
+ _propagateTrueState(condition.expression);
}
}
@@ -11129,7 +11129,7 @@ class ResolverVisitor extends ScopedVisitor {
* @param expression the node whose type is to be recorded
* @param type the propagated type of the node
*/
- void recordPropagatedType(Expression expression, Type2 type) {
+ void _recordPropagatedType(Expression expression, Type2 type) {
if (type != null && !type.isDynamic) {
expression.propagatedType = type;
}
@@ -11330,7 +11330,7 @@ abstract class ScopedVisitor extends UnifyingAstVisitor<Object> {
Scope outerScope = _nameScope;
try {
EnclosedScope enclosedScope = new EnclosedScope(_nameScope);
- hideNamesDefinedInBlock(enclosedScope, node);
+ _hideNamesDefinedInBlock(enclosedScope, node);
_nameScope = enclosedScope;
super.visitBlock(node);
} finally {
@@ -11508,7 +11508,7 @@ abstract class ScopedVisitor extends UnifyingAstVisitor<Object> {
}
Object visitLabeledStatement(LabeledStatement node) {
- LabelScope outerScope = addScopesFor(node.labels);
+ LabelScope outerScope = _addScopesFor(node.labels);
try {
super.visitLabeledStatement(node);
} finally {
@@ -11715,7 +11715,7 @@ abstract class ScopedVisitor extends UnifyingAstVisitor<Object> {
* @param labels the labels for which new scopes are to be added
* @return the scope that was in effect before the new scopes were added
*/
- LabelScope addScopesFor(NodeList<Label> labels) {
+ LabelScope _addScopesFor(NodeList<Label> labels) {
LabelScope outerScope = _labelScope;
for (Label label in labels) {
SimpleIdentifier labelNameNode = label.label;
@@ -11731,7 +11731,7 @@ abstract class ScopedVisitor extends UnifyingAstVisitor<Object> {
* According to the scoping rules name is hidden if block defines it, but name is defined after
* its declaration statement.
*/
- void hideNamesDefinedInBlock(EnclosedScope scope, Block block) {
+ void _hideNamesDefinedInBlock(EnclosedScope scope, Block block) {
NodeList<Statement> statements = block.statements;
int statementCount = statements.length;
for (int i = 0; i < statementCount; i++) {
@@ -11767,7 +11767,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
*
* @return the table that was created
*/
- static Map<String, String> createHtmlTagToClassMap() {
+ static Map<String, String> _createHtmlTagToClassMap() {
Map<String, String> map = new Map<String, String>();
map["a"] = "AnchorElement";
map["area"] = "AreaElement";
@@ -11870,7 +11870,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* A table mapping HTML tag names to the names of the classes (in 'dart:html') that implement
* those tags.
*/
- static Map<String, String> _HTML_ELEMENT_TO_CLASS_MAP = createHtmlTagToClassMap();
+ static Map<String, String> _HTML_ELEMENT_TO_CLASS_MAP = _createHtmlTagToClassMap();
/**
* Initialize a newly created type analyzer.
@@ -11899,7 +11899,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* `String`.</blockquote>
*/
Object visitAdjacentStrings(AdjacentStrings node) {
- recordStaticType(node, _typeProvider.stringType);
+ _recordStaticType(node, _typeProvider.stringType);
return null;
}
@@ -11908,7 +11908,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* test is `bool`.</blockquote>
*/
Object visitArgumentDefinitionTest(ArgumentDefinitionTest node) {
- recordStaticType(node, _typeProvider.boolType);
+ _recordStaticType(node, _typeProvider.boolType);
return null;
}
@@ -11921,7 +11921,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* The static type of a cast expression <i>e as T</i> is <i>T</i>.</blockquote>
*/
Object visitAsExpression(AsExpression node) {
- recordStaticType(node, getType(node.type));
+ _recordStaticType(node, _getType(node.type));
return null;
}
@@ -11968,26 +11968,26 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
sc.TokenType operator = node.operator.type;
if (identical(operator, sc.TokenType.EQ)) {
Expression rightHandSide = node.rightHandSide;
- Type2 staticType = getStaticType(rightHandSide);
- recordStaticType(node, staticType);
+ Type2 staticType = _getStaticType(rightHandSide);
+ _recordStaticType(node, staticType);
Type2 overrideType = staticType;
Type2 propagatedType = rightHandSide.propagatedType;
if (propagatedType != null) {
if (propagatedType.isMoreSpecificThan(staticType)) {
- recordPropagatedType(node, propagatedType);
+ _recordPropagatedType(node, propagatedType);
}
overrideType = propagatedType;
}
_resolver.overrideExpression(node.leftHandSide, overrideType);
} else {
ExecutableElement staticMethodElement = node.staticElement;
- Type2 staticType = computeStaticReturnType(staticMethodElement);
- recordStaticType(node, staticType);
+ Type2 staticType = _computeStaticReturnType(staticMethodElement);
+ _recordStaticType(node, staticType);
MethodElement propagatedMethodElement = node.propagatedElement;
if (propagatedMethodElement != staticMethodElement) {
- Type2 propagatedType = computeStaticReturnType(propagatedMethodElement);
+ Type2 propagatedType = _computeStaticReturnType(propagatedMethodElement);
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
- recordPropagatedType(node, propagatedType);
+ _recordPropagatedType(node, propagatedType);
}
}
}
@@ -12033,14 +12033,14 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
*/
Object visitBinaryExpression(BinaryExpression node) {
ExecutableElement staticMethodElement = node.staticElement;
- Type2 staticType = computeStaticReturnType(staticMethodElement);
- staticType = refineBinaryExpressionType(node, staticType);
- recordStaticType(node, staticType);
+ Type2 staticType = _computeStaticReturnType(staticMethodElement);
+ staticType = _refineBinaryExpressionType(node, staticType);
+ _recordStaticType(node, staticType);
MethodElement propagatedMethodElement = node.propagatedElement;
if (propagatedMethodElement != staticMethodElement) {
- Type2 propagatedType = computeStaticReturnType(propagatedMethodElement);
+ Type2 propagatedType = _computeStaticReturnType(propagatedMethodElement);
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
- recordPropagatedType(node, propagatedType);
+ _recordPropagatedType(node, propagatedType);
}
}
return null;
@@ -12051,7 +12051,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* bool.</blockquote>
*/
Object visitBooleanLiteral(BooleanLiteral node) {
- recordStaticType(node, _typeProvider.boolType);
+ _recordStaticType(node, _typeProvider.boolType);
return null;
}
@@ -12061,8 +12061,8 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* t;}(e)</i>.</blockquote>
*/
Object visitCascadeExpression(CascadeExpression node) {
- recordStaticType(node, getStaticType(node.target));
- recordPropagatedType(node, node.target.propagatedType);
+ _recordStaticType(node, _getStaticType(node.target));
+ _recordPropagatedType(node, node.target.propagatedType);
return null;
}
@@ -12076,8 +12076,8 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* and the static type of <i>e<sub>3</sub></i>.</blockquote>
*/
Object visitConditionalExpression(ConditionalExpression node) {
- Type2 staticThenType = getStaticType(node.thenExpression);
- Type2 staticElseType = getStaticType(node.elseExpression);
+ Type2 staticThenType = _getStaticType(node.thenExpression);
+ Type2 staticElseType = _getStaticType(node.elseExpression);
if (staticThenType == null) {
// TODO(brianwilkerson) Determine whether this can still happen.
staticThenType = _dynamicType;
@@ -12090,7 +12090,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
if (staticType == null) {
staticType = _dynamicType;
}
- recordStaticType(node, staticType);
+ _recordStaticType(node, staticType);
Type2 propagatedThenType = node.thenExpression.propagatedType;
Type2 propagatedElseType = node.elseExpression.propagatedType;
if (propagatedThenType != null || propagatedElseType != null) {
@@ -12102,7 +12102,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
}
Type2 propagatedType = propagatedThenType.getLeastUpperBound(propagatedElseType);
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
- recordPropagatedType(node, propagatedType);
+ _recordPropagatedType(node, propagatedType);
}
}
return null;
@@ -12113,16 +12113,16 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* double.</blockquote>
*/
Object visitDoubleLiteral(DoubleLiteral node) {
- recordStaticType(node, _typeProvider.doubleType);
+ _recordStaticType(node, _typeProvider.doubleType);
return null;
}
Object visitFunctionDeclaration(FunctionDeclaration node) {
FunctionExpression function = node.functionExpression;
ExecutableElementImpl functionElement = node.element as ExecutableElementImpl;
- functionElement.returnType = computeStaticReturnTypeOfFunctionDeclaration(node);
- recordPropagatedTypeOfFunction(functionElement, function.body);
- recordStaticType(function, functionElement.type);
+ functionElement.returnType = _computeStaticReturnTypeOfFunctionDeclaration(node);
+ _recordPropagatedTypeOfFunction(functionElement, function.body);
+ _recordStaticType(function, functionElement.type);
return null;
}
@@ -12162,9 +12162,9 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
return null;
}
ExecutableElementImpl functionElement = node.element as ExecutableElementImpl;
- functionElement.returnType = computeStaticReturnTypeOfFunctionExpression(node);
- recordPropagatedTypeOfFunction(functionElement, node.body);
- recordStaticType(node, node.element.type);
+ functionElement.returnType = _computeStaticReturnTypeOfFunctionExpression(node);
+ _recordPropagatedTypeOfFunction(functionElement, node.body);
+ _recordStaticType(node, node.element.type);
return null;
}
@@ -12183,24 +12183,24 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
ExecutableElement staticMethodElement = node.staticElement;
// Record static return type of the static element.
- Type2 staticStaticType = computeStaticReturnType(staticMethodElement);
- recordStaticType(node, staticStaticType);
+ Type2 staticStaticType = _computeStaticReturnType(staticMethodElement);
+ _recordStaticType(node, staticStaticType);
// Record propagated return type of the static element.
- Type2 staticPropagatedType = computePropagatedReturnType(staticMethodElement);
+ Type2 staticPropagatedType = _computePropagatedReturnType(staticMethodElement);
if (staticPropagatedType != null && (staticStaticType == null || staticPropagatedType.isMoreSpecificThan(staticStaticType))) {
- recordPropagatedType(node, staticPropagatedType);
+ _recordPropagatedType(node, staticPropagatedType);
}
ExecutableElement propagatedMethodElement = node.propagatedElement;
if (propagatedMethodElement != staticMethodElement) {
// Record static return type of the propagated element.
- Type2 propagatedStaticType = computeStaticReturnType(propagatedMethodElement);
+ Type2 propagatedStaticType = _computeStaticReturnType(propagatedMethodElement);
if (propagatedStaticType != null && (staticStaticType == null || propagatedStaticType.isMoreSpecificThan(staticStaticType)) && (staticPropagatedType == null || propagatedStaticType.isMoreSpecificThan(staticPropagatedType))) {
- recordPropagatedType(node, propagatedStaticType);
+ _recordPropagatedType(node, propagatedStaticType);
}
// Record propagated return type of the propagated element.
- Type2 propagatedPropagatedType = computePropagatedReturnType(propagatedMethodElement);
+ Type2 propagatedPropagatedType = _computePropagatedReturnType(propagatedMethodElement);
if (propagatedPropagatedType != null && (staticStaticType == null || propagatedPropagatedType.isMoreSpecificThan(staticStaticType)) && (staticPropagatedType == null || propagatedPropagatedType.isMoreSpecificThan(staticPropagatedType)) && (propagatedStaticType == null || propagatedPropagatedType.isMoreSpecificThan(propagatedStaticType))) {
- recordPropagatedType(node, propagatedPropagatedType);
+ _recordPropagatedType(node, propagatedPropagatedType);
}
}
return null;
@@ -12214,24 +12214,24 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
Object visitIndexExpression(IndexExpression node) {
if (node.inSetterContext()) {
ExecutableElement staticMethodElement = node.staticElement;
- Type2 staticType = computeArgumentType(staticMethodElement);
- recordStaticType(node, staticType);
+ Type2 staticType = _computeArgumentType(staticMethodElement);
+ _recordStaticType(node, staticType);
MethodElement propagatedMethodElement = node.propagatedElement;
if (propagatedMethodElement != staticMethodElement) {
- Type2 propagatedType = computeArgumentType(propagatedMethodElement);
+ Type2 propagatedType = _computeArgumentType(propagatedMethodElement);
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
- recordPropagatedType(node, propagatedType);
+ _recordPropagatedType(node, propagatedType);
}
}
} else {
ExecutableElement staticMethodElement = node.staticElement;
- Type2 staticType = computeStaticReturnType(staticMethodElement);
- recordStaticType(node, staticType);
+ Type2 staticType = _computeStaticReturnType(staticMethodElement);
+ _recordStaticType(node, staticType);
MethodElement propagatedMethodElement = node.propagatedElement;
if (propagatedMethodElement != staticMethodElement) {
- Type2 propagatedType = computeStaticReturnType(propagatedMethodElement);
+ Type2 propagatedType = _computeStaticReturnType(propagatedMethodElement);
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
- recordPropagatedType(node, propagatedType);
+ _recordPropagatedType(node, propagatedType);
}
}
}
@@ -12248,21 +12248,21 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* form <i>const T(a<sub>1</sub>, &hellip;, a<sub>n</sub>)</i> is <i>T</i>. </blockquote>
*/
Object visitInstanceCreationExpression(InstanceCreationExpression node) {
- recordStaticType(node, node.constructorName.type.type);
+ _recordStaticType(node, node.constructorName.type.type);
ConstructorElement element = node.staticElement;
if (element != null && "Element" == element.enclosingElement.name) {
LibraryElement library = element.library;
- if (isHtmlLibrary(library)) {
+ if (_isHtmlLibrary(library)) {
String constructorName = element.name;
if ("tag" == constructorName) {
- Type2 returnType = getFirstArgumentAsTypeWithMap(library, node.argumentList, _HTML_ELEMENT_TO_CLASS_MAP);
+ Type2 returnType = _getFirstArgumentAsTypeWithMap(library, node.argumentList, _HTML_ELEMENT_TO_CLASS_MAP);
if (returnType != null) {
- recordPropagatedType(node, returnType);
+ _recordPropagatedType(node, returnType);
}
} else {
- Type2 returnType = getElementNameAsType(library, constructorName, _HTML_ELEMENT_TO_CLASS_MAP);
+ Type2 returnType = _getElementNameAsType(library, constructorName, _HTML_ELEMENT_TO_CLASS_MAP);
if (returnType != null) {
- recordPropagatedType(node, returnType);
+ _recordPropagatedType(node, returnType);
}
}
}
@@ -12275,7 +12275,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* `int`.</blockquote>
*/
Object visitIntegerLiteral(IntegerLiteral node) {
- recordStaticType(node, _typeProvider.intType);
+ _recordStaticType(node, _typeProvider.intType);
return null;
}
@@ -12286,7 +12286,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* The static type of an is-expression is `bool`.</blockquote>
*/
Object visitIsExpression(IsExpression node) {
- recordStaticType(node, _typeProvider.boolType);
+ _recordStaticType(node, _typeProvider.boolType);
return null;
}
@@ -12305,13 +12305,13 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
NodeList<TypeName> arguments = typeArguments.arguments;
if (arguments != null && arguments.length == 1) {
TypeName argumentTypeName = arguments[0];
- Type2 argumentType = getType(argumentTypeName);
+ Type2 argumentType = _getType(argumentTypeName);
if (argumentType != null) {
staticType = argumentType;
}
}
}
- recordStaticType(node, _typeProvider.listType.substitute4(<Type2> [staticType]));
+ _recordStaticType(node, _typeProvider.listType.substitute4(<Type2> [staticType]));
NodeList<Expression> elements = node.elements;
int count = elements.length;
if (count > 0) {
@@ -12328,7 +12328,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
}
}
if (propagatedType.isMoreSpecificThan(staticType)) {
- recordPropagatedType(node, _typeProvider.listType.substitute4(<Type2> [propagatedType]));
+ _recordPropagatedType(node, _typeProvider.listType.substitute4(<Type2> [propagatedType]));
}
}
return null;
@@ -12354,18 +12354,18 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
NodeList<TypeName> arguments = typeArguments.arguments;
if (arguments != null && arguments.length == 2) {
TypeName entryKeyTypeName = arguments[0];
- Type2 entryKeyType = getType(entryKeyTypeName);
+ Type2 entryKeyType = _getType(entryKeyTypeName);
if (entryKeyType != null) {
staticKeyType = entryKeyType;
}
TypeName entryValueTypeName = arguments[1];
- Type2 entryValueType = getType(entryValueTypeName);
+ Type2 entryValueType = _getType(entryValueTypeName);
if (entryValueType != null) {
staticValueType = entryValueType;
}
}
}
- recordStaticType(node, _typeProvider.mapType.substitute4(<Type2> [staticKeyType, staticValueType]));
+ _recordStaticType(node, _typeProvider.mapType.substitute4(<Type2> [staticKeyType, staticValueType]));
NodeList<MapLiteralEntry> entries = node.entries;
int count = entries.length;
if (count > 0) {
@@ -12402,7 +12402,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
if (!betterValue) {
propagatedValueType = staticValueType;
}
- recordPropagatedType(node, _typeProvider.mapType.substitute4(<Type2> [propagatedKeyType, propagatedValueType]));
+ _recordPropagatedType(node, _typeProvider.mapType.substitute4(<Type2> [propagatedKeyType, propagatedValueType]));
}
}
return null;
@@ -12451,19 +12451,19 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
if (staticMethodElement is LocalVariableElement) {
LocalVariableElement variable = staticMethodElement;
Type2 staticType = variable.type;
- recordStaticType(methodNameNode, staticType);
+ _recordStaticType(methodNameNode, staticType);
Type2 propagatedType = _overrideManager.getType(variable);
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
- recordPropagatedType(methodNameNode, propagatedType);
+ _recordPropagatedType(methodNameNode, propagatedType);
}
}
// Record static return type of the static element.
- Type2 staticStaticType = computeStaticReturnType(staticMethodElement);
- recordStaticType(node, staticStaticType);
+ Type2 staticStaticType = _computeStaticReturnType(staticMethodElement);
+ _recordStaticType(node, staticStaticType);
// Record propagated return type of the static element.
- Type2 staticPropagatedType = computePropagatedReturnType(staticMethodElement);
+ Type2 staticPropagatedType = _computePropagatedReturnType(staticMethodElement);
if (staticPropagatedType != null && (staticStaticType == null || staticPropagatedType.isMoreSpecificThan(staticStaticType))) {
- recordPropagatedType(node, staticPropagatedType);
+ _recordPropagatedType(node, staticPropagatedType);
}
String methodName = methodNameNode.name;
// Future.then(closure) return type is:
@@ -12472,18 +12472,18 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
if (methodName == "then") {
Expression target = node.realTarget;
Type2 targetType = target == null ? null : target.bestType;
- if (isAsyncFutureType(targetType)) {
+ if (_isAsyncFutureType(targetType)) {
NodeList<Expression> arguments = node.argumentList.arguments;
if (arguments.length == 1) {
// TODO(brianwilkerson) Handle the case where both arguments are provided.
Expression closureArg = arguments[0];
if (closureArg is FunctionExpression) {
FunctionExpression closureExpr = closureArg;
- Type2 returnType = computePropagatedReturnType(closureExpr.element);
+ Type2 returnType = _computePropagatedReturnType(closureExpr.element);
if (returnType != null) {
// prepare the type of the returned Future
InterfaceTypeImpl newFutureType;
- if (isAsyncFutureType(returnType)) {
+ if (_isAsyncFutureType(returnType)) {
newFutureType = returnType as InterfaceTypeImpl;
} else {
InterfaceType futureType = targetType as InterfaceType;
@@ -12491,7 +12491,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
newFutureType.typeArguments = <Type2> [returnType];
}
// set the 'then' invocation type
- recordPropagatedType(node, newFutureType);
+ _recordPropagatedType(node, newFutureType);
return null;
}
}
@@ -12504,10 +12504,10 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
Type2 targetType = target.bestType;
if (targetType is InterfaceType && (targetType.name == "HtmlDocument" || targetType.name == "Document")) {
LibraryElement library = targetType.element.library;
- if (isHtmlLibrary(library)) {
- Type2 returnType = getFirstArgumentAsType(library, node.argumentList);
+ if (_isHtmlLibrary(library)) {
+ Type2 returnType = _getFirstArgumentAsType(library, node.argumentList);
if (returnType != null) {
- recordPropagatedType(node, returnType);
+ _recordPropagatedType(node, returnType);
}
}
}
@@ -12518,10 +12518,10 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
Element methodElement = methodNameNode.bestElement;
if (methodElement != null) {
LibraryElement library = methodElement.library;
- if (isHtmlLibrary(library)) {
- Type2 returnType = getFirstArgumentAsQuery(library, node.argumentList);
+ if (_isHtmlLibrary(library)) {
+ Type2 returnType = _getFirstArgumentAsQuery(library, node.argumentList);
if (returnType != null) {
- recordPropagatedType(node, returnType);
+ _recordPropagatedType(node, returnType);
}
}
}
@@ -12529,10 +12529,10 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
Type2 targetType = target.bestType;
if (targetType is InterfaceType && (targetType.name == "HtmlDocument" || targetType.name == "Document")) {
LibraryElement library = targetType.element.library;
- if (isHtmlLibrary(library)) {
- Type2 returnType = getFirstArgumentAsQuery(library, node.argumentList);
+ if (_isHtmlLibrary(library)) {
+ Type2 returnType = _getFirstArgumentAsQuery(library, node.argumentList);
if (returnType != null) {
- recordPropagatedType(node, returnType);
+ _recordPropagatedType(node, returnType);
}
}
}
@@ -12542,30 +12542,30 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
Type2 targetType = target.bestType;
if (targetType is InterfaceType && (targetType.name == "HtmlDocument" || targetType.name == "Document")) {
LibraryElement library = targetType.element.library;
- if (isHtmlLibrary(library)) {
- Type2 returnType = getFirstArgumentAsQuery(library, node.argumentList);
+ if (_isHtmlLibrary(library)) {
+ Type2 returnType = _getFirstArgumentAsQuery(library, node.argumentList);
if (returnType != null) {
- recordPropagatedType(node, returnType);
+ _recordPropagatedType(node, returnType);
}
}
}
} else if (methodName == "JS") {
- Type2 returnType = getFirstArgumentAsType(_typeProvider.objectType.element.library, node.argumentList);
+ Type2 returnType = _getFirstArgumentAsType(_typeProvider.objectType.element.library, node.argumentList);
if (returnType != null) {
- recordPropagatedType(node, returnType);
+ _recordPropagatedType(node, returnType);
}
} else {
Element propagatedElement = methodNameNode.propagatedElement;
if (propagatedElement != staticMethodElement) {
// Record static return type of the propagated element.
- Type2 propagatedStaticType = computeStaticReturnType(propagatedElement);
+ Type2 propagatedStaticType = _computeStaticReturnType(propagatedElement);
if (propagatedStaticType != null && (staticStaticType == null || propagatedStaticType.isMoreSpecificThan(staticStaticType)) && (staticPropagatedType == null || propagatedStaticType.isMoreSpecificThan(staticPropagatedType))) {
- recordPropagatedType(node, propagatedStaticType);
+ _recordPropagatedType(node, propagatedStaticType);
}
// Record propagated return type of the propagated element.
- Type2 propagatedPropagatedType = computePropagatedReturnType(propagatedElement);
+ Type2 propagatedPropagatedType = _computePropagatedReturnType(propagatedElement);
if (propagatedPropagatedType != null && (staticStaticType == null || propagatedPropagatedType.isMoreSpecificThan(staticStaticType)) && (staticPropagatedType == null || propagatedPropagatedType.isMoreSpecificThan(staticPropagatedType)) && (propagatedStaticType == null || propagatedPropagatedType.isMoreSpecificThan(propagatedStaticType))) {
- recordPropagatedType(node, propagatedPropagatedType);
+ _recordPropagatedType(node, propagatedPropagatedType);
}
}
}
@@ -12574,8 +12574,8 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
Object visitNamedExpression(NamedExpression node) {
Expression expression = node.expression;
- recordStaticType(node, getStaticType(expression));
- recordPropagatedType(node, expression.propagatedType);
+ _recordStaticType(node, _getStaticType(expression));
+ _recordPropagatedType(node, expression.propagatedType);
return null;
}
@@ -12584,14 +12584,14 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* </blockquote>
*/
Object visitNullLiteral(NullLiteral node) {
- recordStaticType(node, _typeProvider.bottomType);
+ _recordStaticType(node, _typeProvider.bottomType);
return null;
}
Object visitParenthesizedExpression(ParenthesizedExpression node) {
Expression expression = node.expression;
- recordStaticType(node, getStaticType(expression));
- recordPropagatedType(node, expression.propagatedType);
+ _recordStaticType(node, _getStaticType(expression));
+ _recordPropagatedType(node, expression.propagatedType);
return null;
}
@@ -12623,16 +12623,16 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
*/
Object visitPostfixExpression(PostfixExpression node) {
Expression operand = node.operand;
- Type2 staticType = getStaticType(operand);
+ Type2 staticType = _getStaticType(operand);
sc.TokenType operator = node.operator.type;
if (identical(operator, sc.TokenType.MINUS_MINUS) || identical(operator, sc.TokenType.PLUS_PLUS)) {
Type2 intType = _typeProvider.intType;
- if (identical(getStaticType(node.operand), intType)) {
+ if (identical(_getStaticType(node.operand), intType)) {
staticType = intType;
}
}
- recordStaticType(node, staticType);
- recordPropagatedType(node, operand.propagatedType);
+ _recordStaticType(node, staticType);
+ _recordPropagatedType(node, operand.propagatedType);
return null;
}
@@ -12644,13 +12644,13 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
Element staticElement = prefixedIdentifier.staticElement;
Type2 staticType = _dynamicType;
if (staticElement is ClassElement) {
- if (isNotTypeLiteral(node)) {
+ if (_isNotTypeLiteral(node)) {
staticType = staticElement.type;
} else {
staticType = _typeProvider.typeType;
}
} else if (staticElement is FunctionTypeAliasElement) {
- if (isNotTypeLiteral(node)) {
+ if (_isNotTypeLiteral(node)) {
staticType = staticElement.type;
} else {
staticType = _typeProvider.typeType;
@@ -12658,7 +12658,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
} else if (staticElement is MethodElement) {
staticType = staticElement.type;
} else if (staticElement is PropertyAccessorElement) {
- staticType = getTypeOfProperty(staticElement, node.prefix.staticType);
+ staticType = _getTypeOfProperty(staticElement, node.prefix.staticType);
} else if (staticElement is ExecutableElement) {
staticType = staticElement.type;
} else if (staticElement is TypeParameterElement) {
@@ -12666,12 +12666,12 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
} else if (staticElement is VariableElement) {
staticType = staticElement.type;
}
- recordStaticType(prefixedIdentifier, staticType);
- recordStaticType(node, staticType);
+ _recordStaticType(prefixedIdentifier, staticType);
+ _recordStaticType(node, staticType);
Element propagatedElement = prefixedIdentifier.propagatedElement;
Type2 propagatedType = null;
if (propagatedElement is ClassElement) {
- if (isNotTypeLiteral(node)) {
+ if (_isNotTypeLiteral(node)) {
propagatedType = propagatedElement.type;
} else {
propagatedType = _typeProvider.typeType;
@@ -12681,7 +12681,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
} else if (propagatedElement is MethodElement) {
propagatedType = propagatedElement.type;
} else if (propagatedElement is PropertyAccessorElement) {
- propagatedType = getTypeOfProperty(propagatedElement, node.prefix.staticType);
+ propagatedType = _getTypeOfProperty(propagatedElement, node.prefix.staticType);
} else if (propagatedElement is ExecutableElement) {
propagatedType = propagatedElement.type;
} else if (propagatedElement is TypeParameterElement) {
@@ -12694,8 +12694,8 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
propagatedType = overriddenType;
}
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
- recordPropagatedType(prefixedIdentifier, propagatedType);
- recordPropagatedType(node, propagatedType);
+ _recordPropagatedType(prefixedIdentifier, propagatedType);
+ _recordPropagatedType(node, propagatedType);
}
return null;
}
@@ -12708,23 +12708,23 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
Object visitPrefixExpression(PrefixExpression node) {
sc.TokenType operator = node.operator.type;
if (identical(operator, sc.TokenType.BANG)) {
- recordStaticType(node, _typeProvider.boolType);
+ _recordStaticType(node, _typeProvider.boolType);
} else {
// The other cases are equivalent to invoking a method.
ExecutableElement staticMethodElement = node.staticElement;
- Type2 staticType = computeStaticReturnType(staticMethodElement);
+ Type2 staticType = _computeStaticReturnType(staticMethodElement);
if (identical(operator, sc.TokenType.MINUS_MINUS) || identical(operator, sc.TokenType.PLUS_PLUS)) {
Type2 intType = _typeProvider.intType;
- if (identical(getStaticType(node.operand), intType)) {
+ if (identical(_getStaticType(node.operand), intType)) {
staticType = intType;
}
}
- recordStaticType(node, staticType);
+ _recordStaticType(node, staticType);
MethodElement propagatedMethodElement = node.propagatedElement;
if (propagatedMethodElement != staticMethodElement) {
- Type2 propagatedType = computeStaticReturnType(propagatedMethodElement);
+ Type2 propagatedType = _computeStaticReturnType(propagatedMethodElement);
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
- recordPropagatedType(node, propagatedType);
+ _recordPropagatedType(node, propagatedType);
}
}
}
@@ -12780,23 +12780,23 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
staticType = staticElement.type;
} else if (staticElement is PropertyAccessorElement) {
Expression realTarget = node.realTarget;
- staticType = getTypeOfProperty(staticElement, realTarget != null ? getStaticType(realTarget) : null);
+ staticType = _getTypeOfProperty(staticElement, realTarget != null ? _getStaticType(realTarget) : null);
} else {
}
- recordStaticType(propertyName, staticType);
- recordStaticType(node, staticType);
+ _recordStaticType(propertyName, staticType);
+ _recordStaticType(node, staticType);
Element propagatedElement = propertyName.propagatedElement;
Type2 propagatedType = _overrideManager.getType(propagatedElement);
if (propagatedElement is MethodElement) {
propagatedType = propagatedElement.type;
} else if (propagatedElement is PropertyAccessorElement) {
Expression realTarget = node.realTarget;
- propagatedType = getTypeOfProperty(propagatedElement, realTarget != null ? realTarget.bestType : null);
+ propagatedType = _getTypeOfProperty(propagatedElement, realTarget != null ? realTarget.bestType : null);
} else {
}
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
- recordPropagatedType(propertyName, propagatedType);
- recordPropagatedType(node, propagatedType);
+ _recordPropagatedType(propertyName, propagatedType);
+ _recordPropagatedType(node, propagatedType);
}
return null;
}
@@ -12806,7 +12806,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* bottom.</blockquote>
*/
Object visitRethrowExpression(RethrowExpression node) {
- recordStaticType(node, _typeProvider.bottomType);
+ _recordStaticType(node, _typeProvider.bottomType);
return null;
}
@@ -12852,13 +12852,13 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
Element element = node.staticElement;
Type2 staticType = _dynamicType;
if (element is ClassElement) {
- if (isNotTypeLiteral(node)) {
+ if (_isNotTypeLiteral(node)) {
staticType = element.type;
} else {
staticType = _typeProvider.typeType;
}
} else if (element is FunctionTypeAliasElement) {
- if (isNotTypeLiteral(node)) {
+ if (_isNotTypeLiteral(node)) {
staticType = element.type;
} else {
staticType = _typeProvider.typeType;
@@ -12866,7 +12866,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
} else if (element is MethodElement) {
staticType = element.type;
} else if (element is PropertyAccessorElement) {
- staticType = getTypeOfProperty(element, null);
+ staticType = _getTypeOfProperty(element, null);
} else if (element is ExecutableElement) {
staticType = element.type;
} else if (element is TypeParameterElement) {
@@ -12880,12 +12880,12 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
} else {
staticType = _dynamicType;
}
- recordStaticType(node, staticType);
+ _recordStaticType(node, staticType);
// TODO(brianwilkerson) I think we want to repeat the logic above using the propagated element
// to get another candidate for the propagated type.
Type2 propagatedType = _overrideManager.getType(element);
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
- recordPropagatedType(node, propagatedType);
+ _recordPropagatedType(node, propagatedType);
}
return null;
}
@@ -12895,7 +12895,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* `String`.</blockquote>
*/
Object visitSimpleStringLiteral(SimpleStringLiteral node) {
- recordStaticType(node, _typeProvider.stringType);
+ _recordStaticType(node, _typeProvider.stringType);
return null;
}
@@ -12904,22 +12904,22 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* `String`.</blockquote>
*/
Object visitStringInterpolation(StringInterpolation node) {
- recordStaticType(node, _typeProvider.stringType);
+ _recordStaticType(node, _typeProvider.stringType);
return null;
}
Object visitSuperExpression(SuperExpression node) {
if (_thisType == null) {
// TODO(brianwilkerson) Report this error if it hasn't already been reported
- recordStaticType(node, _dynamicType);
+ _recordStaticType(node, _dynamicType);
} else {
- recordStaticType(node, _thisType);
+ _recordStaticType(node, _thisType);
}
return null;
}
Object visitSymbolLiteral(SymbolLiteral node) {
- recordStaticType(node, _typeProvider.symbolType);
+ _recordStaticType(node, _typeProvider.symbolType);
return null;
}
@@ -12930,9 +12930,9 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
Object visitThisExpression(ThisExpression node) {
if (_thisType == null) {
// TODO(brianwilkerson) Report this error if it hasn't already been reported
- recordStaticType(node, _dynamicType);
+ _recordStaticType(node, _dynamicType);
} else {
- recordStaticType(node, _thisType);
+ _recordStaticType(node, _thisType);
}
return null;
}
@@ -12942,7 +12942,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* bottom.</blockquote>
*/
Object visitThrowExpression(ThrowExpression node) {
- recordStaticType(node, _typeProvider.bottomType);
+ _recordStaticType(node, _typeProvider.bottomType);
return null;
}
@@ -12951,7 +12951,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
if (initializer != null) {
Type2 rightType = initializer.bestType;
SimpleIdentifier name = node.name;
- recordPropagatedType(name, rightType);
+ _recordPropagatedType(name, rightType);
VariableElement element = name.staticElement as VariableElement;
if (element != null) {
_resolver.overrideVariable(element, rightType);
@@ -12966,7 +12966,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
*
* @param element the element representing the method invoked by the given node
*/
- Type2 computeArgumentType(ExecutableElement element) {
+ Type2 _computeArgumentType(ExecutableElement element) {
if (element != null) {
List<ParameterElement> parameters = element.parameters;
if (parameters != null && parameters.length == 2) {
@@ -12982,7 +12982,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param element the element representing the method or function invoked by the given node
* @return the propagated return type that was computed
*/
- Type2 computePropagatedReturnType(Element element) {
+ Type2 _computePropagatedReturnType(Element element) {
if (element is ExecutableElement) {
return _propagatedReturnTypes[element];
}
@@ -12997,7 +12997,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param body the boy of the function whose propagated return type is to be computed
* @return the propagated return type that was computed
*/
- Type2 computePropagatedReturnTypeOfFunction(FunctionBody body) {
+ Type2 _computePropagatedReturnTypeOfFunction(FunctionBody body) {
if (body is ExpressionFunctionBody) {
ExpressionFunctionBody expressionBody = body;
return expressionBody.expression.bestType;
@@ -13016,7 +13016,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param element the element representing the method or function invoked by the given node
* @return the static return type that was computed
*/
- Type2 computeStaticReturnType(Element element) {
+ Type2 _computeStaticReturnType(Element element) {
if (element is PropertyAccessorElement) {
//
// This is a function invocation expression disguised as something else. We are invoking a
@@ -13066,7 +13066,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param node the function expression whose static return type is to be computed
* @return the static return type that was computed
*/
- Type2 computeStaticReturnTypeOfFunctionDeclaration(FunctionDeclaration node) {
+ Type2 _computeStaticReturnTypeOfFunctionDeclaration(FunctionDeclaration node) {
TypeName returnType = node.returnType;
if (returnType == null) {
return _dynamicType;
@@ -13082,10 +13082,10 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param node the function expression whose return type is to be computed
* @return the return type that was computed
*/
- Type2 computeStaticReturnTypeOfFunctionExpression(FunctionExpression node) {
+ Type2 _computeStaticReturnTypeOfFunctionExpression(FunctionExpression node) {
FunctionBody body = node.body;
if (body is ExpressionFunctionBody) {
- return getStaticType(body.expression);
+ return _getStaticType(body.expression);
}
return _dynamicType;
}
@@ -13099,7 +13099,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param nameMap an optional map used to map the element name to a type name
* @return the type specified by the first argument in the argument list
*/
- Type2 getElementNameAsType(LibraryElement library, String elementName, Map<String, String> nameMap) {
+ Type2 _getElementNameAsType(LibraryElement library, String elementName, Map<String, String> nameMap) {
if (elementName != null) {
if (nameMap != null) {
elementName = nameMap[elementName.toLowerCase()];
@@ -13121,8 +13121,8 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param argumentList the list of arguments from which a type is to be extracted
* @return the type specified by the first argument in the argument list
*/
- Type2 getFirstArgumentAsQuery(LibraryElement library, ArgumentList argumentList) {
- String argumentValue = getFirstArgumentAsString(argumentList);
+ Type2 _getFirstArgumentAsQuery(LibraryElement library, ArgumentList argumentList) {
+ String argumentValue = _getFirstArgumentAsString(argumentList);
if (argumentValue != null) {
//
// If the query has spaces, full parsing is required because it might be:
@@ -13155,7 +13155,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param argumentList the list of arguments from which a string value is to be extracted
* @return the string specified by the first argument in the argument list
*/
- String getFirstArgumentAsString(ArgumentList argumentList) {
+ String _getFirstArgumentAsString(ArgumentList argumentList) {
NodeList<Expression> arguments = argumentList.arguments;
if (arguments.length > 0) {
Expression argument = arguments[0];
@@ -13175,7 +13175,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param argumentList the list of arguments from which a type is to be extracted
* @return the type specified by the first argument in the argument list
*/
- Type2 getFirstArgumentAsType(LibraryElement library, ArgumentList argumentList) => getFirstArgumentAsTypeWithMap(library, argumentList, null);
+ Type2 _getFirstArgumentAsType(LibraryElement library, ArgumentList argumentList) => _getFirstArgumentAsTypeWithMap(library, argumentList, null);
/**
* If the given argument list contains at least one argument, and if the argument is a simple
@@ -13187,7 +13187,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param nameMap an optional map used to map the element name to a type name
* @return the type specified by the first argument in the argument list
*/
- Type2 getFirstArgumentAsTypeWithMap(LibraryElement library, ArgumentList argumentList, Map<String, String> nameMap) => getElementNameAsType(library, getFirstArgumentAsString(argumentList), nameMap);
+ Type2 _getFirstArgumentAsTypeWithMap(LibraryElement library, ArgumentList argumentList, Map<String, String> nameMap) => _getElementNameAsType(library, _getFirstArgumentAsString(argumentList), nameMap);
/**
* Return the static type of the given expression.
@@ -13195,7 +13195,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param expression the expression whose type is to be returned
* @return the static type of the given expression
*/
- Type2 getStaticType(Expression expression) {
+ Type2 _getStaticType(Expression expression) {
Type2 type = expression.staticType;
if (type == null) {
// TODO(brianwilkerson) Determine the conditions for which the static type is null.
@@ -13210,7 +13210,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param typeName the type name representing the type to be returned
* @return the type represented by the type name
*/
- Type2 getType(TypeName typeName) {
+ Type2 _getType(TypeName typeName) {
Type2 type = typeName.type;
if (type == null) {
//TODO(brianwilkerson) Determine the conditions for which the type is null.
@@ -13229,7 +13229,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* specific type information
* @return the type that should be recorded for a node that resolved to the given accessor
*/
- Type2 getTypeOfProperty(PropertyAccessorElement accessor, Type2 context) {
+ Type2 _getTypeOfProperty(PropertyAccessorElement accessor, Type2 context) {
FunctionType functionType = accessor.type;
if (functionType == null) {
// TODO(brianwilkerson) Report this internal error. This happens when we are analyzing a
@@ -13274,7 +13274,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* Return `true` if the given [Type] is the `Future` form the 'dart:async'
* library.
*/
- bool isAsyncFutureType(Type2 type) => type is InterfaceType && type.name == "Future" && isAsyncLibrary(type.element.library);
+ bool _isAsyncFutureType(Type2 type) => type is InterfaceType && type.name == "Future" && _isAsyncLibrary(type.element.library);
/**
* Return `true` if the given library is the 'dart:async' library.
@@ -13282,7 +13282,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param library the library being tested
* @return `true` if the library is 'dart:async'
*/
- bool isAsyncLibrary(LibraryElement library) => library.name == "dart.async";
+ bool _isAsyncLibrary(LibraryElement library) => library.name == "dart.async";
/**
* Return `true` if the given library is the 'dart:html' library.
@@ -13290,7 +13290,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param library the library being tested
* @return `true` if the library is 'dart:html'
*/
- bool isHtmlLibrary(LibraryElement library) => library != null && "dart.dom.html" == library.name;
+ bool _isHtmlLibrary(LibraryElement library) => library != null && "dart.dom.html" == library.name;
/**
* Return `true` if the given node is not a type literal.
@@ -13298,7 +13298,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param node the node being tested
* @return `true` if the given node is not a type literal
*/
- bool isNotTypeLiteral(Identifier node) {
+ bool _isNotTypeLiteral(Identifier node) {
AstNode parent = node.parent;
return parent is TypeName || (parent is PrefixedIdentifier && (parent.parent is TypeName || identical(parent.prefix, node))) || (parent is PropertyAccess && identical(parent.target, node)) || (parent is MethodInvocation && identical(node, parent.target));
}
@@ -13309,7 +13309,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param expression the node whose type is to be recorded
* @param type the propagated type of the node
*/
- void recordPropagatedType(Expression expression, Type2 type) {
+ void _recordPropagatedType(Expression expression, Type2 type) {
if (type != null && !type.isDynamic) {
expression.propagatedType = type;
}
@@ -13324,8 +13324,8 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @return the propagated return type that was computed, may be `null` if it is not more
* specific than the static return type.
*/
- void recordPropagatedTypeOfFunction(ExecutableElement functionElement, FunctionBody body) {
- Type2 propagatedReturnType = computePropagatedReturnTypeOfFunction(body);
+ void _recordPropagatedTypeOfFunction(ExecutableElement functionElement, FunctionBody body) {
+ Type2 propagatedReturnType = _computePropagatedReturnTypeOfFunction(body);
if (propagatedReturnType == null) {
return;
}
@@ -13348,7 +13348,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param expression the node whose type is to be recorded
* @param type the static type of the node
*/
- void recordStaticType(Expression expression, Type2 type) {
+ void _recordStaticType(Expression expression, Type2 type) {
if (type == null) {
expression.staticType = _dynamicType;
} else {
@@ -13363,24 +13363,24 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* @param staticType the static type of the expression as resolved
* @return the better type guess, or the same static type as given
*/
- Type2 refineBinaryExpressionType(BinaryExpression node, Type2 staticType) {
+ Type2 _refineBinaryExpressionType(BinaryExpression node, Type2 staticType) {
sc.TokenType operator = node.operator.type;
// bool
if (identical(operator, sc.TokenType.AMPERSAND_AMPERSAND) || identical(operator, sc.TokenType.BAR_BAR) || identical(operator, sc.TokenType.EQ_EQ) || identical(operator, sc.TokenType.BANG_EQ)) {
return _typeProvider.boolType;
}
Type2 intType = _typeProvider.intType;
- if (getStaticType(node.leftOperand) == intType) {
+ if (_getStaticType(node.leftOperand) == intType) {
// int op double
if (identical(operator, sc.TokenType.MINUS) || identical(operator, sc.TokenType.PERCENT) || identical(operator, sc.TokenType.PLUS) || identical(operator, sc.TokenType.STAR)) {
Type2 doubleType = _typeProvider.doubleType;
- if (getStaticType(node.rightOperand) == doubleType) {
+ if (_getStaticType(node.rightOperand) == doubleType) {
return doubleType;
}
}
// int op int
if (identical(operator, sc.TokenType.MINUS) || identical(operator, sc.TokenType.PERCENT) || identical(operator, sc.TokenType.PLUS) || identical(operator, sc.TokenType.STAR) || identical(operator, sc.TokenType.TILDE_SLASH)) {
- if (getStaticType(node.rightOperand) == intType) {
+ if (_getStaticType(node.rightOperand) == intType) {
staticType = intType;
}
}
@@ -13444,10 +13444,10 @@ class SubtypeManager {
*/
Set<ClassElement> computeAllSubtypes(ClassElement classElement) {
// Ensure that we have generated the subtype map for the library
- computeSubtypesInLibrary(classElement.library);
+ _computeSubtypesInLibrary(classElement.library);
// use the subtypeMap to compute the set of all subtypes and subtype's subtypes
Set<ClassElement> allSubtypes = new Set<ClassElement>();
- safelyComputeAllSubtypes(classElement, new Set<ClassElement>(), allSubtypes);
+ _safelyComputeAllSubtypes(classElement, new Set<ClassElement>(), allSubtypes);
return allSubtypes;
}
@@ -13458,7 +13458,7 @@ class SubtypeManager {
* @param libraryElement the library to visit, it it hasn't been visited already
*/
void ensureLibraryVisited(LibraryElement libraryElement) {
- computeSubtypesInLibrary(libraryElement);
+ _computeSubtypesInLibrary(libraryElement);
}
/**
@@ -13467,26 +13467,26 @@ class SubtypeManager {
*
* @param classElement the class element
*/
- void computeSubtypesInClass(ClassElement classElement) {
+ void _computeSubtypesInClass(ClassElement classElement) {
InterfaceType supertypeType = classElement.supertype;
if (supertypeType != null) {
ClassElement supertypeElement = supertypeType.element;
if (supertypeElement != null) {
- putInSubtypeMap(supertypeElement, classElement);
+ _putInSubtypeMap(supertypeElement, classElement);
}
}
List<InterfaceType> interfaceTypes = classElement.interfaces;
for (InterfaceType interfaceType in interfaceTypes) {
ClassElement interfaceElement = interfaceType.element;
if (interfaceElement != null) {
- putInSubtypeMap(interfaceElement, classElement);
+ _putInSubtypeMap(interfaceElement, classElement);
}
}
List<InterfaceType> mixinTypes = classElement.mixins;
for (InterfaceType mixinType in mixinTypes) {
ClassElement mixinElement = mixinType.element;
if (mixinElement != null) {
- putInSubtypeMap(mixinElement, classElement);
+ _putInSubtypeMap(mixinElement, classElement);
}
}
}
@@ -13498,10 +13498,10 @@ class SubtypeManager {
*
* @param unitElement the compilation unit element
*/
- void computeSubtypesInCompilationUnit(CompilationUnitElement unitElement) {
+ void _computeSubtypesInCompilationUnit(CompilationUnitElement unitElement) {
List<ClassElement> classElements = unitElement.types;
for (ClassElement classElement in classElements) {
- computeSubtypesInClass(classElement);
+ _computeSubtypesInClass(classElement);
}
}
@@ -13513,23 +13513,23 @@ class SubtypeManager {
*
* @param libraryElement the library element
*/
- void computeSubtypesInLibrary(LibraryElement libraryElement) {
+ void _computeSubtypesInLibrary(LibraryElement libraryElement) {
if (libraryElement == null || _visitedLibraries.contains(libraryElement)) {
return;
}
_visitedLibraries.add(libraryElement);
- computeSubtypesInCompilationUnit(libraryElement.definingCompilationUnit);
+ _computeSubtypesInCompilationUnit(libraryElement.definingCompilationUnit);
List<CompilationUnitElement> parts = libraryElement.parts;
for (CompilationUnitElement part in parts) {
- computeSubtypesInCompilationUnit(part);
+ _computeSubtypesInCompilationUnit(part);
}
List<LibraryElement> imports = libraryElement.importedLibraries;
for (LibraryElement importElt in imports) {
- computeSubtypesInLibrary(importElt.library);
+ _computeSubtypesInLibrary(importElt.library);
}
List<LibraryElement> exports = libraryElement.exportedLibraries;
for (LibraryElement exportElt in exports) {
- computeSubtypesInLibrary(exportElt.library);
+ _computeSubtypesInLibrary(exportElt.library);
}
}
@@ -13539,7 +13539,7 @@ class SubtypeManager {
* @param supertypeElement the key for the [subtypeMap] map
* @param subtypeElement the value for the [subtypeMap] map
*/
- void putInSubtypeMap(ClassElement supertypeElement, ClassElement subtypeElement) {
+ void _putInSubtypeMap(ClassElement supertypeElement, ClassElement subtypeElement) {
Set<ClassElement> subtypes = _subtypeMap[supertypeElement];
if (subtypes == null) {
subtypes = new Set<ClassElement>();
@@ -13556,7 +13556,7 @@ class SubtypeManager {
* @param visitedClasses the set of class elements that this method has already recursively seen
* @param allSubtypes the computed set of subtypes of the passed class element
*/
- void safelyComputeAllSubtypes(ClassElement classElement, Set<ClassElement> visitedClasses, Set<ClassElement> allSubtypes) {
+ void _safelyComputeAllSubtypes(ClassElement classElement, Set<ClassElement> visitedClasses, Set<ClassElement> allSubtypes) {
if (!visitedClasses.add(classElement)) {
// if this class has already been called on this class element
return;
@@ -13566,7 +13566,7 @@ class SubtypeManager {
return;
}
for (ClassElement subtype in subtypes) {
- safelyComputeAllSubtypes(subtype, visitedClasses, allSubtypes);
+ _safelyComputeAllSubtypes(subtype, visitedClasses, allSubtypes);
}
allSubtypes.addAll(subtypes);
}
@@ -14105,7 +14105,7 @@ class TypeProviderImpl implements TypeProvider {
* @param coreLibrary the element representing the core library (dart:core).
*/
TypeProviderImpl(LibraryElement coreLibrary) {
- initializeFrom(coreLibrary);
+ _initializeFrom(coreLibrary);
}
InterfaceType get boolType => _boolType;
@@ -14148,7 +14148,7 @@ class TypeProviderImpl implements TypeProvider {
* @param typeName the name of the type being searched for
* @return the type that was found
*/
- InterfaceType getType(Namespace namespace, String typeName) {
+ InterfaceType _getType(Namespace namespace, String typeName) {
Element element = namespace.get(typeName);
if (element == null) {
AnalysisEngine.instance.logger.logInformation("No definition of type ${typeName}");
@@ -14162,24 +14162,24 @@ class TypeProviderImpl implements TypeProvider {
*
* @param library the library containing the definitions of the core types
*/
- void initializeFrom(LibraryElement library) {
+ void _initializeFrom(LibraryElement library) {
Namespace namespace = new NamespaceBuilder().createPublicNamespaceForLibrary(library);
- _boolType = getType(namespace, "bool");
+ _boolType = _getType(namespace, "bool");
_bottomType = BottomTypeImpl.instance;
- _deprecatedType = getType(namespace, "Deprecated");
- _doubleType = getType(namespace, "double");
+ _deprecatedType = _getType(namespace, "Deprecated");
+ _doubleType = _getType(namespace, "double");
_dynamicType = DynamicTypeImpl.instance;
- _functionType = getType(namespace, "Function");
- _intType = getType(namespace, "int");
- _listType = getType(namespace, "List");
- _mapType = getType(namespace, "Map");
- _nullType = getType(namespace, "Null");
- _numType = getType(namespace, "num");
- _objectType = getType(namespace, "Object");
- _stackTraceType = getType(namespace, "StackTrace");
- _stringType = getType(namespace, "String");
- _symbolType = getType(namespace, "Symbol");
- _typeType = getType(namespace, "Type");
+ _functionType = _getType(namespace, "Function");
+ _intType = _getType(namespace, "int");
+ _listType = _getType(namespace, "List");
+ _mapType = _getType(namespace, "Map");
+ _nullType = _getType(namespace, "Null");
+ _numType = _getType(namespace, "num");
+ _objectType = _getType(namespace, "Object");
+ _stackTraceType = _getType(namespace, "StackTrace");
+ _stringType = _getType(namespace, "String");
+ _symbolType = _getType(namespace, "Symbol");
+ _typeType = _getType(namespace, "Type");
}
}
@@ -14193,7 +14193,7 @@ class TypeResolverVisitor extends ScopedVisitor {
/**
* @return `true` if the name of the given [TypeName] is an built-in identifier.
*/
- static bool isBuiltInIdentifier(TypeName node) {
+ static bool _isBuiltInIdentifier(TypeName node) {
sc.Token token = node.name.beginToken;
return identical(token.type, sc.TokenType.KEYWORD);
}
@@ -14201,7 +14201,7 @@ class TypeResolverVisitor extends ScopedVisitor {
/**
* @return `true` if given [TypeName] is used as a type annotation.
*/
- static bool isTypeAnnotation(TypeName node) {
+ static bool _isTypeAnnotation(TypeName node) {
AstNode parent = node.parent;
if (parent is VariableDeclarationList) {
return identical(parent.type, node);
@@ -14275,9 +14275,9 @@ class TypeResolverVisitor extends ScopedVisitor {
if (exceptionTypeName == null) {
exceptionType = typeProvider.dynamicType;
} else {
- exceptionType = getType(exceptionTypeName);
+ exceptionType = _getType(exceptionTypeName);
}
- recordType(exception, exceptionType);
+ _recordType(exception, exceptionType);
Element element = exception.staticElement;
if (element is VariableElementImpl) {
element.type = exceptionType;
@@ -14286,7 +14286,7 @@ class TypeResolverVisitor extends ScopedVisitor {
}
SimpleIdentifier stackTrace = node.stackTraceParameter;
if (stackTrace != null) {
- recordType(stackTrace, typeProvider.stackTraceType);
+ _recordType(stackTrace, typeProvider.stackTraceType);
}
return null;
}
@@ -14294,12 +14294,12 @@ class TypeResolverVisitor extends ScopedVisitor {
Object visitClassDeclaration(ClassDeclaration node) {
_hasReferenceToSuper = false;
super.visitClassDeclaration(node);
- ClassElementImpl classElement = getClassElement(node.name);
+ ClassElementImpl classElement = _getClassElement(node.name);
InterfaceType superclassType = null;
ExtendsClause extendsClause = node.extendsClause;
if (extendsClause != null) {
ErrorCode errorCode = (node.withClause == null ? CompileTimeErrorCode.EXTENDS_NON_CLASS : CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS);
- superclassType = resolveType(extendsClause.superclass, errorCode, errorCode);
+ superclassType = _resolveType(extendsClause.superclass, errorCode, errorCode);
if (superclassType != typeProvider.objectType) {
classElement.validMixin = false;
}
@@ -14314,15 +14314,15 @@ class TypeResolverVisitor extends ScopedVisitor {
classElement.supertype = superclassType;
classElement.hasReferenceToSuper = _hasReferenceToSuper;
}
- resolve(classElement, node.withClause, node.implementsClause);
+ _resolve(classElement, node.withClause, node.implementsClause);
return null;
}
Object visitClassTypeAlias(ClassTypeAlias node) {
super.visitClassTypeAlias(node);
- ClassElementImpl classElement = getClassElement(node.name);
+ ClassElementImpl classElement = _getClassElement(node.name);
ErrorCode errorCode = CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS;
- InterfaceType superclassType = resolveType(node.superclass, errorCode, errorCode);
+ InterfaceType superclassType = _resolveType(node.superclass, errorCode, errorCode);
if (superclassType == null) {
superclassType = typeProvider.objectType;
}
@@ -14334,20 +14334,20 @@ class TypeResolverVisitor extends ScopedVisitor {
int count = constructors.length;
if (count > 0) {
List<Type2> parameterTypes = TypeParameterTypeImpl.getTypes(superclassType.typeParameters);
- List<Type2> argumentTypes = getArgumentTypes(node.superclass.typeArguments, parameterTypes);
+ List<Type2> argumentTypes = _getArgumentTypes(node.superclass.typeArguments, parameterTypes);
InterfaceType classType = classElement.type;
List<ConstructorElement> implicitConstructors = new List<ConstructorElement>();
for (int i = 0; i < count; i++) {
ConstructorElement explicitConstructor = constructors[i];
if (!explicitConstructor.isFactory) {
- implicitConstructors.add(createImplicitContructor(classType, explicitConstructor, parameterTypes, argumentTypes));
+ implicitConstructors.add(_createImplicitContructor(classType, explicitConstructor, parameterTypes, argumentTypes));
}
}
classElement.constructors = new List.from(implicitConstructors);
}
}
}
- resolve(classElement, node.withClause, node.implementsClause);
+ _resolve(classElement, node.withClause, node.implementsClause);
return null;
}
@@ -14369,7 +14369,7 @@ class TypeResolverVisitor extends ScopedVisitor {
if (typeName == null) {
declaredType = _dynamicType;
} else {
- declaredType = getType(typeName);
+ declaredType = _getType(typeName);
}
LocalVariableElementImpl element = node.element as LocalVariableElementImpl;
element.type = declaredType;
@@ -14394,11 +14394,11 @@ class TypeResolverVisitor extends ScopedVisitor {
}
}
} else {
- type = getType(typeName);
+ type = _getType(typeName);
}
parameter.type = type;
} else {
- setFunctionTypedParameterType(parameter, node.type, node.parameters);
+ _setFunctionTypedParameterType(parameter, node.type, node.parameters);
}
} else {
}
@@ -14408,7 +14408,7 @@ class TypeResolverVisitor extends ScopedVisitor {
Object visitFunctionDeclaration(FunctionDeclaration node) {
super.visitFunctionDeclaration(node);
ExecutableElementImpl element = node.element as ExecutableElementImpl;
- element.returnType = computeReturnType(node.returnType);
+ element.returnType = _computeReturnType(node.returnType);
FunctionTypeImpl type = new FunctionTypeImpl.con1(element);
ClassElement definingClass = element.getAncestor((element) => element is ClassElement);
if (definingClass != null) {
@@ -14421,7 +14421,7 @@ class TypeResolverVisitor extends ScopedVisitor {
Object visitFunctionTypeAlias(FunctionTypeAlias node) {
super.visitFunctionTypeAlias(node);
FunctionTypeAliasElementImpl element = node.element as FunctionTypeAliasElementImpl;
- element.returnType = computeReturnType(node.returnType);
+ element.returnType = _computeReturnType(node.returnType);
return null;
}
@@ -14429,7 +14429,7 @@ class TypeResolverVisitor extends ScopedVisitor {
super.visitFunctionTypedFormalParameter(node);
Element element = node.identifier.staticElement;
if (element is ParameterElementImpl) {
- setFunctionTypedParameterType(element, node.returnType, node.parameters);
+ _setFunctionTypedParameterType(element, node.returnType, node.parameters);
} else {
}
return null;
@@ -14438,7 +14438,7 @@ class TypeResolverVisitor extends ScopedVisitor {
Object visitMethodDeclaration(MethodDeclaration node) {
super.visitMethodDeclaration(node);
ExecutableElementImpl element = node.element as ExecutableElementImpl;
- element.returnType = computeReturnType(node.returnType);
+ element.returnType = _computeReturnType(node.returnType);
FunctionTypeImpl type = new FunctionTypeImpl.con1(element);
ClassElement definingClass = element.getAncestor((element) => element is ClassElement);
if (definingClass != null) {
@@ -14467,7 +14467,7 @@ class TypeResolverVisitor extends ScopedVisitor {
if (typeName == null) {
declaredType = _dynamicType;
} else {
- declaredType = getType(typeName);
+ declaredType = _getType(typeName);
}
Element element = node.identifier.staticElement;
if (element is ParameterElement) {
@@ -14492,12 +14492,12 @@ class TypeResolverVisitor extends ScopedVisitor {
// Check to see whether the type name is either 'dynamic' or 'void', neither of which are in
// the name scope and hence will not be found by normal means.
//
- if (typeName.name == this._dynamicType.name) {
- setElement(typeName, this._dynamicType.element);
+ if (typeName.name == _dynamicType.name) {
+ _setElement(typeName, _dynamicType.element);
if (argumentList != null) {
}
- typeName.staticType = this._dynamicType;
- node.type = this._dynamicType;
+ typeName.staticType = _dynamicType;
+ node.type = _dynamicType;
return null;
}
VoidTypeImpl voidType = VoidTypeImpl.instance;
@@ -14529,7 +14529,7 @@ class TypeResolverVisitor extends ScopedVisitor {
// Else, if this expression is a new expression, report a NEW_WITH_NON_TYPE warning.
reportErrorForNode(StaticWarningCode.NEW_WITH_NON_TYPE, prefixedIdentifier.identifier, [prefixedIdentifier.identifier.name]);
}
- setElement(prefix, element);
+ _setElement(prefix, element);
return null;
} else if (element != null) {
//
@@ -14548,8 +14548,8 @@ class TypeResolverVisitor extends ScopedVisitor {
}
// check element
bool elementValid = element is! MultiplyDefinedElement;
- if (elementValid && element is! ClassElement && isTypeNameInInstanceCreationExpression(node)) {
- SimpleIdentifier typeNameSimple = getTypeSimpleIdentifier(typeName);
+ if (elementValid && element is! ClassElement && _isTypeNameInInstanceCreationExpression(node)) {
+ SimpleIdentifier typeNameSimple = _getTypeSimpleIdentifier(typeName);
InstanceCreationExpression creation = node.parent.parent as InstanceCreationExpression;
if (creation.isConst) {
if (element == null) {
@@ -14570,22 +14570,22 @@ class TypeResolverVisitor extends ScopedVisitor {
// TODO(jwren) Consider moving the check for CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE
// from the ErrorVerifier, so that we don't have two errors on a built in identifier being
// used as a class name. See CompileTimeErrorCodeTest.test_builtInIdentifierAsType().
- SimpleIdentifier typeNameSimple = getTypeSimpleIdentifier(typeName);
+ SimpleIdentifier typeNameSimple = _getTypeSimpleIdentifier(typeName);
RedirectingConstructorKind redirectingConstructorKind;
- if (isBuiltInIdentifier(node) && isTypeAnnotation(node)) {
+ if (_isBuiltInIdentifier(node) && _isTypeAnnotation(node)) {
reportErrorForNode(CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, typeName, [typeName.name]);
} else if (typeNameSimple.name == "boolean") {
reportErrorForNode(StaticWarningCode.UNDEFINED_CLASS_BOOLEAN, typeNameSimple, []);
- } else if (isTypeNameInCatchClause(node)) {
+ } else if (_isTypeNameInCatchClause(node)) {
reportErrorForNode(StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, typeName, [typeName.name]);
- } else if (isTypeNameInAsExpression(node)) {
+ } else if (_isTypeNameInAsExpression(node)) {
reportErrorForNode(StaticWarningCode.CAST_TO_NON_TYPE, typeName, [typeName.name]);
- } else if (isTypeNameInIsExpression(node)) {
+ } else if (_isTypeNameInIsExpression(node)) {
reportErrorForNode(StaticWarningCode.TYPE_TEST_NON_TYPE, typeName, [typeName.name]);
- } else if ((redirectingConstructorKind = getRedirectingConstructorKind(node)) != null) {
+ } else if ((redirectingConstructorKind = _getRedirectingConstructorKind(node)) != null) {
ErrorCode errorCode = (identical(redirectingConstructorKind, RedirectingConstructorKind.CONST) ? CompileTimeErrorCode.REDIRECT_TO_NON_CLASS : StaticWarningCode.REDIRECT_TO_NON_CLASS) as ErrorCode;
reportErrorForNode(errorCode, typeName, [typeName.name]);
- } else if (isTypeNameInTypeArgumentList(node)) {
+ } else if (_isTypeNameInTypeArgumentList(node)) {
reportErrorForNode(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, typeName, [typeName.name]);
} else {
reportErrorForNode(StaticWarningCode.UNDEFINED_CLASS, typeName, [typeName.name]);
@@ -14594,45 +14594,45 @@ class TypeResolverVisitor extends ScopedVisitor {
}
if (!elementValid) {
if (element is MultiplyDefinedElement) {
- setElement(typeName, element);
+ _setElement(typeName, element);
} else {
- setElement(typeName, this._dynamicType.element);
+ _setElement(typeName, _dynamicType.element);
}
- typeName.staticType = this._dynamicType;
- node.type = this._dynamicType;
+ typeName.staticType = _dynamicType;
+ node.type = _dynamicType;
return null;
}
Type2 type = null;
if (element is ClassElement) {
- setElement(typeName, element);
+ _setElement(typeName, element);
type = (element as ClassElement).type;
} else if (element is FunctionTypeAliasElement) {
- setElement(typeName, element);
+ _setElement(typeName, element);
type = (element as FunctionTypeAliasElement).type;
} else if (element is TypeParameterElement) {
- setElement(typeName, element);
+ _setElement(typeName, element);
type = (element as TypeParameterElement).type;
if (argumentList != null) {
}
} else if (element is MultiplyDefinedElement) {
List<Element> elements = (element as MultiplyDefinedElement).conflictingElements;
- type = getTypeWhenMultiplyDefined(elements);
+ type = _getTypeWhenMultiplyDefined(elements);
if (type != null) {
node.type = type;
}
} else {
// The name does not represent a type.
RedirectingConstructorKind redirectingConstructorKind;
- if (isTypeNameInCatchClause(node)) {
+ if (_isTypeNameInCatchClause(node)) {
reportErrorForNode(StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, typeName, [typeName.name]);
- } else if (isTypeNameInAsExpression(node)) {
+ } else if (_isTypeNameInAsExpression(node)) {
reportErrorForNode(StaticWarningCode.CAST_TO_NON_TYPE, typeName, [typeName.name]);
- } else if (isTypeNameInIsExpression(node)) {
+ } else if (_isTypeNameInIsExpression(node)) {
reportErrorForNode(StaticWarningCode.TYPE_TEST_NON_TYPE, typeName, [typeName.name]);
- } else if ((redirectingConstructorKind = getRedirectingConstructorKind(node)) != null) {
+ } else if ((redirectingConstructorKind = _getRedirectingConstructorKind(node)) != null) {
ErrorCode errorCode = (identical(redirectingConstructorKind, RedirectingConstructorKind.CONST) ? CompileTimeErrorCode.REDIRECT_TO_NON_CLASS : StaticWarningCode.REDIRECT_TO_NON_CLASS) as ErrorCode;
reportErrorForNode(errorCode, typeName, [typeName.name]);
- } else if (isTypeNameInTypeArgumentList(node)) {
+ } else if (_isTypeNameInTypeArgumentList(node)) {
reportErrorForNode(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, typeName, [typeName.name]);
} else {
AstNode parent = typeName.parent;
@@ -14644,26 +14644,26 @@ class TypeResolverVisitor extends ScopedVisitor {
reportErrorForNode(StaticWarningCode.NOT_A_TYPE, typeName, [typeName.name]);
}
}
- setElement(typeName, this._dynamicType.element);
- typeName.staticType = this._dynamicType;
- node.type = this._dynamicType;
+ _setElement(typeName, _dynamicType.element);
+ typeName.staticType = _dynamicType;
+ node.type = _dynamicType;
return null;
}
if (argumentList != null) {
NodeList<TypeName> arguments = argumentList.arguments;
int argumentCount = arguments.length;
- List<Type2> parameters = getTypeArguments(type);
+ List<Type2> parameters = _getTypeArguments(type);
int parameterCount = parameters.length;
int count = Math.min(argumentCount, parameterCount);
List<Type2> typeArguments = new List<Type2>();
for (int i = 0; i < count; i++) {
- Type2 argumentType = getType(arguments[i]);
+ Type2 argumentType = _getType(arguments[i]);
if (argumentType != null) {
typeArguments.add(argumentType);
}
}
if (argumentCount != parameterCount) {
- reportErrorForNode(getInvalidTypeParametersErrorCode(node), node, [typeName.name, parameterCount, argumentCount]);
+ reportErrorForNode(_getInvalidTypeParametersErrorCode(node), node, [typeName.name, parameterCount, argumentCount]);
}
argumentCount = typeArguments.length;
if (argumentCount < parameterCount) {
@@ -14673,7 +14673,7 @@ class TypeResolverVisitor extends ScopedVisitor {
// enough times to make the count equal.
//
for (int i = argumentCount; i < parameterCount; i++) {
- typeArguments.add(this._dynamicType);
+ typeArguments.add(_dynamicType);
}
}
if (type is InterfaceTypeImpl) {
@@ -14688,7 +14688,7 @@ class TypeResolverVisitor extends ScopedVisitor {
//
// Check for the case where there are no type arguments given for a parameterized type.
//
- List<Type2> parameters = getTypeArguments(type);
+ List<Type2> parameters = _getTypeArguments(type);
int parameterCount = parameters.length;
if (parameterCount > 0) {
DynamicTypeImpl dynamicType = DynamicTypeImpl.instance;
@@ -14723,7 +14723,7 @@ class TypeResolverVisitor extends ScopedVisitor {
if (typeName == null) {
declaredType = _dynamicType;
} else {
- declaredType = getType(typeName);
+ declaredType = _getType(typeName);
}
Element element = node.name.staticElement;
if (element is VariableElement) {
@@ -14777,7 +14777,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param returnType the type name representing the return type of the function
* @return the return type that was computed
*/
- Type2 computeReturnType(TypeName returnType) {
+ Type2 _computeReturnType(TypeName returnType) {
if (returnType == null) {
return _dynamicType;
} else {
@@ -14795,7 +14795,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param argumentTypes the types with which the parameters are to be replaced
* @return the implicit constructor that was created
*/
- ConstructorElement createImplicitContructor(InterfaceType classType, ConstructorElement explicitConstructor, List<Type2> parameterTypes, List<Type2> argumentTypes) {
+ ConstructorElement _createImplicitContructor(InterfaceType classType, ConstructorElement explicitConstructor, List<Type2> parameterTypes, List<Type2> argumentTypes) {
ConstructorElementImpl implicitConstructor = new ConstructorElementImpl.con2(explicitConstructor.name, -1);
implicitConstructor.synthetic = true;
implicitConstructor.redirectedConstructor = explicitConstructor;
@@ -14831,7 +14831,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param parameterTypes the parameter types that must be matched by the type arguments
* @return the argument types that correspond to the parameter types
*/
- List<Type2> getArgumentTypes(TypeArgumentList typeArguments, List<Type2> parameterTypes) {
+ List<Type2> _getArgumentTypes(TypeArgumentList typeArguments, List<Type2> parameterTypes) {
DynamicTypeImpl dynamic = DynamicTypeImpl.instance;
int parameterCount = parameterTypes.length;
List<Type2> types = new List<Type2>(parameterCount);
@@ -14858,7 +14858,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param identifier the name from the declaration of a class
* @return the class element that represents the class
*/
- ClassElementImpl getClassElement(SimpleIdentifier identifier) {
+ ClassElementImpl _getClassElement(SimpleIdentifier identifier) {
// TODO(brianwilkerson) Seems like we should be using ClassDeclaration.getElement().
if (identifier == null) {
// TODO(brianwilkerson) Report this
@@ -14881,7 +14881,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param parameterList the list of parameters whose elements are to be returned
* @return the elements associated with the parameters
*/
- List<ParameterElement> getElements(FormalParameterList parameterList) {
+ List<ParameterElement> _getElements(FormalParameterList parameterList) {
List<ParameterElement> elements = new List<ParameterElement>();
for (FormalParameter parameter in parameterList.parameters) {
ParameterElement element = parameter.identifier.staticElement as ParameterElement;
@@ -14902,7 +14902,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @return the error code that should be used to report that the wrong number of type arguments
* were provided
*/
- ErrorCode getInvalidTypeParametersErrorCode(TypeName node) {
+ ErrorCode _getInvalidTypeParametersErrorCode(TypeName node) {
AstNode parent = node.parent;
if (parent is ConstructorName) {
parent = parent.parent;
@@ -14924,7 +14924,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @return some [RedirectingConstructorKind] if the given type name is used as the type in a
* redirected constructor, or `null` otherwise
*/
- RedirectingConstructorKind getRedirectingConstructorKind(TypeName typeName) {
+ RedirectingConstructorKind _getRedirectingConstructorKind(TypeName typeName) {
AstNode parent = typeName.parent;
if (parent is ConstructorName) {
ConstructorName constructorName = parent as ConstructorName;
@@ -14948,7 +14948,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param typeName the type name representing the type to be returned
* @return the type represented by the type name
*/
- Type2 getType(TypeName typeName) {
+ Type2 _getType(TypeName typeName) {
Type2 type = typeName.type;
if (type == null) {
return _dynamicType;
@@ -14962,7 +14962,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param type the type whole type arguments are to be returned
* @return the type arguments associated with the given type
*/
- List<Type2> getTypeArguments(Type2 type) {
+ List<Type2> _getTypeArguments(Type2 type) {
if (type is InterfaceType) {
return type.typeArguments;
} else if (type is FunctionType) {
@@ -14977,7 +14977,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param typeName the (may be qualified) qualified type name
* @return the simple identifier of the given (may be qualified) type name.
*/
- SimpleIdentifier getTypeSimpleIdentifier(Identifier typeName) {
+ SimpleIdentifier _getTypeSimpleIdentifier(Identifier typeName) {
if (typeName is SimpleIdentifier) {
return typeName;
} else {
@@ -14992,7 +14992,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param elements the elements to which a single name could potentially be resolved
* @return the single interface type that should be used for the type name
*/
- InterfaceType getTypeWhenMultiplyDefined(List<Element> elements) {
+ InterfaceType _getTypeWhenMultiplyDefined(List<Element> elements) {
InterfaceType type = null;
for (Element element in elements) {
if (element is ClassElement) {
@@ -15011,7 +15011,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param typeName the type name to analyzer
* @return `true` if the given type name is used as the type in an as expression
*/
- bool isTypeNameInAsExpression(TypeName typeName) {
+ bool _isTypeNameInAsExpression(TypeName typeName) {
AstNode parent = typeName.parent;
if (parent is AsExpression) {
AsExpression asExpression = parent;
@@ -15026,7 +15026,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param typeName the type name to analyzer
* @return `true` if the given type name is used as the exception type in a catch clause
*/
- bool isTypeNameInCatchClause(TypeName typeName) {
+ bool _isTypeNameInCatchClause(TypeName typeName) {
AstNode parent = typeName.parent;
if (parent is CatchClause) {
CatchClause catchClause = parent;
@@ -15042,7 +15042,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @return `true` if the given type name is used as the type in an instance creation
* expression
*/
- bool isTypeNameInInstanceCreationExpression(TypeName typeName) {
+ bool _isTypeNameInInstanceCreationExpression(TypeName typeName) {
AstNode parent = typeName.parent;
if (parent is ConstructorName && parent.parent is InstanceCreationExpression) {
ConstructorName constructorName = parent;
@@ -15057,7 +15057,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param typeName the type name to analyzer
* @return `true` if the given type name is used as the type in an is expression
*/
- bool isTypeNameInIsExpression(TypeName typeName) {
+ bool _isTypeNameInIsExpression(TypeName typeName) {
AstNode parent = typeName.parent;
if (parent is IsExpression) {
IsExpression isExpression = parent;
@@ -15072,7 +15072,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param typeName the type name to analyzer
* @return `true` if the given type name is in a type argument list
*/
- bool isTypeNameInTypeArgumentList(TypeName typeName) => typeName.parent is TypeArgumentList;
+ bool _isTypeNameInTypeArgumentList(TypeName typeName) => typeName.parent is TypeArgumentList;
/**
* Record that the static type of the given node is the given type.
@@ -15080,7 +15080,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param expression the node whose type is to be recorded
* @param type the static type of the node
*/
- Object recordType(Expression expression, Type2 type) {
+ Object _recordType(Expression expression, Type2 type) {
if (type == null) {
expression.staticType = _dynamicType;
} else {
@@ -15098,16 +15098,16 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param withClause the with clause to be resolved
* @param implementsClause the implements clause to be resolved
*/
- void resolve(ClassElementImpl classElement, WithClause withClause, ImplementsClause implementsClause) {
+ void _resolve(ClassElementImpl classElement, WithClause withClause, ImplementsClause implementsClause) {
if (withClause != null) {
- List<InterfaceType> mixinTypes = resolveTypes(withClause.mixinTypes, CompileTimeErrorCode.MIXIN_OF_NON_CLASS, CompileTimeErrorCode.MIXIN_OF_NON_CLASS);
+ List<InterfaceType> mixinTypes = _resolveTypes(withClause.mixinTypes, CompileTimeErrorCode.MIXIN_OF_NON_CLASS, CompileTimeErrorCode.MIXIN_OF_NON_CLASS);
if (classElement != null) {
classElement.mixins = mixinTypes;
}
}
if (implementsClause != null) {
NodeList<TypeName> interfaces = implementsClause.interfaces;
- List<InterfaceType> interfaceTypes = resolveTypes(interfaces, CompileTimeErrorCode.IMPLEMENTS_NON_CLASS, CompileTimeErrorCode.IMPLEMENTS_DYNAMIC);
+ List<InterfaceType> interfaceTypes = _resolveTypes(interfaces, CompileTimeErrorCode.IMPLEMENTS_NON_CLASS, CompileTimeErrorCode.IMPLEMENTS_DYNAMIC);
if (classElement != null) {
classElement.interfaces = interfaceTypes;
}
@@ -15145,7 +15145,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param dynamicTypeError the error to produce if the type name is "dynamic"
* @return the type specified by the type name
*/
- InterfaceType resolveType(TypeName typeName, ErrorCode nonTypeError, ErrorCode dynamicTypeError) {
+ InterfaceType _resolveType(TypeName typeName, ErrorCode nonTypeError, ErrorCode dynamicTypeError) {
Type2 type = typeName.type;
if (type is InterfaceType) {
return type;
@@ -15169,10 +15169,10 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param dynamicTypeError the error to produce if the type name is "dynamic"
* @return an array containing all of the types that were resolved.
*/
- List<InterfaceType> resolveTypes(NodeList<TypeName> typeNames, ErrorCode nonTypeError, ErrorCode dynamicTypeError) {
+ List<InterfaceType> _resolveTypes(NodeList<TypeName> typeNames, ErrorCode nonTypeError, ErrorCode dynamicTypeError) {
List<InterfaceType> types = new List<InterfaceType>();
for (TypeName typeName in typeNames) {
- InterfaceType type = resolveType(typeName, nonTypeError, dynamicTypeError);
+ InterfaceType type = _resolveType(typeName, nonTypeError, dynamicTypeError);
if (type != null) {
types.add(type);
}
@@ -15180,7 +15180,7 @@ class TypeResolverVisitor extends ScopedVisitor {
return new List.from(types);
}
- void setElement(Identifier typeName, Element element) {
+ void _setElement(Identifier typeName, Element element) {
if (element != null) {
if (typeName is SimpleIdentifier) {
typeName.staticElement = element;
@@ -15204,12 +15204,12 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param returnType the (possibly `null`) return type of the function
* @param parameterList the list of parameters to the function
*/
- void setFunctionTypedParameterType(ParameterElementImpl element, TypeName returnType, FormalParameterList parameterList) {
- List<ParameterElement> parameters = getElements(parameterList);
+ void _setFunctionTypedParameterType(ParameterElementImpl element, TypeName returnType, FormalParameterList parameterList) {
+ List<ParameterElement> parameters = _getElements(parameterList);
FunctionTypeAliasElementImpl aliasElement = new FunctionTypeAliasElementImpl(null);
aliasElement.synthetic = true;
aliasElement.shareParameters(parameters);
- aliasElement.returnType = computeReturnType(returnType);
+ aliasElement.returnType = _computeReturnType(returnType);
FunctionTypeImpl type = new FunctionTypeImpl.con2(aliasElement);
ClassElement definingClass = element.getAncestor((element) => element is ClassElement);
if (definingClass != null) {
@@ -15384,8 +15384,8 @@ class ClassScope extends EnclosedScope {
* @param typeElement the element representing the type represented by this scope
*/
ClassScope(Scope enclosingScope, ClassElement typeElement) : super(new EnclosedScope(enclosingScope)) {
- defineTypeParameters(typeElement);
- defineMembers(typeElement);
+ _defineTypeParameters(typeElement);
+ _defineMembers(typeElement);
}
AnalysisError getErrorForDuplicate(Element existing, Element duplicate) {
@@ -15404,7 +15404,7 @@ class ClassScope extends EnclosedScope {
*
* @param typeElement the element representing the type represented by this scope
*/
- void defineMembers(ClassElement typeElement) {
+ void _defineMembers(ClassElement typeElement) {
for (PropertyAccessorElement accessor in typeElement.accessors) {
define(accessor);
}
@@ -15418,7 +15418,7 @@ class ClassScope extends EnclosedScope {
*
* @param typeElement the element representing the type represented by this scope
*/
- void defineTypeParameters(ClassElement typeElement) {
+ void _defineTypeParameters(ClassElement typeElement) {
Scope parameterScope = enclosingScope;
for (TypeParameterElement typeParameter in typeElement.typeParameters) {
parameterScope.define(typeParameter);
@@ -15550,7 +15550,7 @@ class FunctionTypeScope extends EnclosedScope {
*/
FunctionTypeScope(Scope enclosingScope, FunctionTypeAliasElement typeElement) : super(new EnclosedScope(enclosingScope)) {
this._typeElement = typeElement;
- defineTypeParameters();
+ _defineTypeParameters();
}
/**
@@ -15573,7 +15573,7 @@ class FunctionTypeScope extends EnclosedScope {
*
* @param typeElement the element representing the type represented by this scope
*/
- void defineTypeParameters() {
+ void _defineTypeParameters() {
Scope typeParameterScope = enclosingScope;
for (TypeParameterElement typeParameter in _typeElement.typeParameters) {
typeParameterScope.define(typeParameter);
@@ -15683,7 +15683,7 @@ class LibraryImportScope extends Scope {
*/
LibraryImportScope(LibraryElement definingLibrary, this.errorListener) {
this._definingLibrary = definingLibrary;
- createImportedNamespaces(definingLibrary);
+ _createImportedNamespaces(definingLibrary);
}
void define(Element element) {
@@ -15708,13 +15708,13 @@ class LibraryImportScope extends Scope {
}
}
if (foundElement is MultiplyDefinedElementImpl) {
- foundElement = removeSdkElements(identifier, name, foundElement as MultiplyDefinedElementImpl);
+ foundElement = _removeSdkElements(identifier, name, foundElement as MultiplyDefinedElementImpl);
}
if (foundElement is MultiplyDefinedElementImpl) {
String foundEltName = foundElement.displayName;
List<Element> conflictingMembers = (foundElement as MultiplyDefinedElementImpl).conflictingElements;
- String libName1 = getLibraryName(conflictingMembers[0], "");
- String libName2 = getLibraryName(conflictingMembers[1], "");
+ String libName1 = _getLibraryName(conflictingMembers[0], "");
+ String libName2 = _getLibraryName(conflictingMembers[1], "");
// TODO (jwren) Change the error message to include a list of all library names instead of
// just the first two
errorListener.onError(new AnalysisError.con2(getSource(identifier), identifier.offset, identifier.length, StaticWarningCode.AMBIGUOUS_IMPORT, [foundEltName, libName1, libName2]));
@@ -15733,7 +15733,7 @@ class LibraryImportScope extends Scope {
* @param definingLibrary the element representing the library that imports the libraries for
* which namespaces will be created
*/
- void createImportedNamespaces(LibraryElement definingLibrary) {
+ void _createImportedNamespaces(LibraryElement definingLibrary) {
NamespaceBuilder builder = new NamespaceBuilder();
List<ImportElement> imports = definingLibrary.imports;
int count = imports.length;
@@ -15750,7 +15750,7 @@ class LibraryImportScope extends Scope {
* @param def the default name to use
* @return the name of the library that defines given element
*/
- String getLibraryName(Element element, String def) {
+ String _getLibraryName(Element element, String def) {
if (element == null) {
return def;
}
@@ -15771,7 +15771,7 @@ class LibraryImportScope extends Scope {
* @param foundElement the element encapsulating the collection of elements
* @return all of the elements that are not defined in the SDK
*/
- Element removeSdkElements(Identifier identifier, String name, MultiplyDefinedElementImpl foundElement) {
+ Element _removeSdkElements(Identifier identifier, String name, MultiplyDefinedElementImpl foundElement) {
List<Element> conflictingMembers = foundElement.conflictingElements;
int length = conflictingMembers.length;
int to = 0;
@@ -15784,8 +15784,8 @@ class LibraryImportScope extends Scope {
}
}
if (sdkElement != null && to > 0) {
- String sdkLibName = getLibraryName(sdkElement, "");
- String otherLibName = getLibraryName(conflictingMembers[0], "");
+ String sdkLibName = _getLibraryName(sdkElement, "");
+ String otherLibName = _getLibraryName(conflictingMembers[0], "");
errorListener.onError(new AnalysisError.con2(getSource(identifier), identifier.offset, identifier.length, StaticWarningCode.CONFLICTING_DART_IMPORT, [name, sdkLibName, otherLibName]));
}
if (to == length) {
@@ -15817,7 +15817,7 @@ class LibraryScope extends EnclosedScope {
* @param errorListener the listener that is to be informed when an error is encountered
*/
LibraryScope(LibraryElement definingLibrary, AnalysisErrorListener errorListener) : super(new LibraryImportScope(definingLibrary, errorListener)) {
- defineTopLevelNames(definingLibrary);
+ _defineTopLevelNames(definingLibrary);
}
AnalysisError getErrorForDuplicate(Element existing, Element duplicate) {
@@ -15842,7 +15842,7 @@ class LibraryScope extends EnclosedScope {
* @param compilationUnit the compilation unit defining the top-level names to be added to this
* scope
*/
- void defineLocalNames(CompilationUnitElement compilationUnit) {
+ void _defineLocalNames(CompilationUnitElement compilationUnit) {
for (PropertyAccessorElement element in compilationUnit.accessors) {
define(element);
}
@@ -15863,13 +15863,13 @@ class LibraryScope extends EnclosedScope {
* @param definingLibrary the element representing the library that defines the names in this
* scope
*/
- void defineTopLevelNames(LibraryElement definingLibrary) {
+ void _defineTopLevelNames(LibraryElement definingLibrary) {
for (PrefixElement prefix in definingLibrary.prefixes) {
define(prefix);
}
- defineLocalNames(definingLibrary.definingCompilationUnit);
+ _defineLocalNames(definingLibrary.definingCompilationUnit);
for (CompilationUnitElement compilationUnit in definingLibrary.parts) {
- defineLocalNames(compilationUnit);
+ _defineLocalNames(compilationUnit);
}
}
}
@@ -15936,8 +15936,8 @@ class NamespaceBuilder {
//
return Namespace.EMPTY;
}
- Map<String, Element> definedNames = createExportMapping(exportedLibrary, new Set<LibraryElement>());
- definedNames = applyCombinators(definedNames, element.combinators);
+ Map<String, Element> definedNames = _createExportMapping(exportedLibrary, new Set<LibraryElement>());
+ definedNames = _applyCombinators(definedNames, element.combinators);
return new Namespace(definedNames);
}
@@ -15947,7 +15947,7 @@ class NamespaceBuilder {
* @param library the library whose export namespace is to be created
* @return the export namespace that was created
*/
- Namespace createExportNamespaceForLibrary(LibraryElement library) => new Namespace(createExportMapping(library, new Set<LibraryElement>()));
+ Namespace createExportNamespaceForLibrary(LibraryElement library) => new Namespace(_createExportMapping(library, new Set<LibraryElement>()));
/**
* Create a namespace representing the import namespace of the given library.
@@ -15963,9 +15963,9 @@ class NamespaceBuilder {
//
return Namespace.EMPTY;
}
- Map<String, Element> definedNames = createExportMapping(importedLibrary, new Set<LibraryElement>());
- definedNames = applyCombinators(definedNames, element.combinators);
- definedNames = applyPrefix(definedNames, element.prefix);
+ Map<String, Element> definedNames = _createExportMapping(importedLibrary, new Set<LibraryElement>());
+ definedNames = _applyCombinators(definedNames, element.combinators);
+ definedNames = _applyPrefix(definedNames, element.prefix);
return new Namespace(definedNames);
}
@@ -15977,9 +15977,9 @@ class NamespaceBuilder {
*/
Namespace createPublicNamespaceForLibrary(LibraryElement library) {
Map<String, Element> definedNames = new Map<String, Element>();
- addPublicNames(definedNames, library.definingCompilationUnit);
+ _addPublicNames(definedNames, library.definingCompilationUnit);
for (CompilationUnitElement compilationUnit in library.parts) {
- addPublicNames(definedNames, compilationUnit);
+ _addPublicNames(definedNames, compilationUnit);
}
return new Namespace(definedNames);
}
@@ -15990,7 +15990,7 @@ class NamespaceBuilder {
* @param definedNames the mapping table to which the names in the given namespace are to be added
* @param namespace the namespace containing the names to be added to this namespace
*/
- void addAllFromMap(Map<String, Element> definedNames, Map<String, Element> newNames) {
+ void _addAllFromMap(Map<String, Element> definedNames, Map<String, Element> newNames) {
for (MapEntry<String, Element> entry in getMapEntrySet(newNames)) {
definedNames[entry.getKey()] = entry.getValue();
}
@@ -16002,9 +16002,9 @@ class NamespaceBuilder {
* @param definedNames the mapping table to which the names in the given namespace are to be added
* @param namespace the namespace containing the names to be added to this namespace
*/
- void addAllFromNamespace(Map<String, Element> definedNames, Namespace namespace) {
+ void _addAllFromNamespace(Map<String, Element> definedNames, Namespace namespace) {
if (namespace != null) {
- addAllFromMap(definedNames, namespace.definedNames);
+ _addAllFromMap(definedNames, namespace.definedNames);
}
}
@@ -16014,7 +16014,7 @@ class NamespaceBuilder {
* @param definedNames the mapping table to which the public name is to be added
* @param element the element to be added
*/
- void addIfPublic(Map<String, Element> definedNames, Element element) {
+ void _addIfPublic(Map<String, Element> definedNames, Element element) {
String name = element.name;
if (name != null && !Scope.isPrivateName(name)) {
definedNames[name] = element;
@@ -16029,18 +16029,18 @@ class NamespaceBuilder {
* @param compilationUnit the compilation unit defining the top-level names to be added to this
* namespace
*/
- void addPublicNames(Map<String, Element> definedNames, CompilationUnitElement compilationUnit) {
+ void _addPublicNames(Map<String, Element> definedNames, CompilationUnitElement compilationUnit) {
for (PropertyAccessorElement element in compilationUnit.accessors) {
- addIfPublic(definedNames, element);
+ _addIfPublic(definedNames, element);
}
for (FunctionElement element in compilationUnit.functions) {
- addIfPublic(definedNames, element);
+ _addIfPublic(definedNames, element);
}
for (FunctionTypeAliasElement element in compilationUnit.functionTypeAliases) {
- addIfPublic(definedNames, element);
+ _addIfPublic(definedNames, element);
}
for (ClassElement element in compilationUnit.types) {
- addIfPublic(definedNames, element);
+ _addIfPublic(definedNames, element);
}
}
@@ -16050,12 +16050,12 @@ class NamespaceBuilder {
* @param definedNames the mapping table to which the namespace operations are to be applied
* @param combinators the combinators to be applied
*/
- Map<String, Element> applyCombinators(Map<String, Element> definedNames, List<NamespaceCombinator> combinators) {
+ Map<String, Element> _applyCombinators(Map<String, Element> definedNames, List<NamespaceCombinator> combinators) {
for (NamespaceCombinator combinator in combinators) {
if (combinator is HideElementCombinator) {
- hide(definedNames, combinator.hiddenNames);
+ _hide(definedNames, combinator.hiddenNames);
} else if (combinator is ShowElementCombinator) {
- definedNames = show(definedNames, combinator.shownNames);
+ definedNames = _show(definedNames, combinator.shownNames);
} else {
// Internal error.
AnalysisEngine.instance.logger.logError("Unknown type of combinator: ${combinator.runtimeType.toString()}");
@@ -16070,7 +16070,7 @@ class NamespaceBuilder {
* @param definedNames the names that were defined before this operation
* @param prefixElement the element defining the prefix to be added to the names
*/
- Map<String, Element> applyPrefix(Map<String, Element> definedNames, PrefixElement prefixElement) {
+ Map<String, Element> _applyPrefix(Map<String, Element> definedNames, PrefixElement prefixElement) {
if (prefixElement != null) {
String prefix = prefixElement.name;
Map<String, Element> newNames = new Map<String, Element>();
@@ -16092,7 +16092,7 @@ class NamespaceBuilder {
* be added by another library
* @return the mapping table that was created
*/
- Map<String, Element> createExportMapping(LibraryElement library, Set<LibraryElement> visitedElements) {
+ Map<String, Element> _createExportMapping(LibraryElement library, Set<LibraryElement> visitedElements) {
visitedElements.add(library);
try {
Map<String, Element> definedNames = new Map<String, Element>();
@@ -16102,12 +16102,12 @@ class NamespaceBuilder {
//
// The exported library will be null if the URI does not reference a valid library.
//
- Map<String, Element> exportedNames = createExportMapping(exportedLibrary, visitedElements);
- exportedNames = applyCombinators(exportedNames, element.combinators);
- addAllFromMap(definedNames, exportedNames);
+ Map<String, Element> exportedNames = _createExportMapping(exportedLibrary, visitedElements);
+ exportedNames = _applyCombinators(exportedNames, element.combinators);
+ _addAllFromMap(definedNames, exportedNames);
}
}
- addAllFromNamespace(definedNames, (library.context as InternalAnalysisContext).getPublicNamespace(library));
+ _addAllFromNamespace(definedNames, (library.context as InternalAnalysisContext).getPublicNamespace(library));
return definedNames;
} finally {
visitedElements.remove(library);
@@ -16120,7 +16120,7 @@ class NamespaceBuilder {
* @param definedNames the names that were defined before this operation
* @param hiddenNames the names to be hidden
*/
- void hide(Map<String, Element> definedNames, List<String> hiddenNames) {
+ void _hide(Map<String, Element> definedNames, List<String> hiddenNames) {
for (String name in hiddenNames) {
definedNames.remove(name);
definedNames.remove("${name}=");
@@ -16134,7 +16134,7 @@ class NamespaceBuilder {
* @param definedNames the names that were defined before this operation
* @param shownNames the names to be shown
*/
- Map<String, Element> show(Map<String, Element> definedNames, List<String> shownNames) {
+ Map<String, Element> _show(Map<String, Element> definedNames, List<String> shownNames) {
Map<String, Element> newNames = new Map<String, Element>();
for (String name in shownNames) {
Element element = definedNames[name];
@@ -16201,7 +16201,7 @@ abstract class Scope {
* @param element the element to be added to this scope
*/
void define(Element element) {
- String name = getName(element);
+ String name = _getName(element);
if (name != null && !name.isEmpty) {
if (_definedNames.containsKey(name)) {
errorListener.onError(getErrorForDuplicate(_definedNames[name], element));
@@ -16247,7 +16247,7 @@ abstract class Scope {
* @param element the element to be added to this scope
*/
void defineWithoutChecking(Element element) {
- _definedNames[getName(element)] = element;
+ _definedNames[_getName(element)] = element;
_hasName = true;
}
@@ -16328,7 +16328,7 @@ abstract class Scope {
* @param element the element whose look-up name is to be returned
* @return the name that will be used to look up the given element
*/
- String getName(Element element) {
+ String _getName(Element element) {
if (element is MethodElement) {
MethodElement method = element;
if (method.name == "-" && method.parameters.length == 0) {
@@ -16358,14 +16358,14 @@ class ScopeBuilder {
throw new AnalysisException.con1("Cannot create scope: node is null");
} else if (node is CompilationUnit) {
ScopeBuilder builder = new ScopeBuilder(errorListener);
- return builder.scopeForAstNode(node);
+ return builder._scopeForAstNode(node);
}
AstNode parent = node.parent;
if (parent == null) {
throw new AnalysisException.con1("Cannot create scope: node is not part of a CompilationUnit");
}
ScopeBuilder builder = new ScopeBuilder(errorListener);
- return builder.scopeForAstNode(parent);
+ return builder._scopeForAstNode(parent);
}
/**
@@ -16394,15 +16394,15 @@ class ScopeBuilder {
* @throws AnalysisException if the AST structure has not been resolved or is not part of a
* [CompilationUnit]
*/
- Scope scopeForAstNode(AstNode node) {
+ Scope _scopeForAstNode(AstNode node) {
if (node is CompilationUnit) {
- return scopeForCompilationUnit(node);
+ return _scopeForCompilationUnit(node);
}
AstNode parent = node.parent;
if (parent == null) {
throw new AnalysisException.con1("Cannot create scope: node is not part of a CompilationUnit");
}
- Scope scope = scopeForAstNode(parent);
+ Scope scope = _scopeForAstNode(parent);
if (node is ClassDeclaration) {
scope = new ClassScope(scope, node.element);
} else if (node is ClassTypeAlias) {
@@ -16425,7 +16425,7 @@ class ScopeBuilder {
return scope;
}
- Scope scopeForCompilationUnit(CompilationUnit node) {
+ Scope _scopeForCompilationUnit(CompilationUnit node) {
CompilationUnitElement unitElement = node.element;
if (unitElement == null) {
throw new AnalysisException.con1("Cannot create scope: compilation unit is not resolved");
@@ -16506,27 +16506,27 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
return null;
}
// arguments should be constants
- validateConstantArguments(argumentList);
+ _validateConstantArguments(argumentList);
}
return null;
}
Object visitConstructorDeclaration(ConstructorDeclaration node) {
if (node.constKeyword != null) {
- validateInitializers(node);
+ _validateInitializers(node);
}
- validateDefaultValues(node.parameters);
+ _validateDefaultValues(node.parameters);
return super.visitConstructorDeclaration(node);
}
Object visitFunctionExpression(FunctionExpression node) {
super.visitFunctionExpression(node);
- validateDefaultValues(node.parameters);
+ _validateDefaultValues(node.parameters);
return null;
}
Object visitInstanceCreationExpression(InstanceCreationExpression node) {
- validateInstanceCreationArguments(node);
+ _validateInstanceCreationArguments(node);
return super.visitInstanceCreationExpression(node);
}
@@ -16534,7 +16534,7 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
super.visitListLiteral(node);
if (node.constKeyword != null) {
for (Expression element in node.elements) {
- validate(element, CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT);
+ _validate(element, CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT);
}
}
return null;
@@ -16549,8 +16549,8 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
for (MapLiteralEntry entry in node.entries) {
Expression key = entry.key;
if (isConst) {
- EvaluationResultImpl result = validate(key, CompileTimeErrorCode.NON_CONSTANT_MAP_KEY);
- validate(entry.value, CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE);
+ EvaluationResultImpl result = _validate(key, CompileTimeErrorCode.NON_CONSTANT_MAP_KEY);
+ _validate(entry.value, CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE);
if (result is ValidResult) {
DartObject value = result.value;
if (keys.contains(value)) {
@@ -16583,13 +16583,13 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
Object visitMethodDeclaration(MethodDeclaration node) {
super.visitMethodDeclaration(node);
- validateDefaultValues(node.parameters);
+ _validateDefaultValues(node.parameters);
return null;
}
Object visitSwitchCase(SwitchCase node) {
super.visitSwitchCase(node);
- validate(node.expression, CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION);
+ _validate(node.expression, CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION);
return null;
}
@@ -16605,10 +16605,10 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
// computed their values. But if we missed it for some reason, this gives us a second
// chance.
//
- result = validate(initializer, CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE);
+ result = _validate(initializer, CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE);
element.evaluationResult = result;
} else if (result is ErrorResult) {
- reportErrors(result, CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE);
+ _reportErrors(result, CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE);
}
}
return null;
@@ -16621,7 +16621,7 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
* @param result the result containing any errors that need to be reported
* @param errorCode the error code to be used if the result represents an error
*/
- void reportErrors(EvaluationResultImpl result, ErrorCode errorCode) {
+ void _reportErrors(EvaluationResultImpl result, ErrorCode errorCode) {
if (result is ErrorResult) {
for (ErrorResult_ErrorData data in result.errorData) {
ErrorCode dataErrorCode = data.errorCode;
@@ -16634,7 +16634,7 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
}
}
- ValidResult valid(InterfaceType type, InstanceState state) => new ValidResult(new DartObjectImpl(type, state));
+ ValidResult _valid(InterfaceType type, InstanceState state) => new ValidResult(new DartObjectImpl(type, state));
/**
* Validate that the given expression is a compile time constant. Return the value of the compile
@@ -16644,9 +16644,9 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
* @param errorCode the error code to be used if the expression is not a compile time constant
* @return the value of the compile time constant
*/
- EvaluationResultImpl validate(Expression expression, ErrorCode errorCode) {
+ EvaluationResultImpl _validate(Expression expression, ErrorCode errorCode) {
EvaluationResultImpl result = expression.accept(new ConstantVisitor(_typeProvider));
- reportErrors(result, errorCode);
+ _reportErrors(result, errorCode);
return result;
}
@@ -16655,12 +16655,12 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
*
* @param argumentList the argument list to evaluate
*/
- void validateConstantArguments(ArgumentList argumentList) {
+ void _validateConstantArguments(ArgumentList argumentList) {
for (Expression argument in argumentList.arguments) {
if (argument is NamedExpression) {
argument = (argument as NamedExpression).expression;
}
- validate(argument, CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT);
+ _validate(argument, CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT);
}
}
@@ -16670,7 +16670,7 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
*
* @param parameters the list of parameters to be validated
*/
- void validateDefaultValues(FormalParameterList parameters) {
+ void _validateDefaultValues(FormalParameterList parameters) {
if (parameters == null) {
return;
}
@@ -16679,7 +16679,7 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
DefaultFormalParameter defaultParameter = parameter;
Expression defaultValue = defaultParameter.defaultValue;
if (defaultValue != null) {
- EvaluationResultImpl result = validate(defaultValue, CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE);
+ EvaluationResultImpl result = _validate(defaultValue, CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE);
VariableElementImpl element = parameter.element as VariableElementImpl;
element.evaluationResult = result;
}
@@ -16694,9 +16694,9 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
* considered as a valid potentially constant expressions
* @param expression the expression to validate
*/
- void validateInitializerExpression(List<ParameterElement> parameterElements, Expression expression) {
+ void _validateInitializerExpression(List<ParameterElement> parameterElements, Expression expression) {
EvaluationResultImpl result = expression.accept(new ConstantVisitor_ConstantVerifier_validateInitializerExpression(_typeProvider, this, parameterElements));
- reportErrors(result, CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER);
+ _reportErrors(result, CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER);
}
/**
@@ -16706,12 +16706,12 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
* considered as a valid potentially constant expressions
* @param argumentList the argument list to validate
*/
- void validateInitializerInvocationArguments(List<ParameterElement> parameterElements, ArgumentList argumentList) {
+ void _validateInitializerInvocationArguments(List<ParameterElement> parameterElements, ArgumentList argumentList) {
if (argumentList == null) {
return;
}
for (Expression argument in argumentList.arguments) {
- validateInitializerExpression(parameterElements, argument);
+ _validateInitializerExpression(parameterElements, argument);
}
}
@@ -16721,21 +16721,21 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
*
* @param constructor the constant constructor declaration to validate
*/
- void validateInitializers(ConstructorDeclaration constructor) {
+ void _validateInitializers(ConstructorDeclaration constructor) {
List<ParameterElement> parameterElements = constructor.parameters.parameterElements;
NodeList<ConstructorInitializer> initializers = constructor.initializers;
for (ConstructorInitializer initializer in initializers) {
if (initializer is ConstructorFieldInitializer) {
ConstructorFieldInitializer fieldInitializer = initializer;
- validateInitializerExpression(parameterElements, fieldInitializer.expression);
+ _validateInitializerExpression(parameterElements, fieldInitializer.expression);
}
if (initializer is RedirectingConstructorInvocation) {
RedirectingConstructorInvocation invocation = initializer;
- validateInitializerInvocationArguments(parameterElements, invocation.argumentList);
+ _validateInitializerInvocationArguments(parameterElements, invocation.argumentList);
}
if (initializer is SuperConstructorInvocation) {
SuperConstructorInvocation invocation = initializer;
- validateInitializerInvocationArguments(parameterElements, invocation.argumentList);
+ _validateInitializerInvocationArguments(parameterElements, invocation.argumentList);
}
}
}
@@ -16746,7 +16746,7 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
*
* @param node the instance creation evaluate
*/
- void validateInstanceCreationArguments(InstanceCreationExpression node) {
+ void _validateInstanceCreationArguments(InstanceCreationExpression node) {
if (!node.isConst) {
return;
}
@@ -16754,7 +16754,7 @@ class ConstantVerifier extends RecursiveAstVisitor<Object> {
if (argumentList == null) {
return;
}
- validateConstantArguments(argumentList);
+ _validateConstantArguments(argumentList);
}
}
@@ -16772,20 +16772,20 @@ class ConstantVisitor_ConstantVerifier_validateInitializerExpression extends Con
Type2 type = parameterElement.type;
if (type != null) {
if (type.isDynamic) {
- return ConstantVerifier_this.valid(ConstantVerifier_this._typeProvider.objectType, DynamicState.DYNAMIC_STATE);
+ return ConstantVerifier_this._valid(ConstantVerifier_this._typeProvider.objectType, DynamicState.DYNAMIC_STATE);
} else if (type.isSubtypeOf(ConstantVerifier_this._boolType)) {
- return ConstantVerifier_this.valid(ConstantVerifier_this._typeProvider.boolType, BoolState.UNKNOWN_VALUE);
+ return ConstantVerifier_this._valid(ConstantVerifier_this._typeProvider.boolType, BoolState.UNKNOWN_VALUE);
} else if (type.isSubtypeOf(ConstantVerifier_this._typeProvider.doubleType)) {
- return ConstantVerifier_this.valid(ConstantVerifier_this._typeProvider.doubleType, DoubleState.UNKNOWN_VALUE);
+ return ConstantVerifier_this._valid(ConstantVerifier_this._typeProvider.doubleType, DoubleState.UNKNOWN_VALUE);
} else if (type.isSubtypeOf(ConstantVerifier_this._intType)) {
- return ConstantVerifier_this.valid(ConstantVerifier_this._typeProvider.intType, IntState.UNKNOWN_VALUE);
+ return ConstantVerifier_this._valid(ConstantVerifier_this._typeProvider.intType, IntState.UNKNOWN_VALUE);
} else if (type.isSubtypeOf(ConstantVerifier_this._numType)) {
- return ConstantVerifier_this.valid(ConstantVerifier_this._typeProvider.numType, NumState.UNKNOWN_VALUE);
+ return ConstantVerifier_this._valid(ConstantVerifier_this._typeProvider.numType, NumState.UNKNOWN_VALUE);
} else if (type.isSubtypeOf(ConstantVerifier_this._stringType)) {
- return ConstantVerifier_this.valid(ConstantVerifier_this._typeProvider.stringType, StringState.UNKNOWN_VALUE);
+ return ConstantVerifier_this._valid(ConstantVerifier_this._typeProvider.stringType, StringState.UNKNOWN_VALUE);
}
}
- return ConstantVerifier_this.valid(type is InterfaceType ? type : ConstantVerifier_this._typeProvider.objectType, GenericState.UNKNOWN_VALUE);
+ return ConstantVerifier_this._valid(type is InterfaceType ? type : ConstantVerifier_this._typeProvider.objectType, GenericState.UNKNOWN_VALUE);
}
}
return super.visitSimpleIdentifier(node);
@@ -17007,12 +17007,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
Object visitArgumentList(ArgumentList node) {
- checkForArgumentTypesNotAssignableInList(node);
+ _checkForArgumentTypesNotAssignableInList(node);
return super.visitArgumentList(node);
}
Object visitAssertStatement(AssertStatement node) {
- checkForNonBoolExpression(node);
+ _checkForNonBoolExpression(node);
return super.visitAssertStatement(node);
}
@@ -17020,17 +17020,17 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
sc.Token operator = node.operator;
sc.TokenType operatorType = operator.type;
if (identical(operatorType, sc.TokenType.EQ)) {
- checkForInvalidAssignment(node.leftHandSide, node.rightHandSide);
+ _checkForInvalidAssignment(node.leftHandSide, node.rightHandSide);
} else {
- checkForInvalidCompoundAssignment(node);
+ _checkForInvalidCompoundAssignment(node);
}
- checkForAssignmentToFinal(node.leftHandSide);
- checkForArgumentTypeNotAssignableForArgument(node.rightHandSide);
+ _checkForAssignmentToFinal(node.leftHandSide);
+ _checkForArgumentTypeNotAssignableForArgument(node.rightHandSide);
return super.visitAssignmentExpression(node);
}
Object visitBinaryExpression(BinaryExpression node) {
- checkForArgumentTypeNotAssignableForArgument(node.rightOperand);
+ _checkForArgumentTypeNotAssignableForArgument(node.rightOperand);
return super.visitBinaryExpression(node);
}
@@ -17041,7 +17041,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
_returnsWith = new List<ReturnStatement>();
_returnsWithout = new List<ReturnStatement>();
super.visitBlockFunctionBody(node);
- checkForMixedReturns(node);
+ _checkForMixedReturns(node);
} finally {
_returnsWith = previousReturnsWith;
_returnsWithout = previousReturnsWithout;
@@ -17078,22 +17078,22 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
WithClause withClause = node.withClause;
ImplementsClause implementsClause = node.implementsClause;
ExtendsClause extendsClause = node.extendsClause;
- checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
- checkForMemberWithClassName();
- checkForNoDefaultSuperConstructorImplicit(node);
- checkForConflictingTypeVariableErrorCodes(node);
+ _checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
+ _checkForMemberWithClassName();
+ _checkForNoDefaultSuperConstructorImplicit(node);
+ _checkForConflictingTypeVariableErrorCodes(node);
// Only do error checks on the clause nodes if there is a non-null clause
if (implementsClause != null || extendsClause != null || withClause != null) {
// Only check for all of the inheritance logic around clauses if there isn't an error code
// such as "Cannot extend double" already on the class.
- if (!checkForImplementsDisallowedClass(implementsClause) && !checkForExtendsDisallowedClass(extendsClause) && !checkForAllMixinErrorCodes(withClause)) {
- checkForNonAbstractClassInheritsAbstractMember(node);
- checkForInconsistentMethodInheritance();
- checkForRecursiveInterfaceInheritance(_enclosingClass);
- checkForConflictingGetterAndMethod();
- checkForConflictingInstanceGetterAndSuperclassMember();
- checkImplementsSuperClass(node);
- checkImplementsFunctionWithoutCall(node);
+ if (!_checkForImplementsDisallowedClass(implementsClause) && !_checkForExtendsDisallowedClass(extendsClause) && !_checkForAllMixinErrorCodes(withClause)) {
+ _checkForNonAbstractClassInheritsAbstractMember(node);
+ _checkForInconsistentMethodInheritance();
+ _checkForRecursiveInterfaceInheritance(_enclosingClass);
+ _checkForConflictingGetterAndMethod();
+ _checkForConflictingInstanceGetterAndSuperclassMember();
+ _checkImplementsSuperClass(node);
+ _checkImplementsFunctionWithoutCall(node);
}
}
// initialize initialFieldElementsMap
@@ -17107,9 +17107,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
}
}
- checkForFinalNotInitializedInClass(node);
- checkForDuplicateDefinitionInheritance();
- checkForConflictingInstanceMethodSetter(node);
+ _checkForFinalNotInitializedInClass(node);
+ _checkForDuplicateDefinitionInheritance();
+ _checkForConflictingInstanceMethodSetter(node);
return super.visitClassDeclaration(node);
} finally {
_isInNativeClass = false;
@@ -17119,13 +17119,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
Object visitClassTypeAlias(ClassTypeAlias node) {
- checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
- checkForAllMixinErrorCodes(node.withClause);
+ _checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
+ _checkForAllMixinErrorCodes(node.withClause);
ClassElement outerClassElement = _enclosingClass;
try {
_enclosingClass = node.element;
- checkForRecursiveInterfaceInheritance(node.element);
- checkForTypeAliasCannotReferenceItself_mixin(node);
+ _checkForRecursiveInterfaceInheritance(node.element);
+ _checkForTypeAliasCannotReferenceItself_mixin(node);
} finally {
_enclosingClass = outerClassElement;
}
@@ -17142,7 +17142,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
Object visitConditionalExpression(ConditionalExpression node) {
- checkForNonBoolCondition(node.condition);
+ _checkForNonBoolCondition(node.condition);
return super.visitConditionalExpression(node);
}
@@ -17151,19 +17151,19 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
try {
_enclosingFunction = node.element;
_isEnclosingConstructorConst = node.constKeyword != null;
- checkForConstConstructorWithNonFinalField(node);
- checkForConstConstructorWithNonConstSuper(node);
- checkForConflictingConstructorNameAndMember(node);
- checkForAllFinalInitializedErrorCodes(node);
- checkForRedirectingConstructorErrorCodes(node);
- checkForMultipleSuperInitializers(node);
- checkForRecursiveConstructorRedirect(node);
- if (!checkForRecursiveFactoryRedirect(node)) {
- checkForAllRedirectConstructorErrorCodes(node);
- }
- checkForUndefinedConstructorInInitializerImplicit(node);
- checkForRedirectToNonConstConstructor(node);
- checkForReturnInGenerativeConstructor(node);
+ _checkForConstConstructorWithNonFinalField(node);
+ _checkForConstConstructorWithNonConstSuper(node);
+ _checkForConflictingConstructorNameAndMember(node);
+ _checkForAllFinalInitializedErrorCodes(node);
+ _checkForRedirectingConstructorErrorCodes(node);
+ _checkForMultipleSuperInitializers(node);
+ _checkForRecursiveConstructorRedirect(node);
+ if (!_checkForRecursiveFactoryRedirect(node)) {
+ _checkForAllRedirectConstructorErrorCodes(node);
+ }
+ _checkForUndefinedConstructorInInitializerImplicit(node);
+ _checkForRedirectToNonConstConstructor(node);
+ _checkForReturnInGenerativeConstructor(node);
return super.visitConstructorDeclaration(node);
} finally {
_isEnclosingConstructorConst = false;
@@ -17174,8 +17174,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
Object visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
_isInConstructorInitializer = true;
try {
- checkForInvalidField(node);
- checkForFieldInitializerNotAssignable(node);
+ _checkForInvalidField(node);
+ _checkForFieldInitializerNotAssignable(node);
return super.visitConstructorFieldInitializer(node);
} finally {
_isInConstructorInitializer = false;
@@ -17194,22 +17194,22 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
Object visitDefaultFormalParameter(DefaultFormalParameter node) {
- checkForInvalidAssignment(node.identifier, node.defaultValue);
- checkForDefaultValueInFunctionTypedParameter(node);
+ _checkForInvalidAssignment(node.identifier, node.defaultValue);
+ _checkForDefaultValueInFunctionTypedParameter(node);
return super.visitDefaultFormalParameter(node);
}
Object visitDoStatement(DoStatement node) {
- checkForNonBoolCondition(node.condition);
+ _checkForNonBoolCondition(node.condition);
return super.visitDoStatement(node);
}
Object visitExportDirective(ExportDirective node) {
ExportElement exportElement = node.element;
if (exportElement != null) {
- checkForAmbiguousExport(node, exportElement);
- checkForExportDuplicateLibraryName(node, exportElement);
- checkForExportInternalLibrary(node, exportElement);
+ _checkForAmbiguousExport(node, exportElement);
+ _checkForExportDuplicateLibraryName(node, exportElement);
+ _checkForExportInternalLibrary(node, exportElement);
}
return super.visitExportDirective(node);
}
@@ -17217,7 +17217,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
Object visitExpressionFunctionBody(ExpressionFunctionBody node) {
FunctionType functionType = _enclosingFunction == null ? null : _enclosingFunction.type;
Type2 expectedReturnType = functionType == null ? DynamicTypeImpl.instance : functionType.returnType;
- checkForReturnOfInvalidType(node.expression, expectedReturnType);
+ _checkForReturnOfInvalidType(node.expression, expectedReturnType);
return super.visitExpressionFunctionBody(node);
}
@@ -17231,7 +17231,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
}
try {
- checkForAllInvalidOverrideErrorCodesForField(node);
+ _checkForAllInvalidOverrideErrorCodesForField(node);
return super.visitFieldDeclaration(node);
} finally {
_isInStaticVariableDeclaration = false;
@@ -17240,10 +17240,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
Object visitFieldFormalParameter(FieldFormalParameter node) {
- checkForValidField(node);
- checkForConstFormalParameter(node);
- checkForPrivateOptionalParameter(node);
- checkForFieldInitializingFormalRedirectingConstructor(node);
+ _checkForValidField(node);
+ _checkForConstFormalParameter(node);
+ _checkForPrivateOptionalParameter(node);
+ _checkForFieldInitializingFormalRedirectingConstructor(node);
return super.visitFieldFormalParameter(node);
}
@@ -17257,14 +17257,14 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
_enclosingFunction = node.element;
if (node.isSetter || node.isGetter) {
- checkForMismatchedAccessorTypes(node, methodName);
+ _checkForMismatchedAccessorTypes(node, methodName);
if (node.isSetter) {
FunctionExpression functionExpression = node.functionExpression;
if (functionExpression != null) {
- checkForWrongNumberOfParametersForSetter(node.name, functionExpression.parameters);
+ _checkForWrongNumberOfParametersForSetter(node.name, functionExpression.parameters);
}
TypeName returnType = node.returnType;
- checkForNonVoidReturnTypeForSetter(returnType);
+ _checkForNonVoidReturnTypeForSetter(returnType);
}
}
return super.visitFunctionDeclaration(node);
@@ -17292,16 +17292,16 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
Expression functionExpression = node.function;
Type2 expressionType = functionExpression.staticType;
- if (!isFunctionType(expressionType)) {
+ if (!_isFunctionType(expressionType)) {
_errorReporter.reportErrorForNode(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, functionExpression, []);
}
return super.visitFunctionExpressionInvocation(node);
}
Object visitFunctionTypeAlias(FunctionTypeAlias node) {
- checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
- checkForDefaultValueInFunctionTypeAlias(node);
- checkForTypeAliasCannotReferenceItself_function(node);
+ _checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
+ _checkForDefaultValueInFunctionTypeAlias(node);
+ _checkForTypeAliasCannotReferenceItself_function(node);
return super.visitFunctionTypeAlias(node);
}
@@ -17316,21 +17316,21 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
Object visitIfStatement(IfStatement node) {
- checkForNonBoolCondition(node.condition);
+ _checkForNonBoolCondition(node.condition);
return super.visitIfStatement(node);
}
Object visitImportDirective(ImportDirective node) {
ImportElement importElement = node.element;
if (importElement != null) {
- checkForImportDuplicateLibraryName(node, importElement);
- checkForImportInternalLibrary(node, importElement);
+ _checkForImportDuplicateLibraryName(node, importElement);
+ _checkForImportInternalLibrary(node, importElement);
}
return super.visitImportDirective(node);
}
Object visitIndexExpression(IndexExpression node) {
- checkForArgumentTypeNotAssignableForArgument(node.index);
+ _checkForArgumentTypeNotAssignableForArgument(node.index);
return super.visitIndexExpression(node);
}
@@ -17342,13 +17342,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
Type2 type = typeName.type;
if (type is InterfaceType) {
InterfaceType interfaceType = type;
- checkForConstOrNewWithAbstractClass(node, typeName, interfaceType);
+ _checkForConstOrNewWithAbstractClass(node, typeName, interfaceType);
if (_isInConstInstanceCreation) {
- checkForConstWithNonConst(node);
- checkForConstWithUndefinedConstructor(node);
- checkForConstWithTypeParametersInCreation(node);
+ _checkForConstWithNonConst(node);
+ _checkForConstWithUndefinedConstructor(node);
+ _checkForConstWithTypeParametersInCreation(node);
} else {
- checkForNewWithUndefinedConstructor(node);
+ _checkForNewWithUndefinedConstructor(node);
}
}
return super.visitInstanceCreationExpression(node);
@@ -17363,12 +17363,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
if (typeArguments != null) {
NodeList<TypeName> arguments = typeArguments.arguments;
if (arguments.length != 0) {
- checkForInvalidTypeArgumentInConstTypedLiteral(arguments, CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST);
+ _checkForInvalidTypeArgumentInConstTypedLiteral(arguments, CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST);
}
}
}
- checkForExpectedOneListTypeArgument(node);
- checkForListElementTypeNotAssignable(node);
+ _checkForExpectedOneListTypeArgument(node);
+ _checkForListElementTypeNotAssignable(node);
return super.visitListLiteral(node);
}
@@ -17378,14 +17378,14 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
NodeList<TypeName> arguments = typeArguments.arguments;
if (arguments.length != 0) {
if (node.constKeyword != null) {
- checkForInvalidTypeArgumentInConstTypedLiteral(arguments, CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP);
+ _checkForInvalidTypeArgumentInConstTypedLiteral(arguments, CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP);
}
}
}
- checkExpectedTwoMapTypeArguments(typeArguments);
- checkForNonConstMapAsExpressionStatement(node);
- checkForMapTypeNotAssignable(node);
- checkForConstMapKeyExpressionTypeImplementsEquals(node);
+ _checkExpectedTwoMapTypeArguments(typeArguments);
+ _checkForNonConstMapAsExpressionStatement(node);
+ _checkForMapTypeNotAssignable(node);
+ _checkForConstMapKeyExpressionTypeImplementsEquals(node);
return super.visitMapLiteral(node);
}
@@ -17400,21 +17400,21 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
methodName = identifier.name;
}
if (node.isSetter || node.isGetter) {
- checkForMismatchedAccessorTypes(node, methodName);
+ _checkForMismatchedAccessorTypes(node, methodName);
}
if (node.isGetter) {
- checkForConflictingStaticGetterAndInstanceSetter(node);
+ _checkForConflictingStaticGetterAndInstanceSetter(node);
} else if (node.isSetter) {
- checkForWrongNumberOfParametersForSetter(node.name, node.parameters);
- checkForNonVoidReturnTypeForSetter(node.returnType);
- checkForConflictingStaticSetterAndInstanceMember(node);
+ _checkForWrongNumberOfParametersForSetter(node.name, node.parameters);
+ _checkForNonVoidReturnTypeForSetter(node.returnType);
+ _checkForConflictingStaticSetterAndInstanceMember(node);
} else if (node.isOperator) {
- checkForOptionalParameterInOperator(node);
- checkForWrongNumberOfParametersForOperator(node);
- checkForNonVoidReturnTypeForOperator(node);
+ _checkForOptionalParameterInOperator(node);
+ _checkForWrongNumberOfParametersForOperator(node);
+ _checkForNonVoidReturnTypeForOperator(node);
}
- checkForConcreteClassWithAbstractMember(node);
- checkForAllInvalidOverrideErrorCodesForMethod(node);
+ _checkForConcreteClassWithAbstractMember(node);
+ _checkForAllInvalidOverrideErrorCodesForMethod(node);
return super.visitMethodDeclaration(node);
} finally {
_enclosingFunction = previousFunction;
@@ -17427,10 +17427,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
SimpleIdentifier methodName = node.methodName;
if (target != null) {
ClassElement typeReference = ElementResolver.getTypeReference(target);
- checkForStaticAccessToInstanceMember(typeReference, methodName);
- checkForInstanceAccessToStaticMember(typeReference, methodName);
+ _checkForStaticAccessToInstanceMember(typeReference, methodName);
+ _checkForInstanceAccessToStaticMember(typeReference, methodName);
} else {
- checkForUnqualifiedReferenceToNonLocalStaticMember(methodName);
+ _checkForUnqualifiedReferenceToNonLocalStaticMember(methodName);
}
return super.visitMethodInvocation(node);
}
@@ -17444,13 +17444,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
Object visitNativeFunctionBody(NativeFunctionBody node) {
- checkForNativeFunctionBodyInNonSDKCode(node);
+ _checkForNativeFunctionBodyInNonSDKCode(node);
return super.visitNativeFunctionBody(node);
}
Object visitPostfixExpression(PostfixExpression node) {
- checkForAssignmentToFinal(node.operand);
- checkForIntNotAssignable(node.operand);
+ _checkForAssignmentToFinal(node.operand);
+ _checkForIntNotAssignable(node.operand);
return super.visitPostfixExpression(node);
}
@@ -17458,8 +17458,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
if (node.parent is! Annotation) {
ClassElement typeReference = ElementResolver.getTypeReference(node.prefix);
SimpleIdentifier name = node.identifier;
- checkForStaticAccessToInstanceMember(typeReference, name);
- checkForInstanceAccessToStaticMember(typeReference, name);
+ _checkForStaticAccessToInstanceMember(typeReference, name);
+ _checkForInstanceAccessToStaticMember(typeReference, name);
}
return super.visitPrefixedIdentifier(node);
}
@@ -17468,19 +17468,19 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
sc.TokenType operatorType = node.operator.type;
Expression operand = node.operand;
if (identical(operatorType, sc.TokenType.BANG)) {
- checkForNonBoolNegationExpression(operand);
+ _checkForNonBoolNegationExpression(operand);
} else if (operatorType.isIncrementOperator) {
- checkForAssignmentToFinal(operand);
+ _checkForAssignmentToFinal(operand);
}
- checkForIntNotAssignable(operand);
+ _checkForIntNotAssignable(operand);
return super.visitPrefixExpression(node);
}
Object visitPropertyAccess(PropertyAccess node) {
ClassElement typeReference = ElementResolver.getTypeReference(node.realTarget);
SimpleIdentifier propertyName = node.propertyName;
- checkForStaticAccessToInstanceMember(typeReference, propertyName);
- checkForInstanceAccessToStaticMember(typeReference, propertyName);
+ _checkForStaticAccessToInstanceMember(typeReference, propertyName);
+ _checkForInstanceAccessToStaticMember(typeReference, propertyName);
return super.visitPropertyAccess(node);
}
@@ -17494,7 +17494,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
Object visitRethrowExpression(RethrowExpression node) {
- checkForRethrowOutsideCatch(node);
+ _checkForRethrowOutsideCatch(node);
return super.visitRethrowExpression(node);
}
@@ -17504,20 +17504,20 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
} else {
_returnsWith.add(node);
}
- checkForAllReturnStatementErrorCodes(node);
+ _checkForAllReturnStatementErrorCodes(node);
return super.visitReturnStatement(node);
}
Object visitSimpleFormalParameter(SimpleFormalParameter node) {
- checkForConstFormalParameter(node);
- checkForPrivateOptionalParameter(node);
+ _checkForConstFormalParameter(node);
+ _checkForPrivateOptionalParameter(node);
return super.visitSimpleFormalParameter(node);
}
Object visitSimpleIdentifier(SimpleIdentifier node) {
- checkForImplicitThisReferenceInInitializer(node);
- if (!isUnqualifiedReferenceToNonLocalStaticMemberAllowed(node)) {
- checkForUnqualifiedReferenceToNonLocalStaticMember(node);
+ _checkForImplicitThisReferenceInInitializer(node);
+ if (!_isUnqualifiedReferenceToNonLocalStaticMemberAllowed(node)) {
+ _checkForUnqualifiedReferenceToNonLocalStaticMember(node);
}
return super.visitSimpleIdentifier(node);
}
@@ -17532,36 +17532,36 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
Object visitSwitchStatement(SwitchStatement node) {
- checkForInconsistentCaseExpressionTypes(node);
- checkForSwitchExpressionNotAssignable(node);
- checkForCaseBlocksNotTerminated(node);
+ _checkForInconsistentCaseExpressionTypes(node);
+ _checkForSwitchExpressionNotAssignable(node);
+ _checkForCaseBlocksNotTerminated(node);
return super.visitSwitchStatement(node);
}
Object visitThisExpression(ThisExpression node) {
- checkForInvalidReferenceToThis(node);
+ _checkForInvalidReferenceToThis(node);
return super.visitThisExpression(node);
}
Object visitThrowExpression(ThrowExpression node) {
- checkForConstEvalThrowsException(node);
+ _checkForConstEvalThrowsException(node);
return super.visitThrowExpression(node);
}
Object visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
- checkForFinalNotInitialized(node.variables);
+ _checkForFinalNotInitialized(node.variables);
return super.visitTopLevelVariableDeclaration(node);
}
Object visitTypeName(TypeName node) {
- checkForTypeArgumentNotMatchingBounds(node);
- checkForTypeParameterReferencedByStatic(node);
+ _checkForTypeArgumentNotMatchingBounds(node);
+ _checkForTypeParameterReferencedByStatic(node);
return super.visitTypeName(node);
}
Object visitTypeParameter(TypeParameter node) {
- checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME);
- checkForTypeParameterSupertypeOfItsBound(node);
+ _checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME);
+ _checkForTypeParameterSupertypeOfItsBound(node);
return super.visitTypeParameter(node);
}
@@ -17569,7 +17569,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
SimpleIdentifier nameNode = node.name;
Expression initializerNode = node.initializer;
// do checks
- checkForInvalidAssignment(nameNode, initializerNode);
+ _checkForInvalidAssignment(nameNode, initializerNode);
// visit name
nameNode.accept(this);
// visit initializer
@@ -17591,12 +17591,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
Object visitVariableDeclarationList(VariableDeclarationList node) => super.visitVariableDeclarationList(node);
Object visitVariableDeclarationStatement(VariableDeclarationStatement node) {
- checkForFinalNotInitialized(node.variables);
+ _checkForFinalNotInitialized(node.variables);
return super.visitVariableDeclarationStatement(node);
}
Object visitWhileStatement(WhileStatement node) {
- checkForNonBoolCondition(node.condition);
+ _checkForNonBoolCondition(node.condition);
return super.visitWhileStatement(node);
}
@@ -17607,7 +17607,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticTypeWarningCode#EXPECTED_TWO_MAP_TYPE_ARGUMENTS
*/
- bool checkExpectedTwoMapTypeArguments(TypeArgumentList typeArguments) {
+ bool _checkExpectedTwoMapTypeArguments(TypeArgumentList typeArguments) {
// has type arguments
if (typeArguments == null) {
return false;
@@ -17632,7 +17632,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR
* @see CompileTimeErrorCode#FINAL_INITIALIZED_MULTIPLE_TIMES
*/
- bool checkForAllFinalInitializedErrorCodes(ConstructorDeclaration node) {
+ bool _checkForAllFinalInitializedErrorCodes(ConstructorDeclaration node) {
if (node.factoryKeyword != null || node.redirectedConstructor != null || node.externalKeyword != null) {
return false;
}
@@ -17733,7 +17733,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see StaticWarningCode#INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE
* @see StaticWarningCode#INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES
*/
- bool checkForAllInvalidOverrideErrorCodes(ExecutableElement executableElement, ExecutableElement overriddenExecutable, List<ParameterElement> parameters, List<AstNode> parameterLocations, SimpleIdentifier errorNameTarget) {
+ bool _checkForAllInvalidOverrideErrorCodes(ExecutableElement executableElement, ExecutableElement overriddenExecutable, List<ParameterElement> parameters, List<AstNode> parameterLocations, SimpleIdentifier errorNameTarget) {
bool isGetter = false;
bool isSetter = false;
if (executableElement is PropertyAccessorElement) {
@@ -17940,7 +17940,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
ParameterElementImpl parameterElt = parameterElts[i];
EvaluationResultImpl result = parameterElt.evaluationResult;
// TODO (jwren) Ignore Object types, see Dart bug 11287
- if (isUserDefinedObject(result)) {
+ if (_isUserDefinedObject(result)) {
continue;
}
String parameterName = parameterElt.name;
@@ -17949,7 +17949,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
String overriddenParameterName = overriddenParameterElt.name;
if (parameterName != null && parameterName == overriddenParameterName) {
EvaluationResultImpl overriddenResult = overriddenParameterElt.evaluationResult;
- if (isUserDefinedObject(overriddenResult)) {
+ if (_isUserDefinedObject(overriddenResult)) {
break;
}
if (!result.equalValues(_typeProvider, overriddenResult)) {
@@ -17968,12 +17968,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
ParameterElementImpl parameterElt = parameterElts[i];
EvaluationResultImpl result = parameterElt.evaluationResult;
// TODO (jwren) Ignore Object types, see Dart bug 11287
- if (isUserDefinedObject(result)) {
+ if (_isUserDefinedObject(result)) {
continue;
}
ParameterElementImpl overriddenParameterElt = overriddenParameterElts[i];
EvaluationResultImpl overriddenResult = overriddenParameterElt.evaluationResult;
- if (isUserDefinedObject(overriddenResult)) {
+ if (_isUserDefinedObject(overriddenResult)) {
continue;
}
if (!result.equalValues(_typeProvider, overriddenResult)) {
@@ -18000,7 +18000,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @param errorNameTarget the node to report problems on
* @return `true` if and only if an error code is generated on the passed node
*/
- bool checkForAllInvalidOverrideErrorCodesForExecutable(ExecutableElement executableElement, List<ParameterElement> parameters, List<AstNode> parameterLocations, SimpleIdentifier errorNameTarget) {
+ bool _checkForAllInvalidOverrideErrorCodesForExecutable(ExecutableElement executableElement, List<ParameterElement> parameters, List<AstNode> parameterLocations, SimpleIdentifier errorNameTarget) {
//
// Compute the overridden executable from the InheritanceManager
//
@@ -18013,7 +18013,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
MultiplyInheritedExecutableElement multiplyInheritedElement = overriddenExecutable;
List<ExecutableElement> overriddenElement = multiplyInheritedElement.inheritedElements;
for (int i = 0; i < overriddenElement.length; i++) {
- if (checkForAllInvalidOverrideErrorCodes(executableElement, overriddenElement[i], parameters, parameterLocations, errorNameTarget)) {
+ if (_checkForAllInvalidOverrideErrorCodes(executableElement, overriddenElement[i], parameters, parameterLocations, errorNameTarget)) {
return true;
}
}
@@ -18022,7 +18022,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
//
// Otherwise, just call checkForAllInvalidOverrideErrorCodes.
//
- return checkForAllInvalidOverrideErrorCodes(executableElement, overriddenExecutable, parameters, parameterLocations, errorNameTarget);
+ return _checkForAllInvalidOverrideErrorCodes(executableElement, overriddenExecutable, parameters, parameterLocations, errorNameTarget);
}
/**
@@ -18032,7 +18032,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see #checkForAllInvalidOverrideErrorCodes(ExecutableElement)
*/
- bool checkForAllInvalidOverrideErrorCodesForField(FieldDeclaration node) {
+ bool _checkForAllInvalidOverrideErrorCodesForField(FieldDeclaration node) {
if (_enclosingClass == null || node.isStatic) {
return false;
}
@@ -18047,10 +18047,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
PropertyAccessorElement setter = element.setter;
SimpleIdentifier fieldName = field.name;
if (getter != null) {
- hasProblems = javaBooleanOr(hasProblems, checkForAllInvalidOverrideErrorCodesForExecutable(getter, ParameterElementImpl.EMPTY_ARRAY, AstNode.EMPTY_ARRAY, fieldName));
+ hasProblems = javaBooleanOr(hasProblems, _checkForAllInvalidOverrideErrorCodesForExecutable(getter, ParameterElementImpl.EMPTY_ARRAY, AstNode.EMPTY_ARRAY, fieldName));
}
if (setter != null) {
- hasProblems = javaBooleanOr(hasProblems, checkForAllInvalidOverrideErrorCodesForExecutable(setter, setter.parameters, <AstNode> [fieldName], fieldName));
+ hasProblems = javaBooleanOr(hasProblems, _checkForAllInvalidOverrideErrorCodesForExecutable(setter, setter.parameters, <AstNode> [fieldName], fieldName));
}
}
return hasProblems;
@@ -18063,7 +18063,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see #checkForAllInvalidOverrideErrorCodes(ExecutableElement)
*/
- bool checkForAllInvalidOverrideErrorCodesForMethod(MethodDeclaration node) {
+ bool _checkForAllInvalidOverrideErrorCodesForMethod(MethodDeclaration node) {
if (_enclosingClass == null || node.isStatic || node.body is NativeFunctionBody) {
return false;
}
@@ -18078,7 +18078,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
FormalParameterList formalParameterList = node.parameters;
NodeList<FormalParameter> parameterList = formalParameterList != null ? formalParameterList.parameters : null;
List<AstNode> parameters = parameterList != null ? new List.from(parameterList) : null;
- return checkForAllInvalidOverrideErrorCodesForExecutable(executableElement, executableElement.parameters, parameters, methodName);
+ return _checkForAllInvalidOverrideErrorCodesForExecutable(executableElement, executableElement.parameters, parameters, methodName);
}
/**
@@ -18090,7 +18090,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#MIXIN_INHERITS_FROM_NOT_OBJECT
* @see CompileTimeErrorCode#MIXIN_REFERENCES_SUPER
*/
- bool checkForAllMixinErrorCodes(WithClause withClause) {
+ bool _checkForAllMixinErrorCodes(WithClause withClause) {
if (withClause == null) {
return false;
}
@@ -18100,13 +18100,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
if (mixinType is! InterfaceType) {
continue;
}
- if (checkForExtendsOrImplementsDisallowedClass(mixinName, CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS)) {
+ if (_checkForExtendsOrImplementsDisallowedClass(mixinName, CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS)) {
problemReported = true;
} else {
ClassElement mixinElement = (mixinType as InterfaceType).element;
- problemReported = javaBooleanOr(problemReported, checkForMixinDeclaresConstructor(mixinName, mixinElement));
- problemReported = javaBooleanOr(problemReported, checkForMixinInheritsNotFromObject(mixinName, mixinElement));
- problemReported = javaBooleanOr(problemReported, checkForMixinReferencesSuper(mixinName, mixinElement));
+ problemReported = javaBooleanOr(problemReported, _checkForMixinDeclaresConstructor(mixinName, mixinElement));
+ problemReported = javaBooleanOr(problemReported, _checkForMixinInheritsNotFromObject(mixinName, mixinElement));
+ problemReported = javaBooleanOr(problemReported, _checkForMixinReferencesSuper(mixinName, mixinElement));
}
}
return problemReported;
@@ -18121,7 +18121,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see StaticWarningCode#REDIRECT_TO_INVALID_FUNCTION_TYPE
* @see StaticWarningCode#REDIRECT_TO_MISSING_CONSTRUCTOR
*/
- bool checkForAllRedirectConstructorErrorCodes(ConstructorDeclaration node) {
+ bool _checkForAllRedirectConstructorErrorCodes(ConstructorDeclaration node) {
//
// Prepare redirected constructor node
//
@@ -18191,7 +18191,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see StaticWarningCode#RETURN_WITHOUT_VALUE
* @see StaticTypeWarningCode#RETURN_OF_INVALID_TYPE
*/
- bool checkForAllReturnStatementErrorCodes(ReturnStatement node) {
+ bool _checkForAllReturnStatementErrorCodes(ReturnStatement node) {
FunctionType functionType = _enclosingFunction == null ? null : _enclosingFunction.type;
Type2 expectedReturnType = functionType == null ? DynamicTypeImpl.instance : functionType.returnType;
Expression returnExpression = node.expression;
@@ -18213,7 +18213,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
return true;
}
// RETURN_OF_INVALID_TYPE
- return checkForReturnOfInvalidType(returnExpression, expectedReturnType);
+ return _checkForReturnOfInvalidType(returnExpression, expectedReturnType);
}
/**
@@ -18226,7 +18226,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#AMBIGUOUS_EXPORT
*/
- bool checkForAmbiguousExport(ExportDirective node, ExportElement exportElement) {
+ bool _checkForAmbiguousExport(ExportDirective node, ExportElement exportElement) {
// prepare exported library
LibraryElement exportedLibrary = exportElement.exportedLibrary;
if (exportedLibrary == null) {
@@ -18264,7 +18264,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE
*/
- bool checkForArgumentTypeNotAssignable(Expression expression, Type2 expectedStaticType, Type2 actualStaticType, Type2 expectedPropagatedType, Type2 actualPropagatedType, ErrorCode errorCode) {
+ bool _checkForArgumentTypeNotAssignable(Expression expression, Type2 expectedStaticType, Type2 actualStaticType, Type2 expectedPropagatedType, Type2 actualPropagatedType, ErrorCode errorCode) {
//
// Test static type information
//
@@ -18287,7 +18287,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE
*/
- bool checkForArgumentTypeNotAssignableForArgument(Expression argument) {
+ bool _checkForArgumentTypeNotAssignableForArgument(Expression argument) {
if (argument == null) {
return false;
}
@@ -18295,7 +18295,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
Type2 staticParameterType = staticParameterElement == null ? null : staticParameterElement.type;
ParameterElement propagatedParameterElement = argument.propagatedParameterElement;
Type2 propagatedParameterType = propagatedParameterElement == null ? null : propagatedParameterElement.type;
- return checkForArgumentTypeNotAssignableWithExpectedTypes(argument, staticParameterType, propagatedParameterType, StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
+ return _checkForArgumentTypeNotAssignableWithExpectedTypes(argument, staticParameterType, propagatedParameterType, StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
}
/**
@@ -18307,7 +18307,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE
*/
- bool checkForArgumentTypeNotAssignableWithExpectedTypes(Expression expression, Type2 expectedStaticType, Type2 expectedPropagatedType, ErrorCode errorCode) => checkForArgumentTypeNotAssignable(expression, expectedStaticType, getStaticType(expression), expectedPropagatedType, expression.propagatedType, errorCode);
+ bool _checkForArgumentTypeNotAssignableWithExpectedTypes(Expression expression, Type2 expectedStaticType, Type2 expectedPropagatedType, ErrorCode errorCode) => _checkForArgumentTypeNotAssignable(expression, expectedStaticType, _getStaticType(expression), expectedPropagatedType, expression.propagatedType, errorCode);
/**
* This verifies that the passed arguments can be assigned to their corresponding parameters.
@@ -18316,13 +18316,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE
*/
- bool checkForArgumentTypesNotAssignableInList(ArgumentList argumentList) {
+ bool _checkForArgumentTypesNotAssignableInList(ArgumentList argumentList) {
if (argumentList == null) {
return false;
}
bool problemReported = false;
for (Expression argument in argumentList.arguments) {
- problemReported = javaBooleanOr(problemReported, checkForArgumentTypeNotAssignableForArgument(argument));
+ problemReported = javaBooleanOr(problemReported, _checkForArgumentTypeNotAssignableForArgument(argument));
}
// done
return problemReported;
@@ -18337,7 +18337,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see StaticWarningCode#ASSIGNMENT_TO_FINAL
* @see StaticWarningCode#ASSIGNMENT_TO_METHOD
*/
- bool checkForAssignmentToFinal(Expression expression) {
+ bool _checkForAssignmentToFinal(Expression expression) {
// prepare element
Element element = null;
if (expression is Identifier) {
@@ -18385,7 +18385,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME
* @see CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME
*/
- bool checkForBuiltInIdentifierAsName(SimpleIdentifier identifier, ErrorCode errorCode) {
+ bool _checkForBuiltInIdentifierAsName(SimpleIdentifier identifier, ErrorCode errorCode) {
sc.Token token = identifier.token;
if (identical(token.type, sc.TokenType.KEYWORD)) {
_errorReporter.reportErrorForNode(errorCode, identifier, [identifier.name]);
@@ -18402,7 +18402,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#CASE_BLOCK_NOT_TERMINATED
*/
- bool checkForCaseBlockNotTerminated(SwitchCase node) {
+ bool _checkForCaseBlockNotTerminated(SwitchCase node) {
NodeList<Statement> statements = node.statements;
if (statements.isEmpty) {
// fall-through without statements at all
@@ -18442,14 +18442,14 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#CASE_BLOCK_NOT_TERMINATED
*/
- bool checkForCaseBlocksNotTerminated(SwitchStatement node) {
+ bool _checkForCaseBlocksNotTerminated(SwitchStatement node) {
bool foundError = false;
NodeList<SwitchMember> members = node.members;
int lastMember = members.length - 1;
for (int i = 0; i < lastMember; i++) {
SwitchMember member = members[i];
if (member is SwitchCase) {
- foundError = javaBooleanOr(foundError, checkForCaseBlockNotTerminated(member));
+ foundError = javaBooleanOr(foundError, _checkForCaseBlockNotTerminated(member));
}
}
return foundError;
@@ -18464,8 +18464,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS
*/
- bool checkForCaseExpressionTypeImplementsEquals(SwitchStatement node, Type2 type) {
- if (!implementsEqualsWhenNotAllowed(type)) {
+ bool _checkForCaseExpressionTypeImplementsEquals(SwitchStatement node, Type2 type) {
+ if (!_implementsEqualsWhenNotAllowed(type)) {
return false;
}
// report error
@@ -18481,7 +18481,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#CONCRETE_CLASS_WITH_ABSTRACT_MEMBER
*/
- bool checkForConcreteClassWithAbstractMember(MethodDeclaration node) {
+ bool _checkForConcreteClassWithAbstractMember(MethodDeclaration node) {
if (node.isAbstract && _enclosingClass != null && !_enclosingClass.isAbstract) {
SimpleIdentifier methodName = node.name;
_errorReporter.reportErrorForNode(StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER, methodName, [methodName.name, _enclosingClass.displayName]);
@@ -18501,7 +18501,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD
* @see CompileTimeErrorCode#CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD
*/
- bool checkForConflictingConstructorNameAndMember(ConstructorDeclaration node) {
+ bool _checkForConflictingConstructorNameAndMember(ConstructorDeclaration node) {
ConstructorElement constructorElement = node.element;
SimpleIdentifier constructorName = node.name;
String name = constructorElement.name;
@@ -18547,7 +18547,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#CONFLICTING_GETTER_AND_METHOD
* @see CompileTimeErrorCode#CONFLICTING_METHOD_AND_GETTER
*/
- bool checkForConflictingGetterAndMethod() {
+ bool _checkForConflictingGetterAndMethod() {
if (_enclosingClass == null) {
return false;
}
@@ -18599,7 +18599,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see StaticWarningCode#CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER
* @see StaticWarningCode#CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER
*/
- bool checkForConflictingInstanceGetterAndSuperclassMember() {
+ bool _checkForConflictingInstanceGetterAndSuperclassMember() {
if (_enclosingClass == null) {
return false;
}
@@ -18659,7 +18659,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#CONFLICTING_INSTANCE_METHOD_SETTER
*/
- bool checkForConflictingInstanceMethodSetter(ClassDeclaration node) {
+ bool _checkForConflictingInstanceMethodSetter(ClassDeclaration node) {
// Reference all of the class members in this class.
NodeList<ClassMember> classMembers = node.members;
if (classMembers.isEmpty) {
@@ -18740,7 +18740,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER
*/
- bool checkForConflictingStaticGetterAndInstanceSetter(MethodDeclaration node) {
+ bool _checkForConflictingStaticGetterAndInstanceSetter(MethodDeclaration node) {
if (!node.isStatic) {
return false;
}
@@ -18780,7 +18780,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER
*/
- bool checkForConflictingStaticSetterAndInstanceMember(MethodDeclaration node) {
+ bool _checkForConflictingStaticSetterAndInstanceMember(MethodDeclaration node) {
if (!node.isStatic) {
return false;
}
@@ -18827,7 +18827,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#CONFLICTING_TYPE_VARIABLE_AND_CLASS
* @see CompileTimeErrorCode#CONFLICTING_TYPE_VARIABLE_AND_MEMBER
*/
- bool checkForConflictingTypeVariableErrorCodes(ClassDeclaration node) {
+ bool _checkForConflictingTypeVariableErrorCodes(ClassDeclaration node) {
bool problemReported = false;
for (TypeParameterElement typeParameter in _enclosingClass.typeParameters) {
String name = typeParameter.name;
@@ -18853,7 +18853,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER
*/
- bool checkForConstConstructorWithNonConstSuper(ConstructorDeclaration node) {
+ bool _checkForConstConstructorWithNonConstSuper(ConstructorDeclaration node) {
if (!_isEnclosingConstructorConst) {
return false;
}
@@ -18901,7 +18901,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD
*/
- bool checkForConstConstructorWithNonFinalField(ConstructorDeclaration node) {
+ bool _checkForConstConstructorWithNonFinalField(ConstructorDeclaration node) {
if (!_isEnclosingConstructorConst) {
return false;
}
@@ -18924,7 +18924,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#CONST_CONSTRUCTOR_THROWS_EXCEPTION
*/
- bool checkForConstEvalThrowsException(ThrowExpression node) {
+ bool _checkForConstEvalThrowsException(ThrowExpression node) {
if (_isEnclosingConstructorConst) {
_errorReporter.reportErrorForNode(CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION, node, []);
return true;
@@ -18939,7 +18939,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#CONST_FORMAL_PARAMETER
*/
- bool checkForConstFormalParameter(NormalFormalParameter node) {
+ bool _checkForConstFormalParameter(NormalFormalParameter node) {
if (node.isConst) {
_errorReporter.reportErrorForNode(CompileTimeErrorCode.CONST_FORMAL_PARAMETER, node, []);
return true;
@@ -18955,7 +18955,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS
*/
- bool checkForConstMapKeyExpressionTypeImplementsEquals(MapLiteral node) {
+ bool _checkForConstMapKeyExpressionTypeImplementsEquals(MapLiteral node) {
// OK, not const.
if (node.constKeyword == null) {
return false;
@@ -18965,7 +18965,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
for (MapLiteralEntry entry in node.entries) {
Expression key = entry.key;
Type2 type = key.staticType;
- if (implementsEqualsWhenNotAllowed(type)) {
+ if (_implementsEqualsWhenNotAllowed(type)) {
_errorReporter.reportErrorForNode(CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, key, [type.displayName]);
hasProblems = true;
}
@@ -18985,7 +18985,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see StaticWarningCode#CONST_WITH_ABSTRACT_CLASS
* @see StaticWarningCode#NEW_WITH_ABSTRACT_CLASS
*/
- bool checkForConstOrNewWithAbstractClass(InstanceCreationExpression node, TypeName typeName, InterfaceType type) {
+ bool _checkForConstOrNewWithAbstractClass(InstanceCreationExpression node, TypeName typeName, InterfaceType type) {
if (type.element.isAbstract) {
ConstructorElement element = node.staticElement;
if (element != null && !element.isFactory) {
@@ -19010,7 +19010,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#CONST_WITH_NON_CONST
*/
- bool checkForConstWithNonConst(InstanceCreationExpression node) {
+ bool _checkForConstWithNonConst(InstanceCreationExpression node) {
ConstructorElement constructorElement = node.staticElement;
if (constructorElement != null && !constructorElement.isConst) {
_errorReporter.reportErrorForNode(CompileTimeErrorCode.CONST_WITH_NON_CONST, node, []);
@@ -19026,7 +19026,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#CONST_WITH_TYPE_PARAMETERS
*/
- bool checkForConstWithTypeParameters(TypeName typeName) {
+ bool _checkForConstWithTypeParameters(TypeName typeName) {
// something wrong with AST
if (typeName == null) {
return false;
@@ -19044,7 +19044,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
if (typeArguments != null) {
bool hasError = false;
for (TypeName argument in typeArguments.arguments) {
- hasError = javaBooleanOr(hasError, checkForConstWithTypeParameters(argument));
+ hasError = javaBooleanOr(hasError, _checkForConstWithTypeParameters(argument));
}
return hasError;
}
@@ -19062,13 +19062,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#CONST_WITH_TYPE_PARAMETERS
*/
- bool checkForConstWithTypeParametersInCreation(InstanceCreationExpression node) {
+ bool _checkForConstWithTypeParametersInCreation(InstanceCreationExpression node) {
ConstructorName constructorName = node.constructorName;
if (constructorName == null) {
return false;
}
TypeName typeName = constructorName.type;
- return checkForConstWithTypeParameters(typeName);
+ return _checkForConstWithTypeParameters(typeName);
}
/**
@@ -19082,7 +19082,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#CONST_WITH_UNDEFINED_CONSTRUCTOR
* @see CompileTimeErrorCode#CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT
*/
- bool checkForConstWithUndefinedConstructor(InstanceCreationExpression node) {
+ bool _checkForConstWithUndefinedConstructor(InstanceCreationExpression node) {
// OK if resolved
if (node.staticElement != null) {
return false;
@@ -19115,7 +19115,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS
*/
- bool checkForDefaultValueInFunctionTypeAlias(FunctionTypeAlias node) {
+ bool _checkForDefaultValueInFunctionTypeAlias(FunctionTypeAlias node) {
bool result = false;
FormalParameterList formalParameterList = node.parameters;
NodeList<FormalParameter> parameters = formalParameterList.parameters;
@@ -19139,7 +19139,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER
*/
- bool checkForDefaultValueInFunctionTypedParameter(DefaultFormalParameter node) {
+ bool _checkForDefaultValueInFunctionTypedParameter(DefaultFormalParameter node) {
// OK, not in a function typed parameter.
if (!_isInFunctionTypedFormalParameter) {
return false;
@@ -19160,7 +19160,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#DUPLICATE_DEFINITION_INHERITANCE
*/
- bool checkForDuplicateDefinitionInheritance() {
+ bool _checkForDuplicateDefinitionInheritance() {
if (_enclosingClass == null) {
return false;
}
@@ -19169,13 +19169,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
if (!member.isStatic) {
continue;
}
- hasProblem = javaBooleanOr(hasProblem, checkForDuplicateDefinitionOfMember(member));
+ hasProblem = javaBooleanOr(hasProblem, _checkForDuplicateDefinitionOfMember(member));
}
for (ExecutableElement member in _enclosingClass.accessors) {
if (!member.isStatic) {
continue;
}
- hasProblem = javaBooleanOr(hasProblem, checkForDuplicateDefinitionOfMember(member));
+ hasProblem = javaBooleanOr(hasProblem, _checkForDuplicateDefinitionOfMember(member));
}
return hasProblem;
}
@@ -19188,7 +19188,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#DUPLICATE_DEFINITION_INHERITANCE
*/
- bool checkForDuplicateDefinitionOfMember(ExecutableElement staticMember) {
+ bool _checkForDuplicateDefinitionOfMember(ExecutableElement staticMember) {
// prepare name
String name = staticMember.name;
if (name == null) {
@@ -19215,7 +19215,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticTypeWarningCode#EXPECTED_ONE_LIST_TYPE_ARGUMENTS
*/
- bool checkForExpectedOneListTypeArgument(ListLiteral node) {
+ bool _checkForExpectedOneListTypeArgument(ListLiteral node) {
// prepare type arguments
TypeArgumentList typeArguments = node.typeArguments;
if (typeArguments == null) {
@@ -19240,7 +19240,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#EXPORT_DUPLICATED_LIBRARY_NAME
*/
- bool checkForExportDuplicateLibraryName(ExportDirective node, ExportElement exportElement) {
+ bool _checkForExportDuplicateLibraryName(ExportDirective node, ExportElement exportElement) {
// prepare exported library
LibraryElement nodeLibrary = exportElement.exportedLibrary;
if (nodeLibrary == null) {
@@ -19274,7 +19274,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#EXPORT_INTERNAL_LIBRARY
*/
- bool checkForExportInternalLibrary(ExportDirective node, ExportElement exportElement) {
+ bool _checkForExportInternalLibrary(ExportDirective node, ExportElement exportElement) {
if (_isInSystemLibrary) {
return false;
}
@@ -19300,11 +19300,11 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#EXTENDS_DISALLOWED_CLASS
*/
- bool checkForExtendsDisallowedClass(ExtendsClause node) {
+ bool _checkForExtendsDisallowedClass(ExtendsClause node) {
if (node == null) {
return false;
}
- return checkForExtendsOrImplementsDisallowedClass(node.superclass, CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS);
+ return _checkForExtendsOrImplementsDisallowedClass(node.superclass, CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS);
}
/**
@@ -19318,7 +19318,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#EXTENDS_DISALLOWED_CLASS
* @see CompileTimeErrorCode#IMPLEMENTS_DISALLOWED_CLASS
*/
- bool checkForExtendsOrImplementsDisallowedClass(TypeName typeName, ErrorCode errorCode) {
+ bool _checkForExtendsOrImplementsDisallowedClass(TypeName typeName, ErrorCode errorCode) {
if (typeName.isSynthetic) {
return false;
}
@@ -19358,7 +19358,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE
* @see StaticWarningCode#FIELD_INITIALIZER_NOT_ASSIGNABLE
*/
- bool checkForFieldInitializerNotAssignable(ConstructorFieldInitializer node) {
+ bool _checkForFieldInitializerNotAssignable(ConstructorFieldInitializer node) {
// prepare field element
Element staticElement = node.fieldName.staticElement;
if (staticElement is! FieldElement) {
@@ -19373,7 +19373,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
return false;
}
// test the static type of the expression
- Type2 staticType = getStaticType(expression);
+ Type2 staticType = _getStaticType(expression);
if (staticType == null) {
return false;
}
@@ -19396,7 +19396,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR
*/
- bool checkForFieldInitializingFormalRedirectingConstructor(FieldFormalParameter node) {
+ bool _checkForFieldInitializingFormalRedirectingConstructor(FieldFormalParameter node) {
ConstructorDeclaration constructor = node.getAncestor((node) => node is ConstructorDeclaration);
if (constructor == null) {
_errorReporter.reportErrorForNode(CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, node, []);
@@ -19430,7 +19430,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#CONST_NOT_INITIALIZED
* @see StaticWarningCode#FINAL_NOT_INITIALIZED
*/
- bool checkForFinalNotInitialized(VariableDeclarationList node) {
+ bool _checkForFinalNotInitialized(VariableDeclarationList node) {
if (_isInNativeClass) {
return false;
}
@@ -19461,7 +19461,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#CONST_NOT_INITIALIZED
* @see StaticWarningCode#FINAL_NOT_INITIALIZED
*/
- bool checkForFinalNotInitializedInClass(ClassDeclaration node) {
+ bool _checkForFinalNotInitializedInClass(ClassDeclaration node) {
NodeList<ClassMember> classMembers = node.members;
for (ClassMember classMember in classMembers) {
if (classMember is ConstructorDeclaration) {
@@ -19472,7 +19472,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
for (ClassMember classMember in classMembers) {
if (classMember is FieldDeclaration) {
FieldDeclaration field = classMember;
- foundError = javaBooleanOr(foundError, checkForFinalNotInitialized(field.fields));
+ foundError = javaBooleanOr(foundError, _checkForFinalNotInitialized(field.fields));
}
}
return foundError;
@@ -19486,13 +19486,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#IMPLEMENTS_DISALLOWED_CLASS
*/
- bool checkForImplementsDisallowedClass(ImplementsClause node) {
+ bool _checkForImplementsDisallowedClass(ImplementsClause node) {
if (node == null) {
return false;
}
bool foundError = false;
for (TypeName type in node.interfaces) {
- foundError = javaBooleanOr(foundError, checkForExtendsOrImplementsDisallowedClass(type, CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS));
+ foundError = javaBooleanOr(foundError, _checkForExtendsOrImplementsDisallowedClass(type, CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS));
}
return foundError;
}
@@ -19506,7 +19506,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#IMPLICIT_THIS_REFERENCE_IN_INITIALIZER
* @see CompileTimeErrorCode#INSTANCE_MEMBER_ACCESS_FROM_STATIC TODO(scheglov) rename thid method
*/
- bool checkForImplicitThisReferenceInInitializer(SimpleIdentifier node) {
+ bool _checkForImplicitThisReferenceInInitializer(SimpleIdentifier node) {
if (!_isInConstructorInitializer && !_isInStaticMethod && !_isInInstanceVariableInitializer && !_isInStaticVariableDeclaration) {
return false;
}
@@ -19568,7 +19568,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#IMPORT_DUPLICATED_LIBRARY_NAME
*/
- bool checkForImportDuplicateLibraryName(ImportDirective node, ImportElement importElement) {
+ bool _checkForImportDuplicateLibraryName(ImportDirective node, ImportElement importElement) {
// prepare imported library
LibraryElement nodeLibrary = importElement.importedLibrary;
if (nodeLibrary == null) {
@@ -19602,7 +19602,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#IMPORT_INTERNAL_LIBRARY
*/
- bool checkForImportInternalLibrary(ImportDirective node, ImportElement importElement) {
+ bool _checkForImportInternalLibrary(ImportDirective node, ImportElement importElement) {
if (_isInSystemLibrary) {
return false;
}
@@ -19628,7 +19628,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#INCONSISTENT_CASE_EXPRESSION_TYPES
*/
- bool checkForInconsistentCaseExpressionTypes(SwitchStatement node) {
+ bool _checkForInconsistentCaseExpressionTypes(SwitchStatement node) {
// TODO(jwren) Revisit this algorithm, should there up to n-1 errors?
NodeList<SwitchMember> switchMembers = node.members;
bool foundError = false;
@@ -19652,7 +19652,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
}
if (!foundError) {
- checkForCaseExpressionTypeImplementsEquals(node, firstType);
+ _checkForCaseExpressionTypeImplementsEquals(node, firstType);
}
return foundError;
}
@@ -19664,7 +19664,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticTypeWarningCode#INCONSISTENT_METHOD_INHERITANCE
*/
- bool checkForInconsistentMethodInheritance() {
+ bool _checkForInconsistentMethodInheritance() {
// Ensure that the inheritance manager has a chance to generate all errors we may care about,
// note that we ensure that the interfaces data since there are no errors.
_inheritanceManager.getMapOfMembersInheritedFromInterfaces(_enclosingClass);
@@ -19689,7 +19689,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticTypeWarningCode#INSTANCE_ACCESS_TO_STATIC_MEMBER
*/
- bool checkForInstanceAccessToStaticMember(ClassElement typeReference, SimpleIdentifier name) {
+ bool _checkForInstanceAccessToStaticMember(ClassElement typeReference, SimpleIdentifier name) {
// OK, in comment
if (_isInComment) {
return false;
@@ -19726,7 +19726,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE
*/
- bool checkForIntNotAssignable(Expression argument) {
+ bool _checkForIntNotAssignable(Expression argument) {
if (argument == null) {
return false;
}
@@ -19734,7 +19734,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
Type2 staticParameterType = staticParameterElement == null ? null : staticParameterElement.type;
ParameterElement propagatedParameterElement = argument.propagatedParameterElement;
Type2 propagatedParameterType = propagatedParameterElement == null ? null : propagatedParameterElement.type;
- return checkForArgumentTypeNotAssignable(argument, staticParameterType, _intType, propagatedParameterType, _intType, StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
+ return _checkForArgumentTypeNotAssignable(argument, staticParameterType, _intType, propagatedParameterType, _intType, StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
}
/**
@@ -19745,20 +19745,20 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticTypeWarningCode#INVALID_ASSIGNMENT
*/
- bool checkForInvalidAssignment(Expression lhs, Expression rhs) {
+ bool _checkForInvalidAssignment(Expression lhs, Expression rhs) {
if (lhs == null || rhs == null) {
return false;
}
- VariableElement leftElement = getVariableElement(lhs);
- Type2 leftType = (leftElement == null) ? getStaticType(lhs) : leftElement.type;
- Type2 staticRightType = getStaticType(rhs);
+ VariableElement leftElement = _getVariableElement(lhs);
+ Type2 leftType = (leftElement == null) ? _getStaticType(lhs) : leftElement.type;
+ Type2 staticRightType = _getStaticType(rhs);
bool isStaticAssignable = staticRightType.isAssignableTo(leftType);
if (!isStaticAssignable) {
String leftName = leftType.displayName;
String rightName = staticRightType.displayName;
if (leftName == rightName) {
- leftName = getExtendedDisplayName(leftType);
- rightName = getExtendedDisplayName(staticRightType);
+ leftName = _getExtendedDisplayName(leftType);
+ rightName = _getExtendedDisplayName(staticRightType);
}
_errorReporter.reportErrorForNode(StaticTypeWarningCode.INVALID_ASSIGNMENT, rhs, [rightName, leftName]);
return true;
@@ -19785,13 +19785,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticTypeWarningCode#INVALID_ASSIGNMENT
*/
- bool checkForInvalidCompoundAssignment(AssignmentExpression node) {
+ bool _checkForInvalidCompoundAssignment(AssignmentExpression node) {
Expression lhs = node.leftHandSide;
if (lhs == null) {
return false;
}
- VariableElement leftElement = getVariableElement(lhs);
- Type2 leftType = (leftElement == null) ? getStaticType(lhs) : leftElement.type;
+ VariableElement leftElement = _getVariableElement(lhs);
+ Type2 leftType = (leftElement == null) ? _getStaticType(lhs) : leftElement.type;
MethodElement invokedMethod = node.staticElement;
if (invokedMethod == null) {
return false;
@@ -19804,8 +19804,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
String leftName = leftType.displayName;
String rightName = rightType.displayName;
if (leftName == rightName) {
- leftName = getExtendedDisplayName(leftType);
- rightName = getExtendedDisplayName(rightType);
+ leftName = _getExtendedDisplayName(leftType);
+ rightName = _getExtendedDisplayName(rightType);
}
_errorReporter.reportErrorForNode(StaticTypeWarningCode.INVALID_ASSIGNMENT, node.rightHandSide, [rightName, leftName]);
return true;
@@ -19818,7 +19818,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
*
* @param node the field initializer being checked
*/
- void checkForInvalidField(ConstructorFieldInitializer node) {
+ void _checkForInvalidField(ConstructorFieldInitializer node) {
SimpleIdentifier fieldName = node.fieldName;
Element staticElement = fieldName.staticElement;
if (staticElement is FieldElement) {
@@ -19841,8 +19841,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#INVALID_REFERENCE_TO_THIS
*/
- bool checkForInvalidReferenceToThis(ThisExpression node) {
- if (!isThisInValidContext(node)) {
+ bool _checkForInvalidReferenceToThis(ThisExpression node) {
+ if (!_isThisInValidContext(node)) {
_errorReporter.reportErrorForNode(CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS, node, []);
return true;
}
@@ -19859,7 +19859,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* [CompileTimeErrorCode#INVALID_TYPE_ARGUMENT_IN_CONST_MAP]
* @return `true` if and only if an error code is generated on the passed node
*/
- bool checkForInvalidTypeArgumentInConstTypedLiteral(NodeList<TypeName> arguments, ErrorCode errorCode) {
+ bool _checkForInvalidTypeArgumentInConstTypedLiteral(NodeList<TypeName> arguments, ErrorCode errorCode) {
bool foundError = false;
for (TypeName typeName in arguments) {
if (typeName.type is TypeParameterType) {
@@ -19879,7 +19879,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#LIST_ELEMENT_TYPE_NOT_ASSIGNABLE
* @see StaticWarningCode#LIST_ELEMENT_TYPE_NOT_ASSIGNABLE
*/
- bool checkForListElementTypeNotAssignable(ListLiteral node) {
+ bool _checkForListElementTypeNotAssignable(ListLiteral node) {
// Prepare list element type.
TypeArgumentList typeArgumentList = node.typeArguments;
if (typeArgumentList == null) {
@@ -19900,7 +19900,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
// Check every list element.
bool hasProblems = false;
for (Expression element in node.elements) {
- hasProblems = javaBooleanOr(hasProblems, checkForArgumentTypeNotAssignableWithExpectedTypes(element, listElementType, null, errorCode));
+ hasProblems = javaBooleanOr(hasProblems, _checkForArgumentTypeNotAssignableWithExpectedTypes(element, listElementType, null, errorCode));
}
return hasProblems;
}
@@ -19916,7 +19916,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see StaticWarningCode#MAP_KEY_TYPE_NOT_ASSIGNABLE
* @see StaticWarningCode#MAP_VALUE_TYPE_NOT_ASSIGNABLE
*/
- bool checkForMapTypeNotAssignable(MapLiteral node) {
+ bool _checkForMapTypeNotAssignable(MapLiteral node) {
// Prepare maps key/value types.
TypeArgumentList typeArgumentList = node.typeArguments;
if (typeArgumentList == null) {
@@ -19944,8 +19944,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
for (MapLiteralEntry entry in entries) {
Expression key = entry.key;
Expression value = entry.value;
- hasProblems = javaBooleanOr(hasProblems, checkForArgumentTypeNotAssignableWithExpectedTypes(key, keyType, null, keyErrorCode));
- hasProblems = javaBooleanOr(hasProblems, checkForArgumentTypeNotAssignableWithExpectedTypes(value, valueType, null, valueErrorCode));
+ hasProblems = javaBooleanOr(hasProblems, _checkForArgumentTypeNotAssignableWithExpectedTypes(key, keyType, null, keyErrorCode));
+ hasProblems = javaBooleanOr(hasProblems, _checkForArgumentTypeNotAssignableWithExpectedTypes(value, valueType, null, valueErrorCode));
}
return hasProblems;
}
@@ -19957,7 +19957,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#MEMBER_WITH_CLASS_NAME
*/
- bool checkForMemberWithClassName() {
+ bool _checkForMemberWithClassName() {
if (_enclosingClass == null) {
return false;
}
@@ -19987,7 +19987,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES
* @see StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE
*/
- bool checkForMismatchedAccessorTypes(Declaration accessorDeclaration, String accessorTextName) {
+ bool _checkForMismatchedAccessorTypes(Declaration accessorDeclaration, String accessorTextName) {
ExecutableElement accessorElement = accessorDeclaration.element as ExecutableElement;
if (accessorElement is! PropertyAccessorElement) {
return false;
@@ -20033,11 +20033,11 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
Type2 setterType = null;
// Get an existing counterpart accessor if any.
if (propertyAccessorElement.isGetter) {
- getterType = getGetterType(propertyAccessorElement);
- setterType = getSetterType(counterpartAccessor);
+ getterType = _getGetterType(propertyAccessorElement);
+ setterType = _getSetterType(counterpartAccessor);
} else if (propertyAccessorElement.isSetter) {
- setterType = getSetterType(propertyAccessorElement);
- getterType = getGetterType(counterpartAccessor);
+ setterType = _getSetterType(propertyAccessorElement);
+ getterType = _getGetterType(counterpartAccessor);
}
// If either types are not assignable to each other, report an error (if the getter is null,
// it is dynamic which is assignable to everything).
@@ -20067,7 +20067,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#MIXED_RETURN_TYPES
*/
- bool checkForMixedReturns(BlockFunctionBody node) {
+ bool _checkForMixedReturns(BlockFunctionBody node) {
int withCount = _returnsWith.length;
int withoutCount = _returnsWithout.length;
if (withCount > 0 && withoutCount > 0) {
@@ -20090,7 +20090,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#MIXIN_DECLARES_CONSTRUCTOR
*/
- bool checkForMixinDeclaresConstructor(TypeName mixinName, ClassElement mixinElement) {
+ bool _checkForMixinDeclaresConstructor(TypeName mixinName, ClassElement mixinElement) {
for (ConstructorElement constructor in mixinElement.constructors) {
if (!constructor.isSynthetic && !constructor.isFactory) {
_errorReporter.reportErrorForNode(CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR, mixinName, [mixinElement.name]);
@@ -20108,7 +20108,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#MIXIN_INHERITS_FROM_NOT_OBJECT
*/
- bool checkForMixinInheritsNotFromObject(TypeName mixinName, ClassElement mixinElement) {
+ bool _checkForMixinInheritsNotFromObject(TypeName mixinName, ClassElement mixinElement) {
InterfaceType mixinSupertype = mixinElement.supertype;
if (mixinSupertype != null) {
if (!mixinSupertype.isObject || !mixinElement.isTypedef && mixinElement.mixins.length != 0) {
@@ -20127,7 +20127,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#MIXIN_REFERENCES_SUPER
*/
- bool checkForMixinReferencesSuper(TypeName mixinName, ClassElement mixinElement) {
+ bool _checkForMixinReferencesSuper(TypeName mixinName, ClassElement mixinElement) {
if (mixinElement.hasReferenceToSuper) {
_errorReporter.reportErrorForNode(CompileTimeErrorCode.MIXIN_REFERENCES_SUPER, mixinName, [mixinElement.name]);
}
@@ -20141,7 +20141,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#MULTIPLE_SUPER_INITIALIZERS
*/
- bool checkForMultipleSuperInitializers(ConstructorDeclaration node) {
+ bool _checkForMultipleSuperInitializers(ConstructorDeclaration node) {
int numSuperInitializers = 0;
for (ConstructorInitializer initializer in node.initializers) {
if (initializer is SuperConstructorInvocation) {
@@ -20161,7 +20161,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see ParserErrorCode#NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE
*/
- bool checkForNativeFunctionBodyInNonSDKCode(NativeFunctionBody node) {
+ bool _checkForNativeFunctionBodyInNonSDKCode(NativeFunctionBody node) {
if (!_isInSystemLibrary && !_hasExtUri) {
_errorReporter.reportErrorForNode(ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE, node, []);
return true;
@@ -20178,7 +20178,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#NEW_WITH_UNDEFINED_CONSTRUCTOR
*/
- bool checkForNewWithUndefinedConstructor(InstanceCreationExpression node) {
+ bool _checkForNewWithUndefinedConstructor(InstanceCreationExpression node) {
// OK if resolved
if (node.staticElement != null) {
return false;
@@ -20212,7 +20212,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
*/
- bool checkForNoDefaultSuperConstructorImplicit(ClassDeclaration node) {
+ bool _checkForNoDefaultSuperConstructorImplicit(ClassDeclaration node) {
// do nothing if there is explicit constructor
List<ConstructorElement> constructors = _enclosingClass.constructors;
if (!constructors[0].isSynthetic) {
@@ -20252,7 +20252,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see StaticWarningCode#NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR
* @see StaticWarningCode#NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS
*/
- bool checkForNonAbstractClassInheritsAbstractMember(ClassDeclaration node) {
+ bool _checkForNonAbstractClassInheritsAbstractMember(ClassDeclaration node) {
if (_enclosingClass.isAbstract) {
return false;
}
@@ -20297,7 +20297,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
InterfaceType enclosingType = _enclosingClass.type;
// Check to see if some element is in local enclosing class that matches the name of the
// required member.
- if (isMemberInClassOrMixin(executableElt, _enclosingClass)) {
+ if (_isMemberInClassOrMixin(executableElt, _enclosingClass)) {
// We do not have to verify that this implementation of the found method matches the
// required function type: the set of StaticWarningCode.INVALID_METHOD_OVERRIDE_* warnings
// break out the different specific situations.
@@ -20382,8 +20382,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticTypeWarningCode#NON_BOOL_CONDITION
*/
- bool checkForNonBoolCondition(Expression condition) {
- Type2 conditionType = getStaticType(condition);
+ bool _checkForNonBoolCondition(Expression condition) {
+ Type2 conditionType = _getStaticType(condition);
if (conditionType != null && !conditionType.isAssignableTo(_boolType)) {
_errorReporter.reportErrorForNode(StaticTypeWarningCode.NON_BOOL_CONDITION, condition, []);
return true;
@@ -20398,9 +20398,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticTypeWarningCode#NON_BOOL_EXPRESSION
*/
- bool checkForNonBoolExpression(AssertStatement node) {
+ bool _checkForNonBoolExpression(AssertStatement node) {
Expression expression = node.condition;
- Type2 type = getStaticType(expression);
+ Type2 type = _getStaticType(expression);
if (type is InterfaceType) {
if (!type.isAssignableTo(_boolType)) {
_errorReporter.reportErrorForNode(StaticTypeWarningCode.NON_BOOL_EXPRESSION, expression, []);
@@ -20423,8 +20423,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticTypeWarningCode#NON_BOOL_NEGATION_EXPRESSION
*/
- bool checkForNonBoolNegationExpression(Expression expression) {
- Type2 conditionType = getStaticType(expression);
+ bool _checkForNonBoolNegationExpression(Expression expression) {
+ Type2 conditionType = _getStaticType(expression);
if (conditionType != null && !conditionType.isAssignableTo(_boolType)) {
_errorReporter.reportErrorForNode(StaticTypeWarningCode.NON_BOOL_NEGATION_EXPRESSION, expression, []);
return true;
@@ -20442,7 +20442,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#NON_CONST_MAP_AS_EXPRESSION_STATEMENT
*/
- bool checkForNonConstMapAsExpressionStatement(MapLiteral node) {
+ bool _checkForNonConstMapAsExpressionStatement(MapLiteral node) {
// "const"
if (node.constKeyword != null) {
return false;
@@ -20473,7 +20473,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#NON_VOID_RETURN_FOR_OPERATOR
*/
- bool checkForNonVoidReturnTypeForOperator(MethodDeclaration node) {
+ bool _checkForNonVoidReturnTypeForOperator(MethodDeclaration node) {
// check that []= operator
SimpleIdentifier name = node.name;
if (name.name != "[]=") {
@@ -20498,7 +20498,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#NON_VOID_RETURN_FOR_SETTER
*/
- bool checkForNonVoidReturnTypeForSetter(TypeName typeName) {
+ bool _checkForNonVoidReturnTypeForSetter(TypeName typeName) {
if (typeName != null) {
Type2 type = typeName.type;
if (type != null && !type.isVoid) {
@@ -20518,7 +20518,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#OPTIONAL_PARAMETER_IN_OPERATOR
*/
- bool checkForOptionalParameterInOperator(MethodDeclaration node) {
+ bool _checkForOptionalParameterInOperator(MethodDeclaration node) {
FormalParameterList parameterList = node.parameters;
if (parameterList == null) {
return false;
@@ -20541,7 +20541,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#PRIVATE_OPTIONAL_PARAMETER
*/
- bool checkForPrivateOptionalParameter(FormalParameter node) {
+ bool _checkForPrivateOptionalParameter(FormalParameter node) {
// should be named parameter
if (node.kind != ParameterKind.NAMED) {
return false;
@@ -20564,7 +20564,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#RECURSIVE_CONSTRUCTOR_REDIRECT
*/
- bool checkForRecursiveConstructorRedirect(ConstructorDeclaration node) {
+ bool _checkForRecursiveConstructorRedirect(ConstructorDeclaration node) {
// we check generative constructor here
if (node.factoryKeyword != null) {
return false;
@@ -20574,7 +20574,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
if (initializer is RedirectingConstructorInvocation) {
// OK if no cycle
ConstructorElement element = node.element;
- if (!hasRedirectingFactoryConstructorCycle(element)) {
+ if (!_hasRedirectingFactoryConstructorCycle(element)) {
return false;
}
// report error
@@ -20594,7 +20594,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#RECURSIVE_FACTORY_REDIRECT
*/
- bool checkForRecursiveFactoryRedirect(ConstructorDeclaration node) {
+ bool _checkForRecursiveFactoryRedirect(ConstructorDeclaration node) {
// prepare redirected constructor
ConstructorName redirectedConstructorNode = node.redirectedConstructor;
if (redirectedConstructorNode == null) {
@@ -20602,7 +20602,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
// OK if no cycle
ConstructorElement element = node.element;
- if (!hasRedirectingFactoryConstructorCycle(element)) {
+ if (!_hasRedirectingFactoryConstructorCycle(element)) {
return false;
}
// report error
@@ -20619,11 +20619,11 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS
* @see CompileTimeErrorCode#RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS
*/
- bool checkForRecursiveInterfaceInheritance(ClassElement classElt) {
+ bool _checkForRecursiveInterfaceInheritance(ClassElement classElt) {
if (classElt == null) {
return false;
}
- return safeCheckForRecursiveInterfaceInheritance(classElt, new List<ClassElement>());
+ return _safeCheckForRecursiveInterfaceInheritance(classElt, new List<ClassElement>());
}
/**
@@ -20637,7 +20637,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS
* @see CompileTimeErrorCode#SUPER_IN_REDIRECTING_CONSTRUCTOR
*/
- bool checkForRedirectingConstructorErrorCodes(ConstructorDeclaration node) {
+ bool _checkForRedirectingConstructorErrorCodes(ConstructorDeclaration node) {
bool errorReported = false;
//
// Check for default values in the parameters
@@ -20687,7 +20687,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#REDIRECT_TO_NON_CONST_CONSTRUCTOR
*/
- bool checkForRedirectToNonConstConstructor(ConstructorDeclaration node) {
+ bool _checkForRedirectToNonConstConstructor(ConstructorDeclaration node) {
// prepare redirected constructor
ConstructorName redirectedConstructorNode = node.redirectedConstructor;
if (redirectedConstructorNode == null) {
@@ -20723,7 +20723,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#RETHROW_OUTSIDE_CATCH
*/
- bool checkForRethrowOutsideCatch(RethrowExpression node) {
+ bool _checkForRethrowOutsideCatch(RethrowExpression node) {
if (!_isInCatchClause) {
_errorReporter.reportErrorForNode(CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH, node, []);
return true;
@@ -20739,7 +20739,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#RETURN_IN_GENERATIVE_CONSTRUCTOR
*/
- bool checkForReturnInGenerativeConstructor(ConstructorDeclaration node) {
+ bool _checkForReturnInGenerativeConstructor(ConstructorDeclaration node) {
// ignore factory
if (node.factoryKeyword != null) {
return false;
@@ -20766,8 +20766,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticTypeWarningCode#RETURN_OF_INVALID_TYPE
*/
- bool checkForReturnOfInvalidType(Expression returnExpression, Type2 expectedReturnType) {
- Type2 staticReturnType = getStaticType(returnExpression);
+ bool _checkForReturnOfInvalidType(Expression returnExpression, Type2 expectedReturnType) {
+ Type2 staticReturnType = _getStaticType(returnExpression);
if (expectedReturnType.isVoid) {
if (staticReturnType.isVoid || staticReturnType.isDynamic || staticReturnType.isBottom) {
return false;
@@ -20800,7 +20800,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#STATIC_ACCESS_TO_INSTANCE_MEMBER
*/
- bool checkForStaticAccessToInstanceMember(ClassElement typeReference, SimpleIdentifier name) {
+ bool _checkForStaticAccessToInstanceMember(ClassElement typeReference, SimpleIdentifier name) {
// OK, target is not a type
if (typeReference == null) {
return false;
@@ -20828,10 +20828,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#SWITCH_EXPRESSION_NOT_ASSIGNABLE
*/
- bool checkForSwitchExpressionNotAssignable(SwitchStatement node) {
+ bool _checkForSwitchExpressionNotAssignable(SwitchStatement node) {
// prepare 'switch' expression type
Expression expression = node.expression;
- Type2 expressionType = getStaticType(expression);
+ Type2 expressionType = _getStaticType(expression);
if (expressionType == null) {
return false;
}
@@ -20844,7 +20844,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
SwitchCase switchCase = switchMember as SwitchCase;
// prepare 'case' type
Expression caseExpression = switchCase.expression;
- Type2 caseType = getStaticType(caseExpression);
+ Type2 caseType = _getStaticType(caseExpression);
// check types
if (expressionType.isAssignableTo(caseType)) {
return false;
@@ -20863,9 +20863,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#TYPE_ALIAS_CANNOT_REFERENCE_ITSELF
*/
- bool checkForTypeAliasCannotReferenceItself_function(FunctionTypeAlias node) {
+ bool _checkForTypeAliasCannotReferenceItself_function(FunctionTypeAlias node) {
FunctionTypeAliasElement element = node.element;
- if (!hasTypedefSelfReference(element)) {
+ if (!_hasTypedefSelfReference(element)) {
return false;
}
_errorReporter.reportErrorForNode(CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, node, []);
@@ -20878,9 +20878,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#TYPE_ALIAS_CANNOT_REFERENCE_ITSELF
*/
- bool checkForTypeAliasCannotReferenceItself_mixin(ClassTypeAlias node) {
+ bool _checkForTypeAliasCannotReferenceItself_mixin(ClassTypeAlias node) {
ClassElement element = node.element;
- if (!hasTypedefSelfReference(element)) {
+ if (!_hasTypedefSelfReference(element)) {
return false;
}
_errorReporter.reportErrorForNode(CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, node, []);
@@ -20894,7 +20894,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticTypeWarningCode#TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
*/
- bool checkForTypeArgumentNotMatchingBounds(TypeName node) {
+ bool _checkForTypeArgumentNotMatchingBounds(TypeName node) {
if (node.typeArguments == null) {
return false;
}
@@ -20946,7 +20946,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#TYPE_PARAMETER_REFERENCED_BY_STATIC
*/
- bool checkForTypeParameterReferencedByStatic(TypeName node) {
+ bool _checkForTypeParameterReferencedByStatic(TypeName node) {
if (_isInStaticMethod || _isInStaticVariableDeclaration) {
Type2 type = node.type;
if (type is TypeParameterType) {
@@ -20964,7 +20964,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticTypeWarningCode#TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND
*/
- bool checkForTypeParameterSupertypeOfItsBound(TypeParameter node) {
+ bool _checkForTypeParameterSupertypeOfItsBound(TypeParameter node) {
TypeParameterElement element = node.element;
// prepare bound
Type2 bound = element.bound;
@@ -20991,7 +20991,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#NON_GENERATIVE_CONSTRUCTOR
* @see StaticWarningCode#NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT
*/
- bool checkForUndefinedConstructorInInitializerImplicit(ConstructorDeclaration node) {
+ bool _checkForUndefinedConstructorInInitializerImplicit(ConstructorDeclaration node) {
//
// Ignore if the constructor is not generative.
//
@@ -21049,7 +21049,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticTypeWarningCode#UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER
*/
- bool checkForUnqualifiedReferenceToNonLocalStaticMember(SimpleIdentifier name) {
+ bool _checkForUnqualifiedReferenceToNonLocalStaticMember(SimpleIdentifier name) {
Element element = name.staticElement;
if (element == null || element is TypeParameterElement) {
return false;
@@ -21068,7 +21068,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
return true;
}
- void checkForValidField(FieldFormalParameter node) {
+ void _checkForValidField(FieldFormalParameter node) {
ParameterElement element = node.element;
if (element is FieldFormalParameterElement) {
FieldElement fieldElement = element.field;
@@ -21108,7 +21108,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
*/
- bool checkForWrongNumberOfParametersForOperator(MethodDeclaration node) {
+ bool _checkForWrongNumberOfParametersForOperator(MethodDeclaration node) {
// prepare number of parameters
FormalParameterList parameterList = node.parameters;
if (parameterList == null) {
@@ -21153,7 +21153,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER
*/
- bool checkForWrongNumberOfParametersForSetter(SimpleIdentifier setterName, FormalParameterList parameterList) {
+ bool _checkForWrongNumberOfParametersForSetter(SimpleIdentifier setterName, FormalParameterList parameterList) {
if (setterName == null) {
return false;
}
@@ -21175,7 +21175,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see StaticWarningCode#FUNCTION_WITHOUT_CALL
*/
- bool checkImplementsFunctionWithoutCall(ClassDeclaration node) {
+ bool _checkImplementsFunctionWithoutCall(ClassDeclaration node) {
if (node.abstractKeyword != null) {
return false;
}
@@ -21201,7 +21201,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#IMPLEMENTS_SUPER_CLASS
*/
- bool checkImplementsSuperClass(ClassDeclaration node) {
+ bool _checkImplementsSuperClass(ClassDeclaration node) {
// prepare super type
InterfaceType superType = _enclosingClass.supertype;
if (superType == null) {
@@ -21231,7 +21231,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @param type the type for which an extended display name is to be returned
* @return a display name that can help distiguish between two types with the same name
*/
- String getExtendedDisplayName(Type2 type) {
+ String _getExtendedDisplayName(Type2 type) {
Element element = type.element;
if (element != null) {
Source source = element.source;
@@ -21248,7 +21248,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @param propertyAccessorElement
* @return The type of the given getter.
*/
- Type2 getGetterType(PropertyAccessorElement propertyAccessorElement) {
+ Type2 _getGetterType(PropertyAccessorElement propertyAccessorElement) {
FunctionType functionType = propertyAccessorElement.type;
if (functionType != null) {
return functionType.returnType;
@@ -21263,7 +21263,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @param propertyAccessorElement
* @return The type of the given setter.
*/
- Type2 getSetterType(PropertyAccessorElement propertyAccessorElement) {
+ Type2 _getSetterType(PropertyAccessorElement propertyAccessorElement) {
// Get the parameters for MethodDeclaration or FunctionDeclaration
List<ParameterElement> setterParameters = propertyAccessorElement.parameters;
// If there are no setter parameters, return no type.
@@ -21279,7 +21279,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @param expression the expression whose type is to be returned
* @return the static type of the given expression
*/
- Type2 getStaticType(Expression expression) {
+ Type2 _getStaticType(Expression expression) {
Type2 type = expression.staticType;
if (type == null) {
// TODO(brianwilkerson) This should never happen.
@@ -21295,7 +21295,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @param expression the expression whose element is to be returned
* @return the variable element represented by the expression
*/
- VariableElement getVariableElement(Expression expression) {
+ VariableElement _getVariableElement(Expression expression) {
if (expression is Identifier) {
Element element = expression.staticElement;
if (element is VariableElement) {
@@ -21308,7 +21308,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
/**
* @return `true` if the given constructor redirects to itself, directly or indirectly
*/
- bool hasRedirectingFactoryConstructorCycle(ConstructorElement element) {
+ bool _hasRedirectingFactoryConstructorCycle(ConstructorElement element) {
Set<ConstructorElement> constructors = new Set<ConstructorElement>();
ConstructorElement current = element;
while (current != null) {
@@ -21328,7 +21328,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return <code>true</code> if given [Element] has direct or indirect reference to itself
* from anywhere except [ClassElement] or type parameter bounds.
*/
- bool hasTypedefSelfReference(Element target) {
+ bool _hasTypedefSelfReference(Element target) {
Set<Element> checked = new Set<Element>();
List<Element> toCheck = new List<Element>();
toCheck.add(target);
@@ -21365,7 +21365,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if given [Type] implements operator <i>==</i>, and it is not
* <i>int</i> or <i>String</i>.
*/
- bool implementsEqualsWhenNotAllowed(Type2 type) {
+ bool _implementsEqualsWhenNotAllowed(Type2 type) {
// ignore int or String
if (type == null || type == _intType || type == _typeProvider.stringType) {
return false;
@@ -21385,7 +21385,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
return true;
}
- bool isFunctionType(Type2 type) {
+ bool _isFunctionType(Type2 type) {
if (type.isDynamic || type.isBottom) {
return true;
} else if (type is FunctionType || type.isDartCoreFunction) {
@@ -21410,7 +21410,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @param classElt the class method to search through the members of
* @return `true` iff the passed member is found in the passed class element
*/
- bool isMemberInClassOrMixin(ExecutableElement executableElt, ClassElement classElt) {
+ bool _isMemberInClassOrMixin(ExecutableElement executableElt, ClassElement classElt) {
ExecutableElement foundElt;
String executableName = executableElt.name;
if (executableElt is MethodElement) {
@@ -21451,7 +21451,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @param node the 'this' expression to analyze
* @return `true` if the given 'this' expression is in the valid context
*/
- bool isThisInValidContext(ThisExpression node) {
+ bool _isThisInValidContext(ThisExpression node) {
for (AstNode n = node; n != null; n = n.parent) {
if (n is CompilationUnit) {
return false;
@@ -21479,7 +21479,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if the given identifier is in a location where it is allowed to resolve to
* a static member of a supertype
*/
- bool isUnqualifiedReferenceToNonLocalStaticMemberAllowed(SimpleIdentifier node) {
+ bool _isUnqualifiedReferenceToNonLocalStaticMemberAllowed(SimpleIdentifier node) {
if (node.inDeclarationContext()) {
return true;
}
@@ -21502,7 +21502,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
return false;
}
- bool isUserDefinedObject(EvaluationResultImpl result) => result == null || (result is ValidResult && result.isUserDefinedObject);
+ bool _isUserDefinedObject(EvaluationResultImpl result) => result == null || (result is ValidResult && result.isUserDefinedObject);
/**
* This checks the class declaration is not a superinterface to itself.
@@ -21514,7 +21514,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* @see CompileTimeErrorCode#RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS
* @see CompileTimeErrorCode#RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS
*/
- bool safeCheckForRecursiveInterfaceInheritance(ClassElement classElt, List<ClassElement> path) {
+ bool _safeCheckForRecursiveInterfaceInheritance(ClassElement classElt, List<ClassElement> path) {
// Detect error condition.
int size = path.length;
// If this is not the base case (size > 0), and the enclosing class is the passed class
@@ -21546,12 +21546,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
path.add(classElt);
// n-case
InterfaceType supertype = classElt.supertype;
- if (supertype != null && safeCheckForRecursiveInterfaceInheritance(supertype.element, path)) {
+ if (supertype != null && _safeCheckForRecursiveInterfaceInheritance(supertype.element, path)) {
return true;
}
List<InterfaceType> interfaceTypes = classElt.interfaces;
for (InterfaceType interfaceType in interfaceTypes) {
- if (safeCheckForRecursiveInterfaceInheritance(interfaceType.element, path)) {
+ if (_safeCheckForRecursiveInterfaceInheritance(interfaceType.element, path)) {
return true;
}
}
@@ -21593,9 +21593,9 @@ class GeneralizingElementVisitor_ErrorVerifier_hasTypedefSelfReference extends G
bool _inClass = false;
Object visitClassElement(ClassElement element) {
- addTypeToCheck(element.supertype);
+ _addTypeToCheck(element.supertype);
for (InterfaceType mixin in element.mixins) {
- addTypeToCheck(mixin);
+ _addTypeToCheck(mixin);
}
_inClass = !element.isTypedef;
try {
@@ -21609,31 +21609,31 @@ class GeneralizingElementVisitor_ErrorVerifier_hasTypedefSelfReference extends G
if (element.isSynthetic) {
return null;
}
- addTypeToCheck(element.returnType);
+ _addTypeToCheck(element.returnType);
return super.visitExecutableElement(element);
}
Object visitFunctionTypeAliasElement(FunctionTypeAliasElement element) {
- addTypeToCheck(element.returnType);
+ _addTypeToCheck(element.returnType);
return super.visitFunctionTypeAliasElement(element);
}
Object visitParameterElement(ParameterElement element) {
- addTypeToCheck(element.type);
+ _addTypeToCheck(element.type);
return super.visitParameterElement(element);
}
Object visitTypeParameterElement(TypeParameterElement element) {
- addTypeToCheck(element.bound);
+ _addTypeToCheck(element.bound);
return super.visitTypeParameterElement(element);
}
Object visitVariableElement(VariableElement element) {
- addTypeToCheck(element.type);
+ _addTypeToCheck(element.type);
return super.visitVariableElement(element);
}
- void addTypeToCheck(Type2 type) {
+ void _addTypeToCheck(Type2 type) {
if (type == null) {
return;
}
@@ -21648,7 +21648,7 @@ class GeneralizingElementVisitor_ErrorVerifier_hasTypedefSelfReference extends G
if (type is InterfaceType) {
InterfaceType interfaceType = type;
for (Type2 typeArgument in interfaceType.typeArguments) {
- addTypeToCheck(typeArgument);
+ _addTypeToCheck(typeArgument);
}
}
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | pkg/analyzer/lib/src/generated/scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698