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

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

Issue 10837237: Issue 4383. Calling field without setter should generate problem (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use same text for error as for warning Created 8 years, 4 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;
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 @Override 1386 @Override
1387 public Element visitUnqualifiedInvocation(DartUnqualifiedInvocation x) { 1387 public Element visitUnqualifiedInvocation(DartUnqualifiedInvocation x) {
1388 Scope scope = getContext().getScope(); 1388 Scope scope = getContext().getScope();
1389 Element element = scope.findElement(scope.getLibrary(), x.getTarget().getN ame()); 1389 Element element = scope.findElement(scope.getLibrary(), x.getTarget().getN ame());
1390 ElementKind kind = ElementKind.of(element); 1390 ElementKind kind = ElementKind.of(element);
1391 if (!INVOKABLE_ELEMENTS.contains(kind)) { 1391 if (!INVOKABLE_ELEMENTS.contains(kind)) {
1392 diagnoseErrorInUnqualifiedInvocation(x); 1392 diagnoseErrorInUnqualifiedInvocation(x);
1393 } else { 1393 } else {
1394 checkInvocationTarget(x, currentMethod, element); 1394 checkInvocationTarget(x, currentMethod, element);
1395 } 1395 }
1396 if (Elements.isAbstractFieldWithoutGetter(element)) {
1397 String name = element.getName();
1398 if (isStaticContextOrInitializer()) {
1399 onError(x.getTarget(), ResolverErrorCode.USE_ASSIGNMENT_ON_SETTER, nam e);
1400 } else {
1401 onError(x.getTarget(), TypeErrorCode.USE_ASSIGNMENT_ON_SETTER, name);
1402 }
1403 }
1396 recordElement(x, element); 1404 recordElement(x, element);
1397 recordElement(x.getTarget(), element); 1405 recordElement(x.getTarget(), element);
1398 visit(x.getArguments()); 1406 visit(x.getArguments());
1399 return null; 1407 return null;
1400 } 1408 }
1401 1409
1402 @Override 1410 @Override
1403 public Element visitFunctionObjectInvocation(DartFunctionObjectInvocation x) { 1411 public Element visitFunctionObjectInvocation(DartFunctionObjectInvocation x) {
1404 x.getTarget().accept(this); 1412 x.getTarget().accept(this);
1405 visit(x.getArguments()); 1413 visit(x.getArguments());
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 ClassElement currentClass = (ClassElement) constructor.getEnclosingEle ment(); 2217 ClassElement currentClass = (ClassElement) constructor.getEnclosingEle ment();
2210 if (nextClass == currentClass) { 2218 if (nextClass == currentClass) {
2211 return (ConstructorNodeElement) nextConstructorElement; 2219 return (ConstructorNodeElement) nextConstructorElement;
2212 } 2220 }
2213 } 2221 }
2214 } 2222 }
2215 } 2223 }
2216 return null; 2224 return null;
2217 } 2225 }
2218 } 2226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698