| 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/dart/scanner/reader.dart'; | 10 import 'package:analyzer/src/dart/scanner/reader.dart'; |
| (...skipping 4381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4392 | 4392 |
| 4393 test_executable_param_function_typed_return_type() { | 4393 test_executable_param_function_typed_return_type() { |
| 4394 UnlinkedExecutable executable = serializeExecutableText('f(int g()) {}'); | 4394 UnlinkedExecutable executable = serializeExecutableText('f(int g()) {}'); |
| 4395 checkTypeRef( | 4395 checkTypeRef( |
| 4396 executable.parameters[0].type, 'dart:core', 'dart:core', 'int'); | 4396 executable.parameters[0].type, 'dart:core', 'dart:core', 'int'); |
| 4397 } | 4397 } |
| 4398 | 4398 |
| 4399 test_executable_param_function_typed_return_type_implicit() { | 4399 test_executable_param_function_typed_return_type_implicit() { |
| 4400 if (!checkAstDerivedData) { | 4400 if (!checkAstDerivedData) { |
| 4401 // TODO(paulberry): this test fails when building the summary from the | 4401 // TODO(paulberry): this test fails when building the summary from the |
| 4402 // element model because the elment model doesn't record whether a | 4402 // element model because the element model doesn't record whether a |
| 4403 // function-typed parameter's return type is implicit. | 4403 // function-typed parameter's return type is implicit. |
| 4404 return; | 4404 return; |
| 4405 } | 4405 } |
| 4406 UnlinkedExecutable executable = serializeExecutableText('f(g()) {}'); | 4406 UnlinkedExecutable executable = serializeExecutableText('f(g()) {}'); |
| 4407 expect(executable.parameters[0].isFunctionTyped, isTrue); | 4407 expect(executable.parameters[0].isFunctionTyped, isTrue); |
| 4408 expect(executable.parameters[0].type, isNull); | 4408 expect(executable.parameters[0].type, isNull); |
| 4409 } | 4409 } |
| 4410 | 4410 |
| 4411 test_executable_param_function_typed_return_type_void() { | 4411 test_executable_param_function_typed_return_type_void() { |
| 4412 UnlinkedExecutable executable = serializeExecutableText('f(void g()) {}'); | 4412 UnlinkedExecutable executable = serializeExecutableText('f(void g()) {}'); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4505 test_executable_param_type_explicit() { | 4505 test_executable_param_type_explicit() { |
| 4506 UnlinkedExecutable executable = serializeExecutableText('f(dynamic x) {}'); | 4506 UnlinkedExecutable executable = serializeExecutableText('f(dynamic x) {}'); |
| 4507 checkDynamicTypeRef(executable.parameters[0].type); | 4507 checkDynamicTypeRef(executable.parameters[0].type); |
| 4508 } | 4508 } |
| 4509 | 4509 |
| 4510 test_executable_param_type_implicit() { | 4510 test_executable_param_type_implicit() { |
| 4511 UnlinkedExecutable executable = serializeExecutableText('f(x) {}'); | 4511 UnlinkedExecutable executable = serializeExecutableText('f(x) {}'); |
| 4512 expect(executable.parameters[0].type, isNull); | 4512 expect(executable.parameters[0].type, isNull); |
| 4513 } | 4513 } |
| 4514 | 4514 |
| 4515 test_executable_param_type_typedef() { |
| 4516 UnlinkedExecutable executable = serializeExecutableText(r''' |
| 4517 typedef MyFunction(int p); |
| 4518 f(MyFunction myFunction) {} |
| 4519 '''); |
| 4520 expect(executable.parameters[0].isFunctionTyped, isFalse); |
| 4521 checkTypeRef(executable.parameters[0].type, null, null, 'MyFunction', |
| 4522 expectedKind: ReferenceKind.typedef); |
| 4523 } |
| 4524 |
| 4515 test_executable_return_type() { | 4525 test_executable_return_type() { |
| 4516 UnlinkedExecutable executable = serializeExecutableText('int f() => 1;'); | 4526 UnlinkedExecutable executable = serializeExecutableText('int f() => 1;'); |
| 4517 checkTypeRef(executable.returnType, 'dart:core', 'dart:core', 'int'); | 4527 checkTypeRef(executable.returnType, 'dart:core', 'dart:core', 'int'); |
| 4518 } | 4528 } |
| 4519 | 4529 |
| 4520 test_executable_return_type_implicit() { | 4530 test_executable_return_type_implicit() { |
| 4521 UnlinkedExecutable executable = serializeExecutableText('f() {}'); | 4531 UnlinkedExecutable executable = serializeExecutableText('f() {}'); |
| 4522 expect(executable.returnType, isNull); | 4532 expect(executable.returnType, isNull); |
| 4523 } | 4533 } |
| 4524 | 4534 |
| (...skipping 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6967 final String absoluteUri; | 6977 final String absoluteUri; |
| 6968 final String relativeUri; | 6978 final String relativeUri; |
| 6969 final int numTypeParameters; | 6979 final int numTypeParameters; |
| 6970 | 6980 |
| 6971 _PrefixExpectation(this.kind, this.name, | 6981 _PrefixExpectation(this.kind, this.name, |
| 6972 {this.inLibraryDefiningUnit: false, | 6982 {this.inLibraryDefiningUnit: false, |
| 6973 this.absoluteUri, | 6983 this.absoluteUri, |
| 6974 this.relativeUri, | 6984 this.relativeUri, |
| 6975 this.numTypeParameters: 0}); | 6985 this.numTypeParameters: 0}); |
| 6976 } | 6986 } |
| OLD | NEW |