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:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
(...skipping 9785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9796 } | 9796 } |
9797 | 9797 |
9798 test_metadata_fieldFormalParameter_withDefault() async { | 9798 test_metadata_fieldFormalParameter_withDefault() async { |
9799 var library = await checkLibrary( | 9799 var library = await checkLibrary( |
9800 'const a = null; class C { var x; C([@a this.x = null]); }'); | 9800 'const a = null; class C { var x; C([@a this.x = null]); }'); |
9801 if (isStrongMode) { | 9801 if (isStrongMode) { |
9802 checkElementText(library, r''' | 9802 checkElementText(library, r''' |
9803 class C { | 9803 class C { |
9804 dynamic x; | 9804 dynamic x; |
9805 C([@ | 9805 C([@ |
9806 a/*location: test.dart;a?*/ dynamic this.x = null]); | 9806 a/*location: test.dart;a?*/ dynamic this.x]); |
9807 } | 9807 } |
9808 const dynamic a = null; | 9808 const dynamic a = null; |
9809 '''); | 9809 '''); |
9810 } else { | 9810 } else { |
9811 checkElementText(library, r''' | 9811 checkElementText(library, r''' |
9812 class C { | 9812 class C { |
9813 dynamic x; | 9813 dynamic x; |
9814 C([@ | 9814 C([@ |
9815 a/*location: test.dart;a?*/ dynamic this.x = null]); | 9815 a/*location: test.dart;a?*/ dynamic this.x]); |
9816 } | 9816 } |
9817 const dynamic a = null; | 9817 const dynamic a = null; |
9818 '''); | 9818 '''); |
9819 } | 9819 } |
9820 } | 9820 } |
9821 | 9821 |
9822 test_metadata_functionDeclaration_function() async { | 9822 test_metadata_functionDeclaration_function() async { |
9823 var library = await checkLibrary(''' | 9823 var library = await checkLibrary(''' |
9824 const a = null; | 9824 const a = null; |
9825 @a | 9825 @a |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9906 '''); | 9906 '''); |
9907 } | 9907 } |
9908 } | 9908 } |
9909 | 9909 |
9910 test_metadata_functionTypedFormalParameter_withDefault() async { | 9910 test_metadata_functionTypedFormalParameter_withDefault() async { |
9911 var library = await checkLibrary('const a = null; f([@a g() = null]) {}'); | 9911 var library = await checkLibrary('const a = null; f([@a g() = null]) {}'); |
9912 if (isStrongMode) { | 9912 if (isStrongMode) { |
9913 checkElementText(library, r''' | 9913 checkElementText(library, r''' |
9914 const dynamic a = null; | 9914 const dynamic a = null; |
9915 dynamic f([@ | 9915 dynamic f([@ |
9916 a/*location: test.dart;a?*/ () → dynamic g = null]) {} | 9916 a/*location: test.dart;a?*/ () → dynamic g]) {} |
9917 '''); | 9917 '''); |
9918 } else { | 9918 } else { |
9919 checkElementText(library, r''' | 9919 checkElementText(library, r''' |
9920 const dynamic a = null; | 9920 const dynamic a = null; |
9921 dynamic f([@ | 9921 dynamic f([@ |
9922 a/*location: test.dart;a?*/ () → dynamic g = null]) {} | 9922 a/*location: test.dart;a?*/ () → dynamic g]) {} |
9923 '''); | 9923 '''); |
9924 } | 9924 } |
9925 } | 9925 } |
9926 | 9926 |
9927 test_metadata_importDirective() async { | 9927 test_metadata_importDirective() async { |
9928 addLibrarySource('/foo.dart', 'const b = null;'); | 9928 addLibrarySource('/foo.dart', 'const b = null;'); |
9929 var library = await checkLibrary('@a import "foo.dart"; const a = b;'); | 9929 var library = await checkLibrary('@a import "foo.dart"; const a = b;'); |
9930 if (isStrongMode) { | 9930 if (isStrongMode) { |
9931 checkElementText(library, r''' | 9931 checkElementText(library, r''' |
9932 @ | 9932 @ |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10148 '''); | 10148 '''); |
10149 } | 10149 } |
10150 } | 10150 } |
10151 | 10151 |
10152 test_metadata_simpleFormalParameter_withDefault() async { | 10152 test_metadata_simpleFormalParameter_withDefault() async { |
10153 var library = await checkLibrary('const a = null; f([@a x = null]) {}'); | 10153 var library = await checkLibrary('const a = null; f([@a x = null]) {}'); |
10154 if (isStrongMode) { | 10154 if (isStrongMode) { |
10155 checkElementText(library, r''' | 10155 checkElementText(library, r''' |
10156 const dynamic a = null; | 10156 const dynamic a = null; |
10157 dynamic f([@ | 10157 dynamic f([@ |
10158 a/*location: test.dart;a?*/ dynamic x = null]) {} | 10158 a/*location: test.dart;a?*/ dynamic x]) {} |
10159 '''); | 10159 '''); |
10160 } else { | 10160 } else { |
10161 checkElementText(library, r''' | 10161 checkElementText(library, r''' |
10162 const dynamic a = null; | 10162 const dynamic a = null; |
10163 dynamic f([@ | 10163 dynamic f([@ |
10164 a/*location: test.dart;a?*/ dynamic x = null]) {} | 10164 a/*location: test.dart;a?*/ dynamic x]) {} |
10165 '''); | 10165 '''); |
10166 } | 10166 } |
10167 } | 10167 } |
10168 | 10168 |
10169 test_metadata_topLevelVariableDeclaration() async { | 10169 test_metadata_topLevelVariableDeclaration() async { |
10170 var library = await checkLibrary('const a = null; @a int v;'); | 10170 var library = await checkLibrary('const a = null; @a int v;'); |
10171 if (isStrongMode) { | 10171 if (isStrongMode) { |
10172 checkElementText(library, r''' | 10172 checkElementText(library, r''' |
10173 const dynamic a = null; | 10173 const dynamic a = null; |
10174 @ | 10174 @ |
(...skipping 2995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13170 fail('Unexpectedly tried to get unlinked summary for $uri'); | 13170 fail('Unexpectedly tried to get unlinked summary for $uri'); |
13171 } | 13171 } |
13172 return serializedUnit; | 13172 return serializedUnit; |
13173 } | 13173 } |
13174 | 13174 |
13175 @override | 13175 @override |
13176 bool hasLibrarySummary(String uri) { | 13176 bool hasLibrarySummary(String uri) { |
13177 return true; | 13177 return true; |
13178 } | 13178 } |
13179 } | 13179 } |
OLD | NEW |