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

Side by Side Diff: compiler/java/com/google/dart/compiler/resolver/Resolver.java

Issue 10918260: Issue 5044. Keep FieldElement as Element for field 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 package com.google.dart.compiler.resolver; 5 package com.google.dart.compiler.resolver;
6 6
7 import com.google.common.annotations.VisibleForTesting; 7 import com.google.common.annotations.VisibleForTesting;
8 import com.google.common.collect.Lists; 8 import com.google.common.collect.Lists;
9 import com.google.common.collect.Sets; 9 import com.google.common.collect.Sets;
10 import com.google.dart.compiler.DartCompilationPhase; 10 import com.google.dart.compiler.DartCompilationPhase;
11 import com.google.dart.compiler.DartCompilerContext; 11 import com.google.dart.compiler.DartCompilerContext;
12 import com.google.dart.compiler.ErrorCode; 12 import com.google.dart.compiler.ErrorCode;
13 import com.google.dart.compiler.ast.ASTNodes;
13 import com.google.dart.compiler.ast.ASTVisitor; 14 import com.google.dart.compiler.ast.ASTVisitor;
14 import com.google.dart.compiler.ast.DartArrayLiteral; 15 import com.google.dart.compiler.ast.DartArrayLiteral;
15 import com.google.dart.compiler.ast.DartBinaryExpression; 16 import com.google.dart.compiler.ast.DartBinaryExpression;
16 import com.google.dart.compiler.ast.DartBlock; 17 import com.google.dart.compiler.ast.DartBlock;
17 import com.google.dart.compiler.ast.DartBooleanLiteral; 18 import com.google.dart.compiler.ast.DartBooleanLiteral;
18 import com.google.dart.compiler.ast.DartBreakStatement; 19 import com.google.dart.compiler.ast.DartBreakStatement;
19 import com.google.dart.compiler.ast.DartCatchBlock; 20 import com.google.dart.compiler.ast.DartCatchBlock;
20 import com.google.dart.compiler.ast.DartClass; 21 import com.google.dart.compiler.ast.DartClass;
21 import com.google.dart.compiler.ast.DartClassMember; 22 import com.google.dart.compiler.ast.DartClassMember;
22 import com.google.dart.compiler.ast.DartContinueStatement; 23 import com.google.dart.compiler.ast.DartContinueStatement;
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 return null; 1269 return null;
1269 } 1270 }
1270 switch (ElementKind.of(element)) { 1271 switch (ElementKind.of(element)) {
1271 case FIELD: 1272 case FIELD:
1272 FieldElement field = (FieldElement) element; 1273 FieldElement field = (FieldElement) element;
1273 x.setType(field.getType()); 1274 x.setType(field.getType());
1274 if (!field.getModifiers().isStatic()) { 1275 if (!field.getModifiers().isStatic()) {
1275 onError(x.getName(), ResolverErrorCode.NOT_A_STATIC_FIELD, 1276 onError(x.getName(), ResolverErrorCode.NOT_A_STATIC_FIELD,
1276 x.getPropertyName()); 1277 x.getPropertyName());
1277 } 1278 }
1278 if (Elements.inSetterContext(x)) { 1279 if (ASTNodes.inSetterContext(x)) {
1279 if (field.getGetter() != null) { 1280 if (field.getGetter() != null) {
1280 element = field.getSetter(); 1281 if (field.getSetter() == null) {
1281 if (element == null) {
1282 onError(x.getName(), ResolverErrorCode.FIELD_DOES_NOT_HAVE_A _SETTER); 1282 onError(x.getName(), ResolverErrorCode.FIELD_DOES_NOT_HAVE_A _SETTER);
1283 } 1283 }
1284 } 1284 }
1285 } 1285 }
1286 if (Elements.inGetterContext(x)) { 1286 if (ASTNodes.inGetterContext(x)) {
1287 if (field.getSetter() != null) { 1287 if (field.getSetter() != null) {
1288 element = field.getGetter(); 1288 if (field.getGetter() == null) {
1289 if (element == null) {
1290 onError(x.getName(), ResolverErrorCode.FIELD_DOES_NOT_HAVE_A _GETTER); 1289 onError(x.getName(), ResolverErrorCode.FIELD_DOES_NOT_HAVE_A _GETTER);
1291 } 1290 }
1292 } 1291 }
1293 } 1292 }
1294 break; 1293 break;
1295 1294
1296 case NONE: 1295 case NONE:
1297 onError(x.getName(), TypeErrorCode.CANNOT_BE_RESOLVED, 1296 onError(x.getName(), TypeErrorCode.CANNOT_BE_RESOLVED,
1298 x.getPropertyName()); 1297 x.getPropertyName());
1299 break; 1298 break;
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 ClassElement currentClass = (ClassElement) constructor.getEnclosingEle ment(); 2321 ClassElement currentClass = (ClassElement) constructor.getEnclosingEle ment();
2323 if (nextClass == currentClass) { 2322 if (nextClass == currentClass) {
2324 return (ConstructorNodeElement) nextConstructorElement; 2323 return (ConstructorNodeElement) nextConstructorElement;
2325 } 2324 }
2326 } 2325 }
2327 } 2326 }
2328 } 2327 }
2329 return null; 2328 return null;
2330 } 2329 }
2331 } 2330 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698