| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.element_test; | 8 library engine.element_test; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 expect(supers, hasLength(1)); | 119 expect(supers, hasLength(1)); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void test_getField() { | 122 void test_getField() { |
| 123 ClassElementImpl classA = ElementFactory.classElement2("A"); | 123 ClassElementImpl classA = ElementFactory.classElement2("A"); |
| 124 String fieldName = "f"; | 124 String fieldName = "f"; |
| 125 FieldElementImpl field = | 125 FieldElementImpl field = |
| 126 ElementFactory.fieldElement(fieldName, false, false, false, null); | 126 ElementFactory.fieldElement(fieldName, false, false, false, null); |
| 127 classA.fields = <FieldElement>[field]; | 127 classA.fields = <FieldElement>[field]; |
| 128 expect(classA.getField(fieldName), same(field)); | 128 expect(classA.getField(fieldName), same(field)); |
| 129 expect(field.isEnumConstant, false); |
| 129 // no such field | 130 // no such field |
| 130 expect(classA.getField("noSuchField"), same(null)); | 131 expect(classA.getField("noSuchField"), same(null)); |
| 131 } | 132 } |
| 132 | 133 |
| 133 void test_getMethod_declared() { | 134 void test_getMethod_declared() { |
| 134 ClassElementImpl classA = ElementFactory.classElement2("A"); | 135 ClassElementImpl classA = ElementFactory.classElement2("A"); |
| 135 String methodName = "m"; | 136 String methodName = "m"; |
| 136 MethodElement method = ElementFactory.methodElement(methodName, null); | 137 MethodElement method = ElementFactory.methodElement(methodName, null); |
| 137 classA.methods = <MethodElement>[method]; | 138 classA.methods = <MethodElement>[method]; |
| 138 expect(classA.getMethod(methodName), same(method)); | 139 expect(classA.getMethod(methodName), same(method)); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 void test_hasStaticMember_true_setter() { | 253 void test_hasStaticMember_true_setter() { |
| 253 ClassElementImpl classA = ElementFactory.classElement2("A"); | 254 ClassElementImpl classA = ElementFactory.classElement2("A"); |
| 254 PropertyAccessorElementImpl setter = | 255 PropertyAccessorElementImpl setter = |
| 255 ElementFactory.setterElement("foo", false, null); | 256 ElementFactory.setterElement("foo", false, null); |
| 256 classA.accessors = <PropertyAccessorElement>[setter]; | 257 classA.accessors = <PropertyAccessorElement>[setter]; |
| 257 // "foo" is static | 258 // "foo" is static |
| 258 setter.static = true; | 259 setter.static = true; |
| 259 expect(classA.hasStaticMember, isTrue); | 260 expect(classA.hasStaticMember, isTrue); |
| 260 } | 261 } |
| 261 | 262 |
| 263 void test_isEnum() { |
| 264 String firstConst = "A"; |
| 265 String secondConst = "B"; |
| 266 ClassElementImpl enumE = ElementFactory.enumElement( |
| 267 new TestTypeProvider(), |
| 268 "E", |
| 269 [firstConst, secondConst]); |
| 270 |
| 271 // E is an enum |
| 272 expect(enumE.isEnum, true); |
| 273 |
| 274 // A and B are static members |
| 275 expect(enumE.getField(firstConst).isEnumConstant, true); |
| 276 expect(enumE.getField(secondConst).isEnumConstant, true); |
| 277 } |
| 278 |
| 262 void test_lookUpConcreteMethod_declared() { | 279 void test_lookUpConcreteMethod_declared() { |
| 263 // class A { | 280 // class A { |
| 264 // m() {} | 281 // m() {} |
| 265 // } | 282 // } |
| 266 LibraryElementImpl library = | 283 LibraryElementImpl library = |
| 267 ElementFactory.library(createAnalysisContext(), "lib"); | 284 ElementFactory.library(createAnalysisContext(), "lib"); |
| 268 ClassElementImpl classA = ElementFactory.classElement2("A"); | 285 ClassElementImpl classA = ElementFactory.classElement2("A"); |
| 269 String methodName = "m"; | 286 String methodName = "m"; |
| 270 MethodElement method = ElementFactory.methodElement(methodName, null); | 287 MethodElement method = ElementFactory.methodElement(methodName, null); |
| 271 classA.methods = <MethodElement>[method]; | 288 classA.methods = <MethodElement>[method]; |
| (...skipping 3697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3969 | 3986 |
| 3970 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction extends | 3987 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction extends |
| 3971 InterfaceTypeImpl { | 3988 InterfaceTypeImpl { |
| 3972 | 3989 |
| 3973 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0) | 3990 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0) |
| 3974 : super.con1(arg0); | 3991 : super.con1(arg0); |
| 3975 | 3992 |
| 3976 @override | 3993 @override |
| 3977 bool get isDartCoreFunction => true; | 3994 bool get isDartCoreFunction => true; |
| 3978 } | 3995 } |
| OLD | NEW |