| 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_test; | 5 library analyzer.test.src.summary.summary_test; |
| 6 | 6 |
| 7 import 'dart:typed_data'; | |
| 8 | |
| 9 import 'package:analyzer/src/generated/element.dart'; | 7 import 'package:analyzer/src/generated/element.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart'; | 8 import 'package:analyzer/src/generated/engine.dart'; |
| 11 import 'package:analyzer/src/generated/java_engine_io.dart'; | 9 import 'package:analyzer/src/generated/java_engine_io.dart'; |
| 12 import 'package:analyzer/src/generated/source.dart'; | 10 import 'package:analyzer/src/generated/source.dart'; |
| 13 import 'package:analyzer/src/summary/builder.dart'; | 11 import 'package:analyzer/src/summary/builder.dart'; |
| 14 import 'package:analyzer/src/summary/format.dart'; | 12 import 'package:analyzer/src/summary/format.dart'; |
| 15 import 'package:analyzer/src/summary/summarize_elements.dart' | 13 import 'package:analyzer/src/summary/summarize_elements.dart' |
| 16 as summarize_elements; | 14 as summarize_elements; |
| 17 import 'package:unittest/unittest.dart'; | 15 import 'package:unittest/unittest.dart'; |
| 18 | 16 |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 UnlinkedClass cls = serializeClassText('class C<T> {}'); | 751 UnlinkedClass cls = serializeClassText('class C<T> {}'); |
| 754 expect(cls.typeParameters, hasLength(1)); | 752 expect(cls.typeParameters, hasLength(1)); |
| 755 expect(cls.typeParameters[0].name, 'T'); | 753 expect(cls.typeParameters[0].name, 'T'); |
| 756 expect(cls.typeParameters[0].bound, isNull); | 754 expect(cls.typeParameters[0].bound, isNull); |
| 757 } | 755 } |
| 758 | 756 |
| 759 test_constructor() { | 757 test_constructor() { |
| 760 UnlinkedExecutable executable = | 758 UnlinkedExecutable executable = |
| 761 findExecutable('', cls: serializeClassText('class C { C(); }')); | 759 findExecutable('', cls: serializeClassText('class C { C(); }')); |
| 762 expect(executable.kind, UnlinkedExecutableKind.constructor); | 760 expect(executable.kind, UnlinkedExecutableKind.constructor); |
| 761 expect(executable.hasImplicitReturnType, isFalse); |
| 763 } | 762 } |
| 764 | 763 |
| 765 test_constructor_anonymous() { | 764 test_constructor_anonymous() { |
| 766 UnlinkedExecutable executable = | 765 UnlinkedExecutable executable = |
| 767 findExecutable('', cls: serializeClassText('class C { C(); }')); | 766 findExecutable('', cls: serializeClassText('class C { C(); }')); |
| 768 expect(executable.name, isEmpty); | 767 expect(executable.name, isEmpty); |
| 769 } | 768 } |
| 770 | 769 |
| 771 test_constructor_const() { | 770 test_constructor_const() { |
| 772 UnlinkedExecutable executable = | 771 UnlinkedExecutable executable = |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 UnlinkedExecutable executable = findExecutable('', | 811 UnlinkedExecutable executable = findExecutable('', |
| 813 cls: serializeClassText('class C { C(int this.x()); Function x; }')); | 812 cls: serializeClassText('class C { C(int this.x()); Function x; }')); |
| 814 UnlinkedParam parameter = executable.parameters[0]; | 813 UnlinkedParam parameter = executable.parameters[0]; |
| 815 checkTypeRef(parameter.type, 'dart:core', 'dart:core', 'int'); | 814 checkTypeRef(parameter.type, 'dart:core', 'dart:core', 'int'); |
| 816 } | 815 } |
| 817 | 816 |
| 818 test_constructor_initializing_formal_function_typed_implicit_return_type() { | 817 test_constructor_initializing_formal_function_typed_implicit_return_type() { |
| 819 UnlinkedExecutable executable = findExecutable('', | 818 UnlinkedExecutable executable = findExecutable('', |
| 820 cls: serializeClassText('class C { C(this.x()); Function x; }')); | 819 cls: serializeClassText('class C { C(this.x()); Function x; }')); |
| 821 UnlinkedParam parameter = executable.parameters[0]; | 820 UnlinkedParam parameter = executable.parameters[0]; |
| 821 // Since the parameter is function-typed it is considered to have an |
| 822 // explicit type, even though that explicit type itself has an implicit |
| 823 // return type. |
| 824 expect(parameter.hasImplicitType, isFalse); |
| 822 checkDynamicTypeRef(parameter.type); | 825 checkDynamicTypeRef(parameter.type); |
| 823 } | 826 } |
| 824 | 827 |
| 825 test_constructor_initializing_formal_function_typed_no_prameters() { | 828 test_constructor_initializing_formal_function_typed_no_prameters() { |
| 826 UnlinkedExecutable executable = findExecutable('', | 829 UnlinkedExecutable executable = findExecutable('', |
| 827 cls: serializeClassText('class C { C(this.x()); final x; }')); | 830 cls: serializeClassText('class C { C(this.x()); final x; }')); |
| 828 UnlinkedParam parameter = executable.parameters[0]; | 831 UnlinkedParam parameter = executable.parameters[0]; |
| 829 expect(parameter.parameters, isEmpty); | 832 expect(parameter.parameters, isEmpty); |
| 830 } | 833 } |
| 831 | 834 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 845 expect(parameter.parameters[1].name, 'b'); | 848 expect(parameter.parameters[1].name, 'b'); |
| 846 } | 849 } |
| 847 | 850 |
| 848 test_constructor_initializing_formal_implicit_type() { | 851 test_constructor_initializing_formal_implicit_type() { |
| 849 // Note: the implicit type of an initializing formal is the type of the | 852 // Note: the implicit type of an initializing formal is the type of the |
| 850 // field. | 853 // field. |
| 851 UnlinkedExecutable executable = findExecutable('', | 854 UnlinkedExecutable executable = findExecutable('', |
| 852 cls: serializeClassText('class C { C(this.x); int x; }')); | 855 cls: serializeClassText('class C { C(this.x); int x; }')); |
| 853 UnlinkedParam parameter = executable.parameters[0]; | 856 UnlinkedParam parameter = executable.parameters[0]; |
| 854 checkTypeRef(parameter.type, 'dart:core', 'dart:core', 'int'); | 857 checkTypeRef(parameter.type, 'dart:core', 'dart:core', 'int'); |
| 858 expect(parameter.hasImplicitType, isTrue); |
| 855 } | 859 } |
| 856 | 860 |
| 857 test_constructor_initializing_formal_name() { | 861 test_constructor_initializing_formal_name() { |
| 858 UnlinkedExecutable executable = findExecutable('', | 862 UnlinkedExecutable executable = findExecutable('', |
| 859 cls: serializeClassText('class C { C(this.x); final x; }')); | 863 cls: serializeClassText('class C { C(this.x); final x; }')); |
| 860 UnlinkedParam parameter = executable.parameters[0]; | 864 UnlinkedParam parameter = executable.parameters[0]; |
| 861 expect(parameter.name, 'x'); | 865 expect(parameter.name, 'x'); |
| 862 } | 866 } |
| 863 | 867 |
| 864 test_constructor_initializing_formal_named() { | 868 test_constructor_initializing_formal_named() { |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 test_executable_concrete() { | 1062 test_executable_concrete() { |
| 1059 UnlinkedExecutable executable = | 1063 UnlinkedExecutable executable = |
| 1060 serializeClassText('abstract class C { f() {} }').executables[0]; | 1064 serializeClassText('abstract class C { f() {} }').executables[0]; |
| 1061 expect(executable.isAbstract, isFalse); | 1065 expect(executable.isAbstract, isFalse); |
| 1062 } | 1066 } |
| 1063 | 1067 |
| 1064 test_executable_function() { | 1068 test_executable_function() { |
| 1065 UnlinkedExecutable executable = serializeExecutableText('f() {}'); | 1069 UnlinkedExecutable executable = serializeExecutableText('f() {}'); |
| 1066 expect(executable.kind, UnlinkedExecutableKind.functionOrMethod); | 1070 expect(executable.kind, UnlinkedExecutableKind.functionOrMethod); |
| 1067 expect(executable.unit, 0); | 1071 expect(executable.unit, 0); |
| 1072 expect(executable.hasImplicitReturnType, isTrue); |
| 1073 checkDynamicTypeRef(executable.returnType); |
| 1074 } |
| 1075 |
| 1076 test_executable_function_explicit_return() { |
| 1077 UnlinkedExecutable executable = |
| 1078 serializeExecutableText('dynamic f() => null;'); |
| 1079 expect(executable.hasImplicitReturnType, isFalse); |
| 1080 checkDynamicTypeRef(executable.returnType); |
| 1068 } | 1081 } |
| 1069 | 1082 |
| 1070 test_executable_getter() { | 1083 test_executable_getter() { |
| 1071 UnlinkedExecutable executable = serializeExecutableText('int get f => 1;'); | 1084 UnlinkedExecutable executable = serializeExecutableText('int get f => 1;'); |
| 1072 expect(executable.kind, UnlinkedExecutableKind.getter); | 1085 expect(executable.kind, UnlinkedExecutableKind.getter); |
| 1086 expect(executable.hasImplicitReturnType, isFalse); |
| 1073 expect(findVariable('f'), isNull); | 1087 expect(findVariable('f'), isNull); |
| 1074 expect(findExecutable('f='), isNull); | 1088 expect(findExecutable('f='), isNull); |
| 1075 } | 1089 } |
| 1076 | 1090 |
| 1077 test_executable_getter_type() { | 1091 test_executable_getter_type() { |
| 1078 UnlinkedExecutable executable = serializeExecutableText('int get f => 1;'); | 1092 UnlinkedExecutable executable = serializeExecutableText('int get f => 1;'); |
| 1079 checkTypeRef(executable.returnType, 'dart:core', 'dart:core', 'int'); | 1093 checkTypeRef(executable.returnType, 'dart:core', 'dart:core', 'int'); |
| 1080 expect(executable.parameters, isEmpty); | 1094 expect(executable.parameters, isEmpty); |
| 1081 } | 1095 } |
| 1082 | 1096 |
| 1083 test_executable_getter_type_implicit() { | 1097 test_executable_getter_type_implicit() { |
| 1084 UnlinkedExecutable executable = serializeExecutableText('get f => 1;'); | 1098 UnlinkedExecutable executable = serializeExecutableText('get f => 1;'); |
| 1085 checkDynamicTypeRef(executable.returnType); | 1099 checkDynamicTypeRef(executable.returnType); |
| 1100 expect(executable.hasImplicitReturnType, isTrue); |
| 1086 expect(executable.parameters, isEmpty); | 1101 expect(executable.parameters, isEmpty); |
| 1087 } | 1102 } |
| 1088 | 1103 |
| 1089 test_executable_member_function() { | 1104 test_executable_member_function() { |
| 1090 UnlinkedExecutable executable = | 1105 UnlinkedExecutable executable = |
| 1091 findExecutable('f', cls: serializeClassText('class C { f() {} }')); | 1106 findExecutable('f', cls: serializeClassText('class C { f() {} }')); |
| 1092 expect(executable.kind, UnlinkedExecutableKind.functionOrMethod); | 1107 expect(executable.kind, UnlinkedExecutableKind.functionOrMethod); |
| 1108 expect(executable.hasImplicitReturnType, isTrue); |
| 1109 } |
| 1110 |
| 1111 test_executable_member_function_explicit_return() { |
| 1112 UnlinkedExecutable executable = findExecutable('f', |
| 1113 cls: serializeClassText('class C { dynamic f() => null; }')); |
| 1114 expect(executable.hasImplicitReturnType, isFalse); |
| 1093 } | 1115 } |
| 1094 | 1116 |
| 1095 test_executable_member_getter() { | 1117 test_executable_member_getter() { |
| 1096 UnlinkedClass cls = serializeClassText('class C { int get f => 1; }'); | 1118 UnlinkedClass cls = serializeClassText('class C { int get f => 1; }'); |
| 1097 UnlinkedExecutable executable = | 1119 UnlinkedExecutable executable = |
| 1098 findExecutable('f', cls: cls, failIfAbsent: true); | 1120 findExecutable('f', cls: cls, failIfAbsent: true); |
| 1099 expect(executable.kind, UnlinkedExecutableKind.getter); | 1121 expect(executable.kind, UnlinkedExecutableKind.getter); |
| 1122 expect(executable.hasImplicitReturnType, isFalse); |
| 1100 expect(findVariable('f', cls: cls), isNull); | 1123 expect(findVariable('f', cls: cls), isNull); |
| 1101 expect(findExecutable('f=', cls: cls), isNull); | 1124 expect(findExecutable('f=', cls: cls), isNull); |
| 1102 } | 1125 } |
| 1103 | 1126 |
| 1104 test_executable_member_setter() { | 1127 test_executable_member_setter() { |
| 1105 UnlinkedClass cls = serializeClassText('class C { void set f(value) {} }'); | 1128 UnlinkedClass cls = serializeClassText('class C { void set f(value) {} }'); |
| 1106 UnlinkedExecutable executable = | 1129 UnlinkedExecutable executable = |
| 1107 findExecutable('f=', cls: cls, failIfAbsent: true); | 1130 findExecutable('f=', cls: cls, failIfAbsent: true); |
| 1108 expect(executable.kind, UnlinkedExecutableKind.setter); | 1131 expect(executable.kind, UnlinkedExecutableKind.setter); |
| 1132 // For setters, hasImplicitReturnType is always false. |
| 1133 expect(executable.hasImplicitReturnType, isFalse); |
| 1109 expect(findVariable('f', cls: cls), isNull); | 1134 expect(findVariable('f', cls: cls), isNull); |
| 1110 expect(findExecutable('f', cls: cls), isNull); | 1135 expect(findExecutable('f', cls: cls), isNull); |
| 1111 } | 1136 } |
| 1112 | 1137 |
| 1138 test_executable_member_setter_implicit_return() { |
| 1139 UnlinkedClass cls = serializeClassText('class C { set f(value) {} }'); |
| 1140 UnlinkedExecutable executable = |
| 1141 findExecutable('f=', cls: cls, failIfAbsent: true); |
| 1142 expect(executable.hasImplicitReturnType, isFalse); |
| 1143 checkDynamicTypeRef(executable.returnType); |
| 1144 } |
| 1145 |
| 1113 test_executable_name() { | 1146 test_executable_name() { |
| 1114 UnlinkedExecutable executable = serializeExecutableText('f() {}'); | 1147 UnlinkedExecutable executable = serializeExecutableText('f() {}'); |
| 1115 expect(executable.name, 'f'); | 1148 expect(executable.name, 'f'); |
| 1116 } | 1149 } |
| 1117 | 1150 |
| 1118 test_executable_no_flags() { | 1151 test_executable_no_flags() { |
| 1119 UnlinkedExecutable executable = serializeExecutableText('f() {}'); | 1152 UnlinkedExecutable executable = serializeExecutableText('f() {}'); |
| 1120 expect(executable.isAbstract, isFalse); | 1153 expect(executable.isAbstract, isFalse); |
| 1121 expect(executable.isConst, isFalse); | 1154 expect(executable.isConst, isFalse); |
| 1122 expect(executable.isFactory, isFalse); | 1155 expect(executable.isFactory, isFalse); |
| 1123 expect(executable.isStatic, isFalse); | 1156 expect(executable.isStatic, isFalse); |
| 1124 } | 1157 } |
| 1125 | 1158 |
| 1126 test_executable_non_static() { | 1159 test_executable_non_static() { |
| 1127 UnlinkedExecutable executable = | 1160 UnlinkedExecutable executable = |
| 1128 serializeClassText('class C { f() {} }').executables[0]; | 1161 serializeClassText('class C { f() {} }').executables[0]; |
| 1129 expect(executable.isStatic, isFalse); | 1162 expect(executable.isStatic, isFalse); |
| 1130 } | 1163 } |
| 1131 | 1164 |
| 1132 test_executable_non_static_top_level() { | 1165 test_executable_non_static_top_level() { |
| 1133 // Top level executables are considered non-static. | 1166 // Top level executables are considered non-static. |
| 1134 UnlinkedExecutable executable = serializeExecutableText('f() {}'); | 1167 UnlinkedExecutable executable = serializeExecutableText('f() {}'); |
| 1135 expect(executable.isStatic, isFalse); | 1168 expect(executable.isStatic, isFalse); |
| 1136 } | 1169 } |
| 1137 | 1170 |
| 1138 test_executable_param_function_typed() { | 1171 test_executable_param_function_typed() { |
| 1139 UnlinkedExecutable executable = serializeExecutableText('f(g()) {}'); | 1172 UnlinkedExecutable executable = serializeExecutableText('f(g()) {}'); |
| 1140 expect(executable.parameters[0].isFunctionTyped, isTrue); | 1173 expect(executable.parameters[0].isFunctionTyped, isTrue); |
| 1174 // Since the parameter is function-typed it is considered to have an |
| 1175 // explicit type, even though that explicit type itself has an implicit |
| 1176 // return type. |
| 1177 expect(executable.parameters[0].hasImplicitType, isFalse); |
| 1178 } |
| 1179 |
| 1180 test_executable_param_function_typed_explicit_return_type() { |
| 1181 UnlinkedExecutable executable = |
| 1182 serializeExecutableText('f(dynamic g()) {}'); |
| 1183 expect(executable.parameters[0].hasImplicitType, isFalse); |
| 1141 } | 1184 } |
| 1142 | 1185 |
| 1143 test_executable_param_function_typed_param() { | 1186 test_executable_param_function_typed_param() { |
| 1144 UnlinkedExecutable executable = serializeExecutableText('f(g(x)) {}'); | 1187 UnlinkedExecutable executable = serializeExecutableText('f(g(x)) {}'); |
| 1145 expect(executable.parameters[0].parameters, hasLength(1)); | 1188 expect(executable.parameters[0].parameters, hasLength(1)); |
| 1146 } | 1189 } |
| 1147 | 1190 |
| 1148 test_executable_param_function_typed_param_none() { | 1191 test_executable_param_function_typed_param_none() { |
| 1149 UnlinkedExecutable executable = serializeExecutableText('f(g()) {}'); | 1192 UnlinkedExecutable executable = serializeExecutableText('f(g()) {}'); |
| 1150 expect(executable.parameters[0].parameters, isEmpty); | 1193 expect(executable.parameters[0].parameters, isEmpty); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1210 expect(executable.parameters, isEmpty); | 1253 expect(executable.parameters, isEmpty); |
| 1211 } | 1254 } |
| 1212 | 1255 |
| 1213 test_executable_param_order() { | 1256 test_executable_param_order() { |
| 1214 UnlinkedExecutable executable = serializeExecutableText('f(x, y) {}'); | 1257 UnlinkedExecutable executable = serializeExecutableText('f(x, y) {}'); |
| 1215 expect(executable.parameters, hasLength(2)); | 1258 expect(executable.parameters, hasLength(2)); |
| 1216 expect(executable.parameters[0].name, 'x'); | 1259 expect(executable.parameters[0].name, 'x'); |
| 1217 expect(executable.parameters[1].name, 'y'); | 1260 expect(executable.parameters[1].name, 'y'); |
| 1218 } | 1261 } |
| 1219 | 1262 |
| 1263 test_executable_param_type_explicit() { |
| 1264 UnlinkedExecutable executable = serializeExecutableText('f(dynamic x) {}'); |
| 1265 checkDynamicTypeRef(executable.parameters[0].type); |
| 1266 expect(executable.parameters[0].hasImplicitType, isFalse); |
| 1267 } |
| 1268 |
| 1220 test_executable_param_type_implicit() { | 1269 test_executable_param_type_implicit() { |
| 1221 UnlinkedExecutable executable = serializeExecutableText('f(x) {}'); | 1270 UnlinkedExecutable executable = serializeExecutableText('f(x) {}'); |
| 1222 checkDynamicTypeRef(executable.parameters[0].type); | 1271 checkDynamicTypeRef(executable.parameters[0].type); |
| 1272 expect(executable.parameters[0].hasImplicitType, isTrue); |
| 1223 } | 1273 } |
| 1224 | 1274 |
| 1225 test_executable_return_type() { | 1275 test_executable_return_type() { |
| 1226 UnlinkedExecutable executable = serializeExecutableText('int f() => 1;'); | 1276 UnlinkedExecutable executable = serializeExecutableText('int f() => 1;'); |
| 1227 checkTypeRef(executable.returnType, 'dart:core', 'dart:core', 'int'); | 1277 checkTypeRef(executable.returnType, 'dart:core', 'dart:core', 'int'); |
| 1278 expect(executable.hasImplicitReturnType, isFalse); |
| 1228 } | 1279 } |
| 1229 | 1280 |
| 1230 test_executable_return_type_implicit() { | 1281 test_executable_return_type_implicit() { |
| 1231 UnlinkedExecutable executable = serializeExecutableText('f() {}'); | 1282 UnlinkedExecutable executable = serializeExecutableText('f() {}'); |
| 1232 checkDynamicTypeRef(executable.returnType); | 1283 checkDynamicTypeRef(executable.returnType); |
| 1284 expect(executable.hasImplicitReturnType, isTrue); |
| 1233 } | 1285 } |
| 1234 | 1286 |
| 1235 test_executable_return_type_void() { | 1287 test_executable_return_type_void() { |
| 1236 UnlinkedExecutable executable = serializeExecutableText('void f() {}'); | 1288 UnlinkedExecutable executable = serializeExecutableText('void f() {}'); |
| 1237 expect(executable.returnType, isNull); | 1289 expect(executable.returnType, isNull); |
| 1238 } | 1290 } |
| 1239 | 1291 |
| 1240 test_executable_setter() { | 1292 test_executable_setter() { |
| 1241 UnlinkedExecutable executable = | 1293 UnlinkedExecutable executable = |
| 1242 serializeExecutableText('void set f(value) {}', 'f='); | 1294 serializeExecutableText('void set f(value) {}', 'f='); |
| 1243 expect(executable.kind, UnlinkedExecutableKind.setter); | 1295 expect(executable.kind, UnlinkedExecutableKind.setter); |
| 1296 expect(executable.hasImplicitReturnType, isFalse); |
| 1244 expect(findVariable('f'), isNull); | 1297 expect(findVariable('f'), isNull); |
| 1245 expect(findExecutable('f'), isNull); | 1298 expect(findExecutable('f'), isNull); |
| 1246 } | 1299 } |
| 1247 | 1300 |
| 1301 test_executable_setter_implicit_return() { |
| 1302 UnlinkedExecutable executable = |
| 1303 serializeExecutableText('set f(value) {}', 'f='); |
| 1304 // For setters, hasImplicitReturnType is always false. |
| 1305 expect(executable.hasImplicitReturnType, isFalse); |
| 1306 checkDynamicTypeRef(executable.returnType); |
| 1307 } |
| 1308 |
| 1248 test_executable_setter_type() { | 1309 test_executable_setter_type() { |
| 1249 UnlinkedExecutable executable = | 1310 UnlinkedExecutable executable = |
| 1250 serializeExecutableText('void set f(int value) {}', 'f='); | 1311 serializeExecutableText('void set f(int value) {}', 'f='); |
| 1251 expect(executable.returnType, isNull); | 1312 expect(executable.returnType, isNull); |
| 1252 expect(executable.parameters, hasLength(1)); | 1313 expect(executable.parameters, hasLength(1)); |
| 1253 expect(executable.parameters[0].name, 'value'); | 1314 expect(executable.parameters[0].name, 'value'); |
| 1254 checkTypeRef( | 1315 checkTypeRef( |
| 1255 executable.parameters[0].type, 'dart:core', 'dart:core', 'int'); | 1316 executable.parameters[0].type, 'dart:core', 'dart:core', 'int'); |
| 1256 } | 1317 } |
| 1257 | 1318 |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 expect(findExecutable('i'), isNull); | 1847 expect(findExecutable('i'), isNull); |
| 1787 expect(findExecutable('i='), isNull); | 1848 expect(findExecutable('i='), isNull); |
| 1788 } | 1849 } |
| 1789 | 1850 |
| 1790 test_variable_const() { | 1851 test_variable_const() { |
| 1791 UnlinkedVariable variable = | 1852 UnlinkedVariable variable = |
| 1792 serializeVariableText('const int i = 0;', variableName: 'i'); | 1853 serializeVariableText('const int i = 0;', variableName: 'i'); |
| 1793 expect(variable.isConst, isTrue); | 1854 expect(variable.isConst, isTrue); |
| 1794 } | 1855 } |
| 1795 | 1856 |
| 1857 test_variable_explicit_dynamic() { |
| 1858 UnlinkedVariable variable = serializeVariableText('dynamic v;'); |
| 1859 checkDynamicTypeRef(variable.type); |
| 1860 expect(variable.hasImplicitType, isFalse); |
| 1861 } |
| 1862 |
| 1796 test_variable_final_top_level() { | 1863 test_variable_final_top_level() { |
| 1797 UnlinkedVariable variable = | 1864 UnlinkedVariable variable = |
| 1798 serializeVariableText('final int i = 0;', variableName: 'i'); | 1865 serializeVariableText('final int i = 0;', variableName: 'i'); |
| 1799 expect(variable.isFinal, isTrue); | 1866 expect(variable.isFinal, isTrue); |
| 1800 } | 1867 } |
| 1801 | 1868 |
| 1802 test_variable_implicit_dynamic() { | 1869 test_variable_implicit_dynamic() { |
| 1803 UnlinkedVariable variable = serializeVariableText('var v;'); | 1870 UnlinkedVariable variable = serializeVariableText('var v;'); |
| 1804 checkDynamicTypeRef(variable.type); | 1871 checkDynamicTypeRef(variable.type); |
| 1872 expect(variable.hasImplicitType, isTrue); |
| 1805 } | 1873 } |
| 1806 | 1874 |
| 1807 test_variable_name() { | 1875 test_variable_name() { |
| 1808 UnlinkedVariable variable = | 1876 UnlinkedVariable variable = |
| 1809 serializeVariableText('int i;', variableName: 'i'); | 1877 serializeVariableText('int i;', variableName: 'i'); |
| 1810 expect(variable.name, 'i'); | 1878 expect(variable.name, 'i'); |
| 1811 expect(variable.unit, 0); | 1879 expect(variable.unit, 0); |
| 1812 } | 1880 } |
| 1813 | 1881 |
| 1814 test_variable_no_flags() { | 1882 test_variable_no_flags() { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1849 serializeClassText('class C { static int i; }').fields[0]; | 1917 serializeClassText('class C { static int i; }').fields[0]; |
| 1850 expect(variable.isStatic, isTrue); | 1918 expect(variable.isStatic, isTrue); |
| 1851 } | 1919 } |
| 1852 | 1920 |
| 1853 test_variable_type() { | 1921 test_variable_type() { |
| 1854 UnlinkedVariable variable = | 1922 UnlinkedVariable variable = |
| 1855 serializeVariableText('int i;', variableName: 'i'); | 1923 serializeVariableText('int i;', variableName: 'i'); |
| 1856 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int'); | 1924 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int'); |
| 1857 } | 1925 } |
| 1858 } | 1926 } |
| OLD | NEW |