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

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

Issue 1062723002: Implement the new '?.' operator in analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Bump analyzer version. Created 5 years, 8 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
Index: pkg/analyzer/lib/src/generated/error_verifier.dart
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 4a0fae048a9b5d52d369dce498b39be98cead620..0ed89234d0e01b379258ca9c79ddda0e9057bcc9 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -864,7 +864,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
Expression target = node.realTarget;
SimpleIdentifier methodName = node.methodName;
if (target != null) {
- ClassElement typeReference = ElementResolver.getTypeReference(target);
+ bool isConditional = node.operator.type == sc.TokenType.QUESTION_PERIOD;
+ ClassElement typeReference =
+ ElementResolver.getTypeReference(target, isConditional);
_checkForStaticAccessToInstanceMember(typeReference, methodName);
_checkForInstanceAccessToStaticMember(typeReference, methodName);
} else {
@@ -901,7 +903,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
Object visitPrefixedIdentifier(PrefixedIdentifier node) {
if (node.parent is! Annotation) {
ClassElement typeReference =
- ElementResolver.getTypeReference(node.prefix);
+ ElementResolver.getTypeReference(node.prefix, false);
SimpleIdentifier name = node.identifier;
_checkForStaticAccessToInstanceMember(typeReference, name);
_checkForInstanceAccessToStaticMember(typeReference, name);
@@ -924,8 +926,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
@override
Object visitPropertyAccess(PropertyAccess node) {
+ bool isConditional = node.operator.type == sc.TokenType.QUESTION_PERIOD;
ClassElement typeReference =
- ElementResolver.getTypeReference(node.realTarget);
+ ElementResolver.getTypeReference(node.realTarget, isConditional);
SimpleIdentifier propertyName = node.propertyName;
_checkForStaticAccessToInstanceMember(typeReference, propertyName);
_checkForInstanceAccessToStaticMember(typeReference, propertyName);

Powered by Google App Engine
This is Rietveld 408576698