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

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

Issue 10338004: Change resolution of fields to resolve to getters and setters (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
===================================================================
--- compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java (revision 7239)
+++ compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java (working copy)
@@ -1378,16 +1378,24 @@
// Check for cases when property has no setter or getter.
if (fieldElement.getModifiers().isAbstractField() && enclosingClass != null) {
// Check for using field without getter in other operation that assignment.
- if (inGetterContext && getter == null
- && Elements.lookupFieldElementGetter(enclosingClass, name) == null) {
- return typeError(node.getName(), TypeErrorCode.FIELD_HAS_NO_GETTER, node.getName());
+ if (inGetterContext) {
+ if (getter == null) {
+ getter = Elements.lookupFieldElementGetter(enclosingClass, name);
+ if (getter == null) {
+ return typeError(node.getName(), TypeErrorCode.FIELD_HAS_NO_GETTER, node.getName());
+ }
+ }
+ node.setElement(getter);
}
// Check for using field without setter in some assignment variant.
- if (inSetterContext && setter == null
- && Elements.lookupFieldElementSetter(enclosingClass, name) == null) {
- return typeError(node.getName(),
- TypeErrorCode.FIELD_HAS_NO_SETTER,
- node.getName());
+ 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);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698