OLD | NEW |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 import com.google.dart.engine.error.StaticTypeWarningCode; | 62 import com.google.dart.engine.error.StaticTypeWarningCode; |
63 import com.google.dart.engine.error.StaticWarningCode; | 63 import com.google.dart.engine.error.StaticWarningCode; |
64 import com.google.dart.engine.internal.element.ClassElementImpl; | 64 import com.google.dart.engine.internal.element.ClassElementImpl; |
65 import com.google.dart.engine.internal.element.ExecutableElementImpl; | 65 import com.google.dart.engine.internal.element.ExecutableElementImpl; |
66 import com.google.dart.engine.internal.element.FunctionTypeAliasElementImpl; | 66 import com.google.dart.engine.internal.element.FunctionTypeAliasElementImpl; |
67 import com.google.dart.engine.internal.element.LocalVariableElementImpl; | 67 import com.google.dart.engine.internal.element.LocalVariableElementImpl; |
68 import com.google.dart.engine.internal.element.ParameterElementImpl; | 68 import com.google.dart.engine.internal.element.ParameterElementImpl; |
69 import com.google.dart.engine.internal.element.PropertyAccessorElementImpl; | 69 import com.google.dart.engine.internal.element.PropertyAccessorElementImpl; |
70 import com.google.dart.engine.internal.element.PropertyInducingElementImpl; | 70 import com.google.dart.engine.internal.element.PropertyInducingElementImpl; |
71 import com.google.dart.engine.internal.element.VariableElementImpl; | 71 import com.google.dart.engine.internal.element.VariableElementImpl; |
| 72 import com.google.dart.engine.internal.scope.Scope; |
72 import com.google.dart.engine.internal.type.DynamicTypeImpl; | 73 import com.google.dart.engine.internal.type.DynamicTypeImpl; |
73 import com.google.dart.engine.internal.type.FunctionTypeImpl; | 74 import com.google.dart.engine.internal.type.FunctionTypeImpl; |
74 import com.google.dart.engine.internal.type.InterfaceTypeImpl; | 75 import com.google.dart.engine.internal.type.InterfaceTypeImpl; |
75 import com.google.dart.engine.internal.type.TypeImpl; | 76 import com.google.dart.engine.internal.type.TypeImpl; |
76 import com.google.dart.engine.internal.type.VoidTypeImpl; | 77 import com.google.dart.engine.internal.type.VoidTypeImpl; |
77 import com.google.dart.engine.scanner.Keyword; | 78 import com.google.dart.engine.scanner.Keyword; |
78 import com.google.dart.engine.scanner.Token; | 79 import com.google.dart.engine.scanner.Token; |
79 import com.google.dart.engine.scanner.TokenType; | 80 import com.google.dart.engine.scanner.TokenType; |
80 import com.google.dart.engine.source.Source; | 81 import com.google.dart.engine.source.Source; |
81 import com.google.dart.engine.type.FunctionType; | 82 import com.google.dart.engine.type.FunctionType; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 * @param typeProvider the object used to access the types from the core libra
ry | 158 * @param typeProvider the object used to access the types from the core libra
ry |
158 * @param errorListener the error listener that will be informed of any errors
that are found | 159 * @param errorListener the error listener that will be informed of any errors
that are found |
159 * during resolution | 160 * during resolution |
160 */ | 161 */ |
161 public TypeResolverVisitor(LibraryElement definingLibrary, Source source, | 162 public TypeResolverVisitor(LibraryElement definingLibrary, Source source, |
162 TypeProvider typeProvider, AnalysisErrorListener errorListener) { | 163 TypeProvider typeProvider, AnalysisErrorListener errorListener) { |
163 super(definingLibrary, source, typeProvider, errorListener); | 164 super(definingLibrary, source, typeProvider, errorListener); |
164 dynamicType = typeProvider.getDynamicType(); | 165 dynamicType = typeProvider.getDynamicType(); |
165 } | 166 } |
166 | 167 |
| 168 /** |
| 169 * Initialize a newly created visitor to resolve the nodes in an AST node. |
| 170 * |
| 171 * @param definingLibrary the element for the library containing the node bein
g visited |
| 172 * @param source the source representing the compilation unit containing the n
ode being visited |
| 173 * @param typeProvider the object used to access the types from the core libra
ry |
| 174 * @param nameScope the scope used to resolve identifiers in the node that wil
l first be visited |
| 175 * @param errorListener the error listener that will be informed of any errors
that are found |
| 176 * during resolution |
| 177 */ |
| 178 public TypeResolverVisitor(LibraryElement definingLibrary, Source source, |
| 179 TypeProvider typeProvider, Scope nameScope, AnalysisErrorListener errorLis
tener) { |
| 180 super(definingLibrary, source, typeProvider, nameScope, errorListener); |
| 181 dynamicType = typeProvider.getDynamicType(); |
| 182 } |
| 183 |
167 @Override | 184 @Override |
168 public Void visitCatchClause(CatchClause node) { | 185 public Void visitCatchClause(CatchClause node) { |
169 super.visitCatchClause(node); | 186 super.visitCatchClause(node); |
170 SimpleIdentifier exception = node.getExceptionParameter(); | 187 SimpleIdentifier exception = node.getExceptionParameter(); |
171 if (exception != null) { | 188 if (exception != null) { |
172 // If an 'on' clause is provided the type of the exception parameter is th
e type in the 'on' | 189 // If an 'on' clause is provided the type of the exception parameter is th
e type in the 'on' |
173 // clause. Otherwise, the type of the exception parameter is 'Object'. | 190 // clause. Otherwise, the type of the exception parameter is 'Object'. |
174 TypeName exceptionTypeName = node.getExceptionType(); | 191 TypeName exceptionTypeName = node.getExceptionType(); |
175 Type exceptionType; | 192 Type exceptionType; |
176 if (exceptionTypeName == null) { | 193 if (exceptionTypeName == null) { |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 if (alias != null) { | 1106 if (alias != null) { |
1090 aliasElement.setTypeParameters(alias.getTypeParameters()); | 1107 aliasElement.setTypeParameters(alias.getTypeParameters()); |
1091 type.setTypeArguments(alias.getType().getTypeArguments()); | 1108 type.setTypeArguments(alias.getType().getTypeArguments()); |
1092 } else { | 1109 } else { |
1093 type.setTypeArguments(TypeImpl.EMPTY_ARRAY); | 1110 type.setTypeArguments(TypeImpl.EMPTY_ARRAY); |
1094 } | 1111 } |
1095 } | 1112 } |
1096 element.setType(type); | 1113 element.setType(type); |
1097 } | 1114 } |
1098 } | 1115 } |
OLD | NEW |