| 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 test.src.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 } | 1317 } |
| 1318 | 1318 |
| 1319 test_class_type_parameters_f_bound_simple() { | 1319 test_class_type_parameters_f_bound_simple() { |
| 1320 checkLibrary('class C<T extends U, U> {}'); | 1320 checkLibrary('class C<T extends U, U> {}'); |
| 1321 } | 1321 } |
| 1322 | 1322 |
| 1323 test_classes() { | 1323 test_classes() { |
| 1324 checkLibrary('class C {} class D {}'); | 1324 checkLibrary('class C {} class D {}'); |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 test_closure_executable_with_return_type_from_closure() { |
| 1328 checkLibrary(''' |
| 1329 f() { |
| 1330 print(() {}); |
| 1331 print(() => () => 0); |
| 1332 } |
| 1333 '''); |
| 1334 } |
| 1335 |
| 1327 test_const_invalid_field_const() { | 1336 test_const_invalid_field_const() { |
| 1328 constantInitializersAreInvalid = true; | 1337 constantInitializersAreInvalid = true; |
| 1329 checkLibrary( | 1338 checkLibrary( |
| 1330 r''' | 1339 r''' |
| 1331 class C { | 1340 class C { |
| 1332 static const f = 1 + foo(); | 1341 static const f = 1 + foo(); |
| 1333 } | 1342 } |
| 1334 int foo() => 42; | 1343 int foo() => 42; |
| 1335 ''', | 1344 ''', |
| 1336 allowErrors: true); | 1345 allowErrors: true); |
| (...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2807 test_inferred_type_refers_to_method_function_typed_parameter_type() { | 2816 test_inferred_type_refers_to_method_function_typed_parameter_type() { |
| 2808 checkLibrary('class C extends D { void f(int x, g) {} }' | 2817 checkLibrary('class C extends D { void f(int x, g) {} }' |
| 2809 ' abstract class D { void f(int x, int g(String s)); }'); | 2818 ' abstract class D { void f(int x, int g(String s)); }'); |
| 2810 } | 2819 } |
| 2811 | 2820 |
| 2812 test_inferred_type_refers_to_setter_function_typed_parameter_type() { | 2821 test_inferred_type_refers_to_setter_function_typed_parameter_type() { |
| 2813 checkLibrary('class C extends D { void set f(g) {} }' | 2822 checkLibrary('class C extends D { void set f(g) {} }' |
| 2814 ' abstract class D { void set f(int g(String s)); }'); | 2823 ' abstract class D { void set f(int g(String s)); }'); |
| 2815 } | 2824 } |
| 2816 | 2825 |
| 2826 test_initializer_executable_with_return_type_from_closure() { |
| 2827 checkLibrary('var v = () => 0;'); |
| 2828 } |
| 2829 |
| 2830 test_initializer_executable_with_return_type_from_closure_field() { |
| 2831 checkLibrary(''' |
| 2832 class C { |
| 2833 var v = () => 0; |
| 2834 } |
| 2835 '''); |
| 2836 } |
| 2837 |
| 2838 test_initializer_executable_with_return_type_from_closure_local() { |
| 2839 checkLibrary(''' |
| 2840 void f() { |
| 2841 int u = 0; |
| 2842 var v = () => 0; |
| 2843 } |
| 2844 '''); |
| 2845 } |
| 2846 |
| 2817 test_library() { | 2847 test_library() { |
| 2818 checkLibrary(''); | 2848 checkLibrary(''); |
| 2819 } | 2849 } |
| 2820 | 2850 |
| 2821 test_library_documented() { | 2851 test_library_documented() { |
| 2822 checkLibrary(''' | 2852 checkLibrary(''' |
| 2823 // Extra comment so doc comment offset != 0 | 2853 // Extra comment so doc comment offset != 0 |
| 2824 /** | 2854 /** |
| 2825 * Docs | 2855 * Docs |
| 2826 */ | 2856 */ |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3298 void named({x: 1}) {} | 3328 void named({x: 1}) {} |
| 3299 '''); | 3329 '''); |
| 3300 } | 3330 } |
| 3301 | 3331 |
| 3302 test_parts() { | 3332 test_parts() { |
| 3303 addNamedSource('/a.dart', 'part of my.lib;'); | 3333 addNamedSource('/a.dart', 'part of my.lib;'); |
| 3304 addNamedSource('/b.dart', 'part of my.lib;'); | 3334 addNamedSource('/b.dart', 'part of my.lib;'); |
| 3305 checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); | 3335 checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); |
| 3306 } | 3336 } |
| 3307 | 3337 |
| 3338 test_propagated_type_refers_to_closure() { |
| 3339 checkLibrary(''' |
| 3340 void f() { |
| 3341 var x = () => 0; |
| 3342 var y = x; |
| 3343 } |
| 3344 '''); |
| 3345 } |
| 3346 |
| 3308 test_setter_documented() { | 3347 test_setter_documented() { |
| 3309 checkLibrary(''' | 3348 checkLibrary(''' |
| 3310 // Extra comment so doc comment offset != 0 | 3349 // Extra comment so doc comment offset != 0 |
| 3311 /** | 3350 /** |
| 3312 * Docs | 3351 * Docs |
| 3313 */ | 3352 */ |
| 3314 void set x(value) {}'''); | 3353 void set x(value) {}'''); |
| 3315 } | 3354 } |
| 3316 | 3355 |
| 3317 test_setter_external() { | 3356 test_setter_external() { |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3694 fail('Unexpectedly tried to get unlinked summary for $uri'); | 3733 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 3695 } | 3734 } |
| 3696 return serializedUnit; | 3735 return serializedUnit; |
| 3697 } | 3736 } |
| 3698 | 3737 |
| 3699 @override | 3738 @override |
| 3700 bool hasLibrarySummary(String uri) { | 3739 bool hasLibrarySummary(String uri) { |
| 3701 return true; | 3740 return true; |
| 3702 } | 3741 } |
| 3703 } | 3742 } |
| OLD | NEW |