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

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

Issue 10949015: Issue 5052. Analyzer should treat assert as a keyword (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;
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 return recordElement(x, element); 1482 return recordElement(x, element);
1483 } 1483 }
1484 1484
1485 @Override 1485 @Override
1486 public Element visitUnqualifiedInvocation(DartUnqualifiedInvocation x) { 1486 public Element visitUnqualifiedInvocation(DartUnqualifiedInvocation x) {
1487 Scope scope = getContext().getScope(); 1487 Scope scope = getContext().getScope();
1488 Element element = scope.findElement(scope.getLibrary(), x.getTarget().getN ame()); 1488 Element element = scope.findElement(scope.getLibrary(), x.getTarget().getN ame());
1489 if (element == null) { 1489 if (element == null) {
1490 element = scope.findElement(scope.getLibrary(), "setter " + x.getTarget( ).getName()); 1490 element = scope.findElement(scope.getLibrary(), "setter " + x.getTarget( ).getName());
1491 } 1491 }
1492 if (element == null && x.getTarget().getName().equals("assert")
1493 && x.getArguments().size() == 1) {
1494 element = scope.findElement(scope.getLibrary(), Elements.ASSERT_FUNCTION _NAME);
1495 }
1496 ElementKind kind = ElementKind.of(element); 1492 ElementKind kind = ElementKind.of(element);
1497 if (!INVOKABLE_ELEMENTS.contains(kind)) { 1493 if (!INVOKABLE_ELEMENTS.contains(kind)) {
1498 diagnoseErrorInUnqualifiedInvocation(x); 1494 diagnoseErrorInUnqualifiedInvocation(x);
1499 } else { 1495 } else {
1500 checkInvocationTarget(x, currentMethod, element); 1496 checkInvocationTarget(x, currentMethod, element);
1501 } 1497 }
1502 if (Elements.isAbstractFieldWithoutGetter(element)) { 1498 if (Elements.isAbstractFieldWithoutGetter(element)) {
1503 String name = element.getName(); 1499 String name = element.getName();
1504 if (isStaticContextOrInitializer()) { 1500 if (isStaticContextOrInitializer()) {
1505 onError(x.getTarget(), ResolverErrorCode.USE_ASSIGNMENT_ON_SETTER, nam e); 1501 onError(x.getTarget(), ResolverErrorCode.USE_ASSIGNMENT_ON_SETTER, nam e);
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 ClassElement currentClass = (ClassElement) constructor.getEnclosingEle ment(); 2332 ClassElement currentClass = (ClassElement) constructor.getEnclosingEle ment();
2337 if (nextClass == currentClass) { 2333 if (nextClass == currentClass) {
2338 return (ConstructorNodeElement) nextConstructorElement; 2334 return (ConstructorNodeElement) nextConstructorElement;
2339 } 2335 }
2340 } 2336 }
2341 } 2337 }
2342 } 2338 }
2343 return null; 2339 return null;
2344 } 2340 }
2345 } 2341 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698