| 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 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 expect(parameter.parameters[1].name, 'b'); | 1376 expect(parameter.parameters[1].name, 'b'); |
| 1377 } | 1377 } |
| 1378 | 1378 |
| 1379 test_constructor_initializing_formal_implicit_type() { | 1379 test_constructor_initializing_formal_implicit_type() { |
| 1380 // Note: the implicit type of an initializing formal is the type of the | 1380 // Note: the implicit type of an initializing formal is the type of the |
| 1381 // field. | 1381 // field. |
| 1382 UnlinkedExecutable executable = findExecutable('', | 1382 UnlinkedExecutable executable = findExecutable('', |
| 1383 executables: | 1383 executables: |
| 1384 serializeClassText('class C { C(this.x); int x; }').executables); | 1384 serializeClassText('class C { C(this.x); int x; }').executables); |
| 1385 UnlinkedParam parameter = executable.parameters[0]; | 1385 UnlinkedParam parameter = executable.parameters[0]; |
| 1386 checkTypeRef(parameter.type, 'dart:core', 'dart:core', 'int'); | 1386 expect(parameter.type, isNull); |
| 1387 expect(parameter.hasImplicitType, isTrue); | 1387 expect(parameter.hasImplicitType, isTrue); |
| 1388 } | 1388 } |
| 1389 | 1389 |
| 1390 test_constructor_initializing_formal_name() { | 1390 test_constructor_initializing_formal_name() { |
| 1391 UnlinkedExecutable executable = findExecutable('', | 1391 UnlinkedExecutable executable = findExecutable('', |
| 1392 executables: | 1392 executables: |
| 1393 serializeClassText('class C { C(this.x); final x; }').executables); | 1393 serializeClassText('class C { C(this.x); final x; }').executables); |
| 1394 UnlinkedParam parameter = executable.parameters[0]; | 1394 UnlinkedParam parameter = executable.parameters[0]; |
| 1395 expect(parameter.name, 'x'); | 1395 expect(parameter.name, 'x'); |
| 1396 } | 1396 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 UnlinkedParam parameter = executable.parameters[0]; | 1428 UnlinkedParam parameter = executable.parameters[0]; |
| 1429 expect(parameter.kind, UnlinkedParamKind.required); | 1429 expect(parameter.kind, UnlinkedParamKind.required); |
| 1430 } | 1430 } |
| 1431 | 1431 |
| 1432 test_constructor_initializing_formal_typedef() { | 1432 test_constructor_initializing_formal_typedef() { |
| 1433 UnlinkedExecutable executable = findExecutable('', | 1433 UnlinkedExecutable executable = findExecutable('', |
| 1434 executables: serializeClassText( | 1434 executables: serializeClassText( |
| 1435 'typedef F<T>(T x); class C<X> { C(this.f); F<X> f; }') | 1435 'typedef F<T>(T x); class C<X> { C(this.f); F<X> f; }') |
| 1436 .executables); | 1436 .executables); |
| 1437 UnlinkedParam parameter = executable.parameters[0]; | 1437 UnlinkedParam parameter = executable.parameters[0]; |
| 1438 expect(parameter.parameters, hasLength(1)); | 1438 expect(parameter.isFunctionTyped, isFalse); |
| 1439 expect(parameter.parameters, isEmpty); |
| 1439 } | 1440 } |
| 1440 | 1441 |
| 1441 test_constructor_named() { | 1442 test_constructor_named() { |
| 1442 String text = 'class C { C.foo(); }'; | 1443 String text = 'class C { C.foo(); }'; |
| 1443 UnlinkedExecutable executable = findExecutable('foo', | 1444 UnlinkedExecutable executable = findExecutable('foo', |
| 1444 executables: serializeClassText(text).executables); | 1445 executables: serializeClassText(text).executables); |
| 1445 expect(executable.name, 'foo'); | 1446 expect(executable.name, 'foo'); |
| 1446 expect(executable.nameOffset, text.indexOf('foo')); | 1447 expect(executable.nameOffset, text.indexOf('foo')); |
| 1447 } | 1448 } |
| 1448 | 1449 |
| (...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3157 UnlinkedVariable variable = | 3158 UnlinkedVariable variable = |
| 3158 serializeVariableText('int i;', variableName: 'i'); | 3159 serializeVariableText('int i;', variableName: 'i'); |
| 3159 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int'); | 3160 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int'); |
| 3160 } | 3161 } |
| 3161 | 3162 |
| 3162 test_varible_private() { | 3163 test_varible_private() { |
| 3163 serializeVariableText('int _i;', variableName: '_i'); | 3164 serializeVariableText('int _i;', variableName: '_i'); |
| 3164 expect(unlinkedUnits[0].publicNamespace.names, isEmpty); | 3165 expect(unlinkedUnits[0].publicNamespace.names, isEmpty); |
| 3165 } | 3166 } |
| 3166 } | 3167 } |
| OLD | NEW |