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

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

Issue 754673002: Matching of top-level functions, methods and accessors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « no previous file | pkg/analyzer/test/generated/incremental_resolver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/incremental_resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/incremental_resolver.dart b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
index cb315f54e8ca6e8560f169c8f5d2a22814d5a7f7..68d71fcb5f25d844d47922fc62ec3c259c30c3db 100644
--- a/pkg/analyzer/lib/src/generated/incremental_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
@@ -200,23 +200,22 @@ class DeclarationMatcher extends RecursiveAstVisitor {
@override
visitFunctionDeclaration(FunctionDeclaration node) {
+ // prepare element name
String name = node.name.name;
+ if (node.isSetter) {
+ name += '=';
+ }
+ // prepare element
Token property = node.propertyKeyword;
ExecutableElement element;
if (property == null) {
element = _findElement(_enclosingUnit.functions, name);
- _processElement(element);
} else {
- PropertyAccessorElement accessor =
- _findElement(_enclosingUnit.accessors, name);
- _assertNotNull(accessor);
- _assertFalse(element.isSynthetic);
- _assertEquals(node.isGetter, accessor.isGetter);
- _assertEquals(node.isSetter, accessor.isSetter);
- element = accessor;
+ element = _findElement(_enclosingUnit.accessors, name);
}
+ // process element
_processElement(element);
- // TODO(scheglov) test returnType
+ _assertFalse(element.isSynthetic);
_assertSameType(node.returnType, element.returnType);
_assertCompatibleParameters(
node.functionExpression.parameters,
@@ -279,17 +278,12 @@ class DeclarationMatcher extends RecursiveAstVisitor {
if (property == null) {
element = _findElement(_enclosingClass.methods, name);
} else {
- PropertyAccessorElement accessor =
- _findElement(_enclosingClass.accessors, name);
- _assertNotNull(accessor);
- _assertFalse(element.isSynthetic);
- _assertEquals(node.isGetter, accessor.isGetter);
- _assertEquals(node.isSetter, accessor.isSetter);
- element = accessor;
+ element = _findElement(_enclosingClass.accessors, name);
}
// process element
_processElement(element);
- // TODO(scheglov) test returnType
+ _assertFalse(element.isSynthetic);
+ _assertEquals(node.isStatic, element.isStatic);
_assertSameType(node.returnType, element.returnType);
_assertCompatibleParameters(node.parameters, element.parameters);
}
@@ -401,6 +395,9 @@ class DeclarationMatcher extends RecursiveAstVisitor {
void _assertCompatibleParameters(FormalParameterList nodes,
List<ParameterElement> elements) {
+ if (nodes == null) {
+ return _assertEquals(elements.length, 0);
+ }
List<FormalParameter> parameters = nodes.parameters;
int length = parameters.length;
_assertEquals(length, elements.length);
@@ -507,7 +504,7 @@ class DeclarationMatcher extends RecursiveAstVisitor {
*/
Element _findElement(List<Element> elements, String name) {
for (Element element in elements) {
- if (element.displayName == name) {
+ if (element.name == name) {
return element;
}
}
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/incremental_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698