| 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 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3144 } | 3144 } |
| 3145 | 3145 |
| 3146 test_operator_index_set() { | 3146 test_operator_index_set() { |
| 3147 checkLibrary('class C { void operator[]=(int i, bool v) {} }'); | 3147 checkLibrary('class C { void operator[]=(int i, bool v) {} }'); |
| 3148 } | 3148 } |
| 3149 | 3149 |
| 3150 test_operator_less_equal() { | 3150 test_operator_less_equal() { |
| 3151 checkLibrary('class C { bool operator<=(C other) => false; }'); | 3151 checkLibrary('class C { bool operator<=(C other) => false; }'); |
| 3152 } | 3152 } |
| 3153 | 3153 |
| 3154 test_parameterTypeNotInferred_constructor() { |
| 3155 // Strong mode doesn't do type inference on constructor parameters, so it's |
| 3156 // ok that we don't store inferred type info for them in summaries. |
| 3157 checkLibrary(''' |
| 3158 class C { |
| 3159 C.positional([x = 1]); |
| 3160 C.named({x: 1}); |
| 3161 } |
| 3162 '''); |
| 3163 } |
| 3164 |
| 3165 test_parameterTypeNotInferred_initializingFormal() { |
| 3166 // Strong mode doesn't do type inference on initializing formals, so it's |
| 3167 // ok that we don't store inferred type info for them in summaries. |
| 3168 checkLibrary(''' |
| 3169 class C { |
| 3170 var x; |
| 3171 C.positional([this.x = 1]); |
| 3172 C.named({this.x: 1}); |
| 3173 } |
| 3174 '''); |
| 3175 } |
| 3176 |
| 3177 test_parameterTypeNotInferred_staticMethod() { |
| 3178 // Strong mode doesn't do type inference on parameters of static methods, |
| 3179 // so it's ok that we don't store inferred type info for them in summaries. |
| 3180 checkLibrary(''' |
| 3181 class C { |
| 3182 static void positional([x = 1]) {} |
| 3183 static void named({x: 1}) {} |
| 3184 } |
| 3185 '''); |
| 3186 } |
| 3187 |
| 3188 test_parameterTypeNotInferred_topLevelFunction() { |
| 3189 // Strong mode doesn't do type inference on parameters of top level |
| 3190 // functions, so it's ok that we don't store inferred type info for them in |
| 3191 // summaries. |
| 3192 checkLibrary(''' |
| 3193 void positional([x = 1]) {} |
| 3194 void named({x: 1}) {} |
| 3195 '''); |
| 3196 } |
| 3197 |
| 3154 test_parts() { | 3198 test_parts() { |
| 3155 addNamedSource('/a.dart', 'part of my.lib;'); | 3199 addNamedSource('/a.dart', 'part of my.lib;'); |
| 3156 addNamedSource('/b.dart', 'part of my.lib;'); | 3200 addNamedSource('/b.dart', 'part of my.lib;'); |
| 3157 checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); | 3201 checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); |
| 3158 } | 3202 } |
| 3159 | 3203 |
| 3160 test_setter_documented() { | 3204 test_setter_documented() { |
| 3161 checkLibrary(''' | 3205 checkLibrary(''' |
| 3162 // Extra comment so doc comment offset != 0 | 3206 // Extra comment so doc comment offset != 0 |
| 3163 /** | 3207 /** |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3546 fail('Unexpectedly tried to get unlinked summary for $uri'); | 3590 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 3547 } | 3591 } |
| 3548 return serializedUnit; | 3592 return serializedUnit; |
| 3549 } | 3593 } |
| 3550 | 3594 |
| 3551 @override | 3595 @override |
| 3552 bool hasLibrarySummary(String uri) { | 3596 bool hasLibrarySummary(String uri) { |
| 3553 return true; | 3597 return true; |
| 3554 } | 3598 } |
| 3555 } | 3599 } |
| OLD | NEW |