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

Unified Diff: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java

Issue 10914215: Issue 5049. Consistently resolve instance/static/top-level property access (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
diff --git a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
index 916f5e1b70b776826ded1a8a2889dba0a1a36224..3cea2c72f7297720a13680ee80dde5e8777f9397 100644
--- a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
+++ b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
@@ -1358,12 +1358,11 @@ public class TypeAnalyzer implements DartCompilationPhase {
DartExpression argKey = node.getKey();
// t[k] = v
if (node.getParent() instanceof DartBinaryExpression) {
- DartBinaryExpression binaryExpression = (DartBinaryExpression) node.getParent();
- if (binaryExpression.getArg1() == node
- && binaryExpression.getOperator() == Token.ASSIGN) {
- DartExpression argValue = binaryExpression.getArg2();
+ DartBinaryExpression binary = (DartBinaryExpression) node.getParent();
+ if (binary.getArg1() == node && binary.getOperator() == Token.ASSIGN) {
+ DartExpression argValue = binary.getArg2();
analyzeTernaryOperator(node, target, Token.ASSIGN_INDEX, node, argKey, argValue);
- binaryExpression.setElement(node.getElement());
+ binary.setElement(node.getElement());
return argValue.getType();
}
}
@@ -1826,6 +1825,7 @@ public class TypeAnalyzer implements DartCompilationPhase {
if (setter != null) {
if (setter.getParameters().size() > 0) {
node.setElement(setter);
+ node.getParent().setElement(setter);
type = setter.getParameters().get(0).getType();
node.setType(type);
}
@@ -2322,6 +2322,17 @@ public class TypeAnalyzer implements DartCompilationPhase {
// Check for cases when property has no setter or getter.
if (fieldModifiers.isAbstractField() && enclosingClass != null) {
+ // Check for using field without setter in some assignment variant.
+ if (inSetterContext) {
+ if (setter == null) {
+ setter = Elements.lookupFieldElementSetter(enclosingClass, name);
+ if (setter == null) {
+ return typeError(node.getName(), TypeErrorCode.FIELD_HAS_NO_SETTER, node.getName());
+ }
+ }
+ node.setElement(setter);
+ node.getParent().setElement(setter);
+ }
// Check for using field without getter in other operation that assignment.
if (inGetterContext) {
if (getter == null) {
@@ -2332,16 +2343,6 @@ public class TypeAnalyzer implements DartCompilationPhase {
}
node.setElement(getter);
}
- // Check for using field without setter in some assignment variant.
- if (inSetterContext) {
- if (setter == null) {
- setter = Elements.lookupFieldElementSetter(enclosingClass, name);
- if (setter == null) {
- return typeError(node.getName(), TypeErrorCode.FIELD_HAS_NO_SETTER, node.getName());
- }
- }
- node.setElement(setter);
- }
}
Type result = member.getType();

Powered by Google App Engine
This is Rietveld 408576698