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

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

Issue 10627020: Fix for issue 2437 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 if (!element.getModifiers().isStatic() && !Elements.isTopLevel(element)) { 1029 if (!element.getModifiers().isStatic() && !Elements.isTopLevel(element)) {
1030 onError(x, ResolverErrorCode.CANNOT_ACCESS_FIELD_IN_INIT); 1030 onError(x, ResolverErrorCode.CANNOT_ACCESS_FIELD_IN_INIT);
1031 } 1031 }
1032 } 1032 }
1033 1033
1034 // May be local variable declared in lexical scope, but its declaration is not visited yet. 1034 // May be local variable declared in lexical scope, but its declaration is not visited yet.
1035 if (getContext().getScope().isDeclaredButNotReachedVariable(name)) { 1035 if (getContext().getScope().isDeclaredButNotReachedVariable(name)) {
1036 onError(x, ResolverErrorCode.USING_LOCAL_VARIABLE_BEFORE_DECLARATION, x) ; 1036 onError(x, ResolverErrorCode.USING_LOCAL_VARIABLE_BEFORE_DECLARATION, x) ;
1037 } 1037 }
1038 1038
1039 if (!isQualifier) {
1040 switch (ElementKind.of(element)) {
1041 case CLASS:
1042 case FUNCTION_TYPE_ALIAS:
1043 onError(x, ResolverErrorCode.CANNOT_USE_TYPE, name);
1044 break;
1045 case TYPE_VARIABLE:
1046 onError(x, ResolverErrorCode.CANNOT_USE_TYPE_VARIABLE, name);
1047 break;
1048 }
1049 }
1050
1039 // If we we haven't resolved the identifier, it will be normalized to 1051 // If we we haven't resolved the identifier, it will be normalized to
1040 // this.<identifier>. 1052 // this.<identifier>.
1041 1053
1042 return recordElement(x, element); 1054 return recordElement(x, element);
1043 } 1055 }
1044 1056
1045 /** 1057 /**
1046 * Possibly recursive check on the resolved identifier. 1058 * Possibly recursive check on the resolved identifier.
1047 */ 1059 */
1048 private Element checkResolvedIdentifier(DartIdentifier x, boolean isQualifie r, Scope scope, 1060 private Element checkResolvedIdentifier(DartIdentifier x, boolean isQualifie r, Scope scope,
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 ClassElement nextClass = (ClassElement) nextConstructorElement.getEnclos ingElement(); 2081 ClassElement nextClass = (ClassElement) nextConstructorElement.getEnclos ingElement();
2070 ClassElement currentClass = (ClassElement) constructor.getEnclosingEleme nt(); 2082 ClassElement currentClass = (ClassElement) constructor.getEnclosingEleme nt();
2071 if (nextClass == currentClass) { 2083 if (nextClass == currentClass) {
2072 return (ConstructorNodeElement) nextConstructorElement; 2084 return (ConstructorNodeElement) nextConstructorElement;
2073 } 2085 }
2074 } 2086 }
2075 } 2087 }
2076 return null; 2088 return null;
2077 } 2089 }
2078 } 2090 }
OLDNEW
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698