OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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.dart.compiler.ast.DartClass; | 8 import com.google.dart.compiler.ast.DartClass; |
9 import com.google.dart.compiler.ast.DartField; | 9 import com.google.dart.compiler.ast.DartField; |
10 import com.google.dart.compiler.ast.DartFunctionExpression; | 10 import com.google.dart.compiler.ast.DartFunctionExpression; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 public static DynamicElement dynamicElement() { | 163 public static DynamicElement dynamicElement() { |
164 return DynamicElementImplementation.getInstance(); | 164 return DynamicElementImplementation.getInstance(); |
165 } | 165 } |
166 | 166 |
167 static ConstructorElement lookupConstructor(ClassElement cls, ClassElement typ
e, String name) { | 167 static ConstructorElement lookupConstructor(ClassElement cls, ClassElement typ
e, String name) { |
168 return ((ClassElementImplementation) cls).lookupConstructor(type, name); | 168 return ((ClassElementImplementation) cls).lookupConstructor(type, name); |
169 } | 169 } |
170 | 170 |
171 static ConstructorElement lookupConstructor(ClassElement cls, String name) { | 171 static ConstructorElement lookupConstructor(ClassElement cls, String name) { |
172 return ((ClassElementImplementation) cls).lookupConstructor(name); | 172 if (cls instanceof ClassElementImplementation) { |
| 173 return ((ClassElementImplementation) cls).lookupConstructor(name); |
| 174 } |
| 175 return null; |
173 } | 176 } |
174 | 177 |
175 public static MethodElement lookupLocalMethod(ClassElement cls, String name) { | 178 public static MethodElement lookupLocalMethod(ClassElement cls, String name) { |
176 return ((ClassElementImplementation) cls).lookupLocalMethod(name); | 179 return ((ClassElementImplementation) cls).lookupLocalMethod(name); |
177 } | 180 } |
178 | 181 |
179 public static FieldElement lookupLocalField(ClassElement cls, String name) { | 182 public static FieldElement lookupLocalField(ClassElement cls, String name) { |
180 return ((ClassElementImplementation) cls).lookupLocalField(name); | 183 return ((ClassElementImplementation) cls).lookupLocalField(name); |
181 } | 184 } |
182 | 185 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 return VoidElement.getInstance(); | 220 return VoidElement.getInstance(); |
218 } | 221 } |
219 | 222 |
220 /** | 223 /** |
221 * Returns true if the class needs an implicit default constructor. | 224 * Returns true if the class needs an implicit default constructor. |
222 */ | 225 */ |
223 public static boolean needsImplicitDefaultConstructor(ClassElement classElemen
t) { | 226 public static boolean needsImplicitDefaultConstructor(ClassElement classElemen
t) { |
224 return !classElement.isObject() && classElement.getConstructors().isEmpty(); | 227 return !classElement.isObject() && classElement.getConstructors().isEmpty(); |
225 } | 228 } |
226 } | 229 } |
OLD | NEW |