| 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 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
| (...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 UnlinkedExecutable executable = | 1387 UnlinkedExecutable executable = |
| 1388 findExecutable('f', executables: cls.executables, failIfAbsent: true); | 1388 findExecutable('f', executables: cls.executables, failIfAbsent: true); |
| 1389 expect(executable.isExternal, isTrue); | 1389 expect(executable.isExternal, isTrue); |
| 1390 } | 1390 } |
| 1391 | 1391 |
| 1392 test_executable_member_setter() { | 1392 test_executable_member_setter() { |
| 1393 UnlinkedClass cls = serializeClassText('class C { void set f(value) {} }'); | 1393 UnlinkedClass cls = serializeClassText('class C { void set f(value) {} }'); |
| 1394 UnlinkedExecutable executable = | 1394 UnlinkedExecutable executable = |
| 1395 findExecutable('f=', executables: cls.executables, failIfAbsent: true); | 1395 findExecutable('f=', executables: cls.executables, failIfAbsent: true); |
| 1396 expect(executable.kind, UnlinkedExecutableKind.setter); | 1396 expect(executable.kind, UnlinkedExecutableKind.setter); |
| 1397 // For setters, hasImplicitReturnType is always false. | |
| 1398 expect(executable.hasImplicitReturnType, isFalse); | 1397 expect(executable.hasImplicitReturnType, isFalse); |
| 1399 expect(executable.isExternal, isFalse); | 1398 expect(executable.isExternal, isFalse); |
| 1400 expect(findVariable('f', variables: cls.fields), isNull); | 1399 expect(findVariable('f', variables: cls.fields), isNull); |
| 1401 expect(findExecutable('f', executables: cls.executables), isNull); | 1400 expect(findExecutable('f', executables: cls.executables), isNull); |
| 1402 } | 1401 } |
| 1403 | 1402 |
| 1404 test_executable_member_setter_external() { | 1403 test_executable_member_setter_external() { |
| 1405 UnlinkedClass cls = | 1404 UnlinkedClass cls = |
| 1406 serializeClassText('class C { external void set f(value); }'); | 1405 serializeClassText('class C { external void set f(value); }'); |
| 1407 UnlinkedExecutable executable = | 1406 UnlinkedExecutable executable = |
| 1408 findExecutable('f=', executables: cls.executables, failIfAbsent: true); | 1407 findExecutable('f=', executables: cls.executables, failIfAbsent: true); |
| 1409 expect(executable.isExternal, isTrue); | 1408 expect(executable.isExternal, isTrue); |
| 1410 } | 1409 } |
| 1411 | 1410 |
| 1412 test_executable_member_setter_implicit_return() { | 1411 test_executable_member_setter_implicit_return() { |
| 1413 UnlinkedClass cls = serializeClassText('class C { set f(value) {} }'); | 1412 UnlinkedClass cls = serializeClassText('class C { set f(value) {} }'); |
| 1414 UnlinkedExecutable executable = | 1413 UnlinkedExecutable executable = |
| 1415 findExecutable('f=', executables: cls.executables, failIfAbsent: true); | 1414 findExecutable('f=', executables: cls.executables, failIfAbsent: true); |
| 1416 expect(executable.hasImplicitReturnType, isFalse); | 1415 expect(executable.hasImplicitReturnType, isTrue); |
| 1417 checkDynamicTypeRef(executable.returnType); | 1416 checkDynamicTypeRef(executable.returnType); |
| 1418 } | 1417 } |
| 1419 | 1418 |
| 1420 test_executable_name() { | 1419 test_executable_name() { |
| 1421 UnlinkedExecutable executable = serializeExecutableText('f() {}'); | 1420 UnlinkedExecutable executable = serializeExecutableText('f() {}'); |
| 1422 expect(executable.name, 'f'); | 1421 expect(executable.name, 'f'); |
| 1423 } | 1422 } |
| 1424 | 1423 |
| 1425 test_executable_no_flags() { | 1424 test_executable_no_flags() { |
| 1426 UnlinkedExecutable executable = serializeExecutableText('f() {}'); | 1425 UnlinkedExecutable executable = serializeExecutableText('f() {}'); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 | 1654 |
| 1656 test_executable_setter_external() { | 1655 test_executable_setter_external() { |
| 1657 UnlinkedExecutable executable = | 1656 UnlinkedExecutable executable = |
| 1658 serializeExecutableText('external void set f(value);', 'f='); | 1657 serializeExecutableText('external void set f(value);', 'f='); |
| 1659 expect(executable.isExternal, isTrue); | 1658 expect(executable.isExternal, isTrue); |
| 1660 } | 1659 } |
| 1661 | 1660 |
| 1662 test_executable_setter_implicit_return() { | 1661 test_executable_setter_implicit_return() { |
| 1663 UnlinkedExecutable executable = | 1662 UnlinkedExecutable executable = |
| 1664 serializeExecutableText('set f(value) {}', 'f='); | 1663 serializeExecutableText('set f(value) {}', 'f='); |
| 1665 // For setters, hasImplicitReturnType is always false. | 1664 expect(executable.hasImplicitReturnType, isTrue); |
| 1666 expect(executable.hasImplicitReturnType, isFalse); | |
| 1667 checkDynamicTypeRef(executable.returnType); | 1665 checkDynamicTypeRef(executable.returnType); |
| 1668 } | 1666 } |
| 1669 | 1667 |
| 1670 test_executable_setter_private() { | 1668 test_executable_setter_private() { |
| 1671 serializeExecutableText('void set _f(value) {}', '_f='); | 1669 serializeExecutableText('void set _f(value) {}', '_f='); |
| 1672 expect(unlinkedUnits[0].publicNamespace.names, isEmpty); | 1670 expect(unlinkedUnits[0].publicNamespace.names, isEmpty); |
| 1673 } | 1671 } |
| 1674 | 1672 |
| 1675 test_executable_setter_type() { | 1673 test_executable_setter_type() { |
| 1676 UnlinkedExecutable executable = | 1674 UnlinkedExecutable executable = |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2363 UnlinkedVariable variable = | 2361 UnlinkedVariable variable = |
| 2364 serializeVariableText('int i;', variableName: 'i'); | 2362 serializeVariableText('int i;', variableName: 'i'); |
| 2365 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int'); | 2363 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int'); |
| 2366 } | 2364 } |
| 2367 | 2365 |
| 2368 test_varible_private() { | 2366 test_varible_private() { |
| 2369 serializeVariableText('int _i;', variableName: '_i'); | 2367 serializeVariableText('int _i;', variableName: '_i'); |
| 2370 expect(unlinkedUnits[0].publicNamespace.names, isEmpty); | 2368 expect(unlinkedUnits[0].publicNamespace.names, isEmpty); |
| 2371 } | 2369 } |
| 2372 } | 2370 } |
| OLD | NEW |