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/constant/value.dart'; | 10 import 'package:analyzer/dart/constant/value.dart'; |
(...skipping 4089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4100 } | 4100 } |
4101 | 4101 |
4102 test_operator_index_set() { | 4102 test_operator_index_set() { |
4103 checkLibrary('class C { void operator[]=(int i, bool v) {} }'); | 4103 checkLibrary('class C { void operator[]=(int i, bool v) {} }'); |
4104 } | 4104 } |
4105 | 4105 |
4106 test_operator_less_equal() { | 4106 test_operator_less_equal() { |
4107 checkLibrary('class C { bool operator<=(C other) => false; }'); | 4107 checkLibrary('class C { bool operator<=(C other) => false; }'); |
4108 } | 4108 } |
4109 | 4109 |
4110 test_parameterTypeNotInferred_constructor() { | 4110 test_parameterType_inferred_constructor() { |
4111 // Strong mode doesn't do type inference on constructor parameters, so it's | |
4112 // ok that we don't store inferred type info for them in summaries. | |
4113 checkLibrary(''' | 4111 checkLibrary(''' |
4114 class C { | 4112 class C { |
4115 C.positional([x = 1]); | 4113 C.positional([x = 1]); |
4116 C.named({x: 1}); | 4114 C.named({x: 1}); |
4117 } | 4115 } |
4118 '''); | 4116 '''); |
4119 } | 4117 } |
4120 | 4118 |
4121 test_parameterTypeNotInferred_initializingFormal() { | 4119 test_parameterType_inferred_staticMethod() { |
4122 // Strong mode doesn't do type inference on initializing formals, so it's | |
4123 // ok that we don't store inferred type info for them in summaries. | |
4124 checkLibrary(''' | |
4125 class C { | |
4126 var x; | |
4127 C.positional([this.x = 1]); | |
4128 C.named({this.x: 1}); | |
4129 } | |
4130 '''); | |
4131 } | |
4132 | |
4133 test_parameterTypeNotInferred_staticMethod() { | |
4134 // Strong mode doesn't do type inference on parameters of static methods, | |
4135 // so it's ok that we don't store inferred type info for them in summaries. | |
4136 checkLibrary(''' | 4120 checkLibrary(''' |
4137 class C { | 4121 class C { |
4138 static void positional([x = 1]) {} | 4122 static void positional([x = 1]) {} |
4139 static void named({x: 1}) {} | 4123 static void named({x: 1}) {} |
4140 } | 4124 } |
4141 '''); | 4125 '''); |
4142 } | 4126 } |
4143 | 4127 |
4144 test_parameterTypeNotInferred_topLevelFunction() { | 4128 test_parameterType_inferred_topLevelFunction() { |
4145 // Strong mode doesn't do type inference on parameters of top level | |
4146 // functions, so it's ok that we don't store inferred type info for them in | |
4147 // summaries. | |
4148 checkLibrary(''' | 4129 checkLibrary(''' |
4149 void positional([x = 1]) {} | 4130 void positional([x = 1]) {} |
4150 void named({x: 1}) {} | 4131 void named({x: 1}) {} |
4151 '''); | 4132 '''); |
4152 } | 4133 } |
4153 | 4134 |
| 4135 test_parameterTypeNotInferred_initializingFormal() { |
| 4136 // Strong mode doesn't do type inference on initializing formals, so it's |
| 4137 // ok that we don't store inferred type info for them in summaries. |
| 4138 checkLibrary(''' |
| 4139 class C { |
| 4140 var x; |
| 4141 C.positional([this.x = 1]); |
| 4142 C.named({this.x: 1}); |
| 4143 } |
| 4144 '''); |
| 4145 } |
| 4146 |
4154 test_parts() { | 4147 test_parts() { |
4155 addSource('/a.dart', 'part of my.lib;'); | 4148 addSource('/a.dart', 'part of my.lib;'); |
4156 addSource('/b.dart', 'part of my.lib;'); | 4149 addSource('/b.dart', 'part of my.lib;'); |
4157 checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); | 4150 checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); |
4158 } | 4151 } |
4159 | 4152 |
4160 test_propagated_type_refers_to_closure() { | 4153 test_propagated_type_refers_to_closure() { |
4161 checkLibrary(''' | 4154 checkLibrary(''' |
4162 void f() { | 4155 void f() { |
4163 var x = () => 0; | 4156 var x = () => 0; |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4619 fail('Unexpectedly tried to get unlinked summary for $uri'); | 4612 fail('Unexpectedly tried to get unlinked summary for $uri'); |
4620 } | 4613 } |
4621 return serializedUnit; | 4614 return serializedUnit; |
4622 } | 4615 } |
4623 | 4616 |
4624 @override | 4617 @override |
4625 bool hasLibrarySummary(String uri) { | 4618 bool hasLibrarySummary(String uri) { |
4626 return true; | 4619 return true; |
4627 } | 4620 } |
4628 } | 4621 } |
OLD | NEW |