Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 000c34b

Browse files
committed
make api_conform_test.dart non-nullable
1 parent f8cb768 commit 000c34b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/ui/channel_buffers.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ class _RingBuffer<T> {
7171
int result = 0;
7272
while (_queue.length > lengthLimit) {
7373
final T item = _queue.removeFirst();
74-
if (_dropItemCallback != null) {
75-
_dropItemCallback!(item);
76-
}
74+
_dropItemCallback?.call(item);
7775
result += 1;
7876
}
7977
return result;

web_sdk/test/api_conform_test.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import 'dart:io';
66

77
import 'package:analyzer/analyzer.dart';
8+
import 'package:analyzer/dart/analysis/features.dart';
89

910
// Ignore members defined on Object.
1011
const Set<String> _kObjectMembers = <String>{
@@ -15,16 +16,17 @@ const Set<String> _kObjectMembers = <String>{
1516

1617
void main() {
1718
// These files just contain imports to the part files;
19+
final FeatureSet analyzerFeatures = FeatureSet.fromEnableFlags(<String>['non-nullable']);
1820
final CompilationUnit uiUnit = parseDartFile('lib/ui/ui.dart',
19-
parseFunctionBodies: false, suppressErrors: false);
21+
parseFunctionBodies: false, suppressErrors: false, featureSet: analyzerFeatures);
2022
final CompilationUnit webUnit = parseDartFile('lib/web_ui/lib/ui.dart',
2123
parseFunctionBodies: false, suppressErrors: false);
2224
final Map<String, ClassDeclaration> uiClasses = <String, ClassDeclaration>{};
2325
final Map<String, ClassDeclaration> webClasses = <String, ClassDeclaration>{};
2426

2527
// Gather all public classes from each library. For now we are skiping
2628
// other top level members.
27-
_collectPublicClasses(uiUnit, uiClasses, 'lib/ui/');
29+
_collectPublicClasses(uiUnit, uiClasses, 'lib/ui/', analyzerFeatures: analyzerFeatures);
2830
_collectPublicClasses(webUnit, webClasses, 'lib/web_ui/lib/');
2931

3032
if (uiClasses.isEmpty || webClasses.isEmpty) {
@@ -179,7 +181,7 @@ void main() {
179181

180182
// Collects all public classes defined by the part files of [unit].
181183
void _collectPublicClasses(CompilationUnit unit,
182-
Map<String, ClassDeclaration> destination, String root) {
184+
Map<String, ClassDeclaration> destination, String root, {FeatureSet analyzerFeatures}) {
183185
for (Directive directive in unit.directives) {
184186
if (directive is! PartDirective) {
185187
continue;
@@ -190,6 +192,7 @@ void _collectPublicClasses(CompilationUnit unit,
190192
'$root${literalUri.substring(1, literalUri.length - 1)}',
191193
parseFunctionBodies: false,
192194
suppressErrors: false,
195+
featureSet: analyzerFeatures,
193196
);
194197
for (CompilationUnitMember member in subUnit.declarations) {
195198
if (member is! ClassDeclaration) {

0 commit comments

Comments
 (0)