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

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ResolverVisitor.java

Issue 59073003: Version 0.8.10.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 /* 1 /*
2 * Copyright (c) 2013, the Dart project authors. 2 * Copyright (c) 2013, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 import com.google.dart.engine.element.ExecutableElement; 75 import com.google.dart.engine.element.ExecutableElement;
76 import com.google.dart.engine.element.LibraryElement; 76 import com.google.dart.engine.element.LibraryElement;
77 import com.google.dart.engine.element.LocalVariableElement; 77 import com.google.dart.engine.element.LocalVariableElement;
78 import com.google.dart.engine.element.ParameterElement; 78 import com.google.dart.engine.element.ParameterElement;
79 import com.google.dart.engine.element.PropertyInducingElement; 79 import com.google.dart.engine.element.PropertyInducingElement;
80 import com.google.dart.engine.element.VariableElement; 80 import com.google.dart.engine.element.VariableElement;
81 import com.google.dart.engine.error.AnalysisError; 81 import com.google.dart.engine.error.AnalysisError;
82 import com.google.dart.engine.error.AnalysisErrorListener; 82 import com.google.dart.engine.error.AnalysisErrorListener;
83 import com.google.dart.engine.error.ErrorCode; 83 import com.google.dart.engine.error.ErrorCode;
84 import com.google.dart.engine.internal.element.VariableElementImpl; 84 import com.google.dart.engine.internal.element.VariableElementImpl;
85 import com.google.dart.engine.internal.scope.Scope;
85 import com.google.dart.engine.scanner.Token; 86 import com.google.dart.engine.scanner.Token;
86 import com.google.dart.engine.scanner.TokenType; 87 import com.google.dart.engine.scanner.TokenType;
87 import com.google.dart.engine.source.Source; 88 import com.google.dart.engine.source.Source;
88 import com.google.dart.engine.type.FunctionType; 89 import com.google.dart.engine.type.FunctionType;
89 import com.google.dart.engine.type.InterfaceType; 90 import com.google.dart.engine.type.InterfaceType;
90 import com.google.dart.engine.type.Type; 91 import com.google.dart.engine.type.Type;
91 92
92 import java.util.ArrayList; 93 import java.util.ArrayList;
93 import java.util.HashMap; 94 import java.util.HashMap;
94 95
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 */ 168 */
168 public ResolverVisitor(LibraryElement definingLibrary, Source source, TypeProv ider typeProvider, 169 public ResolverVisitor(LibraryElement definingLibrary, Source source, TypeProv ider typeProvider,
169 InheritanceManager inheritanceManager, AnalysisErrorListener errorListener ) { 170 InheritanceManager inheritanceManager, AnalysisErrorListener errorListener ) {
170 super(definingLibrary, source, typeProvider, errorListener); 171 super(definingLibrary, source, typeProvider, errorListener);
171 this.inheritanceManager = inheritanceManager; 172 this.inheritanceManager = inheritanceManager;
172 this.elementResolver = new ElementResolver(this); 173 this.elementResolver = new ElementResolver(this);
173 this.typeAnalyzer = new StaticTypeAnalyzer(this); 174 this.typeAnalyzer = new StaticTypeAnalyzer(this);
174 } 175 }
175 176
176 /** 177 /**
178 * Initialize a newly created visitor to resolve the nodes in an AST node.
179 *
180 * @param definingLibrary the element for the library containing the node bein g visited
181 * @param source the source representing the compilation unit containing the n ode being visited
182 * @param typeProvider the object used to access the types from the core libra ry
183 * @param nameScope the scope used to resolve identifiers in the node that wil l first be visited
184 * @param errorListener the error listener that will be informed of any errors that are found
185 * during resolution
186 */
187 public ResolverVisitor(LibraryElement definingLibrary, Source source, TypeProv ider typeProvider,
188 Scope nameScope, AnalysisErrorListener errorListener) {
189 super(definingLibrary, source, typeProvider, nameScope, errorListener);
190 this.inheritanceManager = new InheritanceManager(definingLibrary);
191 this.elementResolver = new ElementResolver(this);
192 this.typeAnalyzer = new StaticTypeAnalyzer(this);
193 }
194
195 /**
177 * Return the object keeping track of which elements have had their types over ridden. 196 * Return the object keeping track of which elements have had their types over ridden.
178 * 197 *
179 * @return the object keeping track of which elements have had their types ove rridden 198 * @return the object keeping track of which elements have had their types ove rridden
180 */ 199 */
181 public TypeOverrideManager getOverrideManager() { 200 public TypeOverrideManager getOverrideManager() {
182 return overrideManager; 201 return overrideManager;
183 } 202 }
184 203
185 /** 204 /**
186 * Return the object keeping track of which elements have had their types prom oted. 205 * Return the object keeping track of which elements have had their types prom oted.
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 } 850 }
832 851
833 /** 852 /**
834 * Return the static element associated with the given expression whose type c an be promoted, or 853 * Return the static element associated with the given expression whose type c an be promoted, or
835 * {@code null} if there is no element whose type can be promoted. 854 * {@code null} if there is no element whose type can be promoted.
836 * 855 *
837 * @param expression the expression with which the element is associated 856 * @param expression the expression with which the element is associated
838 * @return the element associated with the given expression 857 * @return the element associated with the given expression
839 */ 858 */
840 protected VariableElement getPromotionStaticElement(Expression expression) { 859 protected VariableElement getPromotionStaticElement(Expression expression) {
860 while (expression instanceof ParenthesizedExpression) {
861 expression = ((ParenthesizedExpression) expression).getExpression();
862 }
841 if (!(expression instanceof SimpleIdentifier)) { 863 if (!(expression instanceof SimpleIdentifier)) {
842 return null; 864 return null;
843 } 865 }
844 SimpleIdentifier identifier = (SimpleIdentifier) expression; 866 SimpleIdentifier identifier = (SimpleIdentifier) expression;
845 Element element = identifier.getStaticElement(); 867 Element element = identifier.getStaticElement();
846 if (!(element instanceof VariableElement)) { 868 if (!(element instanceof VariableElement)) {
847 return null; 869 return null;
848 } 870 }
849 ElementKind kind = element.getKind(); 871 ElementKind kind = element.getKind();
850 if (kind == ElementKind.LOCAL_VARIABLE) { 872 if (kind == ElementKind.LOCAL_VARIABLE) {
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 * 1395 *
1374 * @param expression the node whose type is to be recorded 1396 * @param expression the node whose type is to be recorded
1375 * @param type the propagated type of the node 1397 * @param type the propagated type of the node
1376 */ 1398 */
1377 private void recordPropagatedType(Expression expression, Type type) { 1399 private void recordPropagatedType(Expression expression, Type type) {
1378 if (type != null && !type.isDynamic()) { 1400 if (type != null && !type.isDynamic()) {
1379 expression.setPropagatedType(type); 1401 expression.setPropagatedType(type);
1380 } 1402 }
1381 } 1403 }
1382 } 1404 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698