55import 'dart:io' ;
66
77import 'package:analyzer/analyzer.dart' ;
8+ import 'package:analyzer/dart/analysis/features.dart' ;
89
910// Ignore members defined on Object.
1011const Set <String > _kObjectMembers = < String > {
@@ -15,16 +16,17 @@ const Set<String> _kObjectMembers = <String>{
1516
1617void 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].
181183void _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