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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/Expression.java

Issue 15736017: Issue 1015. Report problem for incompatible right operand and index types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/Expression.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/Expression.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/Expression.java
index 18c290dfca6596e1f7e89147a87b780b40021174..904e9552fa7b6821d66a97759cb2472985444af0 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/Expression.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/Expression.java
@@ -55,8 +55,20 @@ public abstract class Expression extends ASTNode {
if (parent instanceof ArgumentList) {
return ((ArgumentList) parent).getParameterElementFor(this);
}
- // TODO(brianwilkerson) Consider implementing this method for children of BinaryExpression,
- // IndexExpression, PrefixExpression, and PostfixExpression.
+ if (parent instanceof IndexExpression) {
+ IndexExpression indexExpression = (IndexExpression) parent;
+ if (indexExpression.getIndex() == this) {
+ return indexExpression.getParameterElementForIndex();
+ }
+ }
+ if (parent instanceof BinaryExpression) {
+ BinaryExpression binaryExpression = (BinaryExpression) parent;
+ if (binaryExpression.getRightOperand() == this) {
+ return binaryExpression.getParameterElementForRightOperand();
+ }
+ }
+ // TODO(brianwilkerson) Consider implementing this method for children of PrefixExpression
+ // and PostfixExpression.
return null;
}

Powered by Google App Engine
This is Rietveld 408576698