| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.test.src.summary.summary_common; | 5 library analyzer.test.src.summary.summary_common; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 '''); | 1092 '''); |
| 1093 expect(cls.isAbstract, false); | 1093 expect(cls.isAbstract, false); |
| 1094 expect(unlinkedUnits[0].publicNamespace.names, hasLength(1)); | 1094 expect(unlinkedUnits[0].publicNamespace.names, hasLength(1)); |
| 1095 UnlinkedPublicName className = unlinkedUnits[0].publicNamespace.names[0]; | 1095 UnlinkedPublicName className = unlinkedUnits[0].publicNamespace.names[0]; |
| 1096 expect(className.kind, ReferenceKind.classOrEnum); | 1096 expect(className.kind, ReferenceKind.classOrEnum); |
| 1097 expect(className.name, 'C'); | 1097 expect(className.name, 'C'); |
| 1098 expect(className.numTypeParameters, 0); | 1098 expect(className.numTypeParameters, 0); |
| 1099 // executables | 1099 // executables |
| 1100 Map<String, UnlinkedPublicName> executablesMap = | 1100 Map<String, UnlinkedPublicName> executablesMap = |
| 1101 <String, UnlinkedPublicName>{}; | 1101 <String, UnlinkedPublicName>{}; |
| 1102 className.constMembers.forEach((e) => executablesMap[e.name] = e); | 1102 className.members.forEach((e) => executablesMap[e.name] = e); |
| 1103 expect(executablesMap, hasLength(2)); | 1103 expect(executablesMap, hasLength(2)); |
| 1104 { | 1104 { |
| 1105 UnlinkedPublicName executable = executablesMap['fieldStaticConst']; | 1105 UnlinkedPublicName executable = executablesMap['fieldStaticConst']; |
| 1106 expect(executable.kind, ReferenceKind.propertyAccessor); | 1106 expect(executable.kind, ReferenceKind.propertyAccessor); |
| 1107 expect(executable.constMembers, isEmpty); | 1107 expect(executable.members, isEmpty); |
| 1108 } | 1108 } |
| 1109 { | 1109 { |
| 1110 UnlinkedPublicName executable = executablesMap['methodStaticPublic']; | 1110 UnlinkedPublicName executable = executablesMap['methodStaticPublic']; |
| 1111 expect(executable.kind, ReferenceKind.method); | 1111 expect(executable.kind, ReferenceKind.method); |
| 1112 expect(executable.constMembers, isEmpty); | 1112 expect(executable.members, isEmpty); |
| 1113 } | 1113 } |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 test_class_constMembers_constructors() { | 1116 test_class_constMembers_constructors() { |
| 1117 UnlinkedClass cls = serializeClassText(''' | 1117 UnlinkedClass cls = serializeClassText(''' |
| 1118 class C { | 1118 class C { |
| 1119 const C(); | 1119 const C(); |
| 1120 const C.constructorNamedPublicConst(); | 1120 const C.constructorNamedPublicConst(); |
| 1121 C.constructorNamedPublic(); | 1121 C.constructorNamedPublic(); |
| 1122 C._constructorNamedPrivate(); | 1122 C._constructorNamedPrivate(); |
| 1123 } | 1123 } |
| 1124 '''); | 1124 '''); |
| 1125 expect(cls.isAbstract, false); | 1125 expect(cls.isAbstract, false); |
| 1126 expect(unlinkedUnits[0].publicNamespace.names, hasLength(1)); | 1126 expect(unlinkedUnits[0].publicNamespace.names, hasLength(1)); |
| 1127 UnlinkedPublicName className = unlinkedUnits[0].publicNamespace.names[0]; | 1127 UnlinkedPublicName className = unlinkedUnits[0].publicNamespace.names[0]; |
| 1128 expect(className.kind, ReferenceKind.classOrEnum); | 1128 expect(className.kind, ReferenceKind.classOrEnum); |
| 1129 expect(className.name, 'C'); | 1129 expect(className.name, 'C'); |
| 1130 expect(className.numTypeParameters, 0); | 1130 expect(className.numTypeParameters, 0); |
| 1131 // executables | 1131 // executables |
| 1132 Map<String, UnlinkedPublicName> executablesMap = | 1132 Map<String, UnlinkedPublicName> executablesMap = |
| 1133 <String, UnlinkedPublicName>{}; | 1133 <String, UnlinkedPublicName>{}; |
| 1134 className.constMembers.forEach((e) => executablesMap[e.name] = e); | 1134 className.members.forEach((e) => executablesMap[e.name] = e); |
| 1135 expect(executablesMap, hasLength(2)); | 1135 expect(executablesMap, hasLength(2)); |
| 1136 { | 1136 { |
| 1137 UnlinkedPublicName executable = executablesMap['']; | |
| 1138 expect(executable.kind, ReferenceKind.constructor); | |
| 1139 expect(executable.constMembers, isEmpty); | |
| 1140 } | |
| 1141 { | |
| 1142 UnlinkedPublicName executable = | 1137 UnlinkedPublicName executable = |
| 1143 executablesMap['constructorNamedPublicConst']; | 1138 executablesMap['constructorNamedPublicConst']; |
| 1144 expect(executable.kind, ReferenceKind.constructor); | 1139 expect(executable.kind, ReferenceKind.constructor); |
| 1145 expect(executable.constMembers, isEmpty); | 1140 expect(executable.members, isEmpty); |
| 1141 } |
| 1142 { |
| 1143 UnlinkedPublicName executable = executablesMap['constructorNamedPublic']; |
| 1144 expect(executable.kind, ReferenceKind.constructor); |
| 1145 expect(executable.members, isEmpty); |
| 1146 } | 1146 } |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 test_class_documented() { | 1149 test_class_documented() { |
| 1150 String text = ''' | 1150 String text = ''' |
| 1151 // Extra comment so doc comment offset != 0 | 1151 // Extra comment so doc comment offset != 0 |
| 1152 /** | 1152 /** |
| 1153 * Docs | 1153 * Docs |
| 1154 */ | 1154 */ |
| 1155 class C {}'''; | 1155 class C {}'''; |
| (...skipping 4849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6005 final String absoluteUri; | 6005 final String absoluteUri; |
| 6006 final String relativeUri; | 6006 final String relativeUri; |
| 6007 final int numTypeParameters; | 6007 final int numTypeParameters; |
| 6008 | 6008 |
| 6009 _PrefixExpectation(this.kind, this.name, | 6009 _PrefixExpectation(this.kind, this.name, |
| 6010 {this.inLibraryDefiningUnit: false, | 6010 {this.inLibraryDefiningUnit: false, |
| 6011 this.absoluteUri, | 6011 this.absoluteUri, |
| 6012 this.relativeUri, | 6012 this.relativeUri, |
| 6013 this.numTypeParameters: 0}); | 6013 this.numTypeParameters: 0}); |
| 6014 } | 6014 } |
| OLD | NEW |