7
7
// Usage:
8
8
// dart gen_type_table.dart > dartfuzz_type_table.dart
9
9
//
10
+ // Reformat:
11
+ // tools/sdks/dart-sdk/bin/dartfmt -w \
12
+ // runtime/tools/dartfuzz/dartfuzz_type_table.dart
13
+ //
10
14
// Then send out modified dartfuzz_type_table.dart for review together
11
15
// with a modified dartfuzz.dart that increases the version.
12
16
@@ -20,7 +24,7 @@ import 'package:analyzer/dart/analysis/results.dart';
20
24
import 'package:analyzer/dart/analysis/session.dart' ;
21
25
import 'package:analyzer/dart/element/element.dart' ;
22
26
23
- import 'dartfuzz_util .dart' ;
27
+ import 'gen_util .dart' ;
24
28
25
29
// Minimum number of operators that are required for a type to be included in
26
30
// the type table.
@@ -478,8 +482,8 @@ void printTypeTable(Set<InterfaceType> allTypes,
478
482
479
483
String className = 'DartType${fp ? "" : "NoFp" }${flatTp ? "FlatTp" : "" }' ;
480
484
481
- print ('class $className '
482
- '${subclass ? "extends DartType" : "" } {' );
485
+ print ('class $className '
486
+ '${subclass ? " extends DartType" : "" } {' );
483
487
print (" final String name;" );
484
488
if (! subclass) {
485
489
print (" const DartType._withName(this.name);" );
@@ -537,21 +541,21 @@ void printTypeTable(Set<InterfaceType> allTypes,
537
541
}
538
542
539
543
Set<DartType> interfaces(DartType tp) {
540
- if(_interfaceRels.containsKey(tp)) {
544
+ if (_interfaceRels.containsKey(tp)) {
541
545
return _interfaceRels[tp];
542
546
}
543
547
return null;
544
548
}
545
549
546
550
DartType indexType(DartType tp) {
547
- if(_indexedBy.containsKey(tp)) {
551
+ if (_indexedBy.containsKey(tp)) {
548
552
return _indexedBy[tp];
549
553
}
550
554
return null;
551
555
}
552
556
553
557
Set<DartType> indexableElementTypes(DartType tp) {
554
- if(_indexableElementOf.containsKey(tp)) {
558
+ if (_indexableElementOf.containsKey(tp)) {
555
559
return _indexableElementOf[tp];
556
560
}
557
561
return null;
@@ -562,7 +566,7 @@ void printTypeTable(Set<InterfaceType> allTypes,
562
566
}
563
567
564
568
DartType elementType(DartType tp) {
565
- if(_subscriptsTo.containsKey(tp)) {
569
+ if (_subscriptsTo.containsKey(tp)) {
566
570
return _subscriptsTo[tp];
567
571
}
568
572
return null;
@@ -573,36 +577,36 @@ void printTypeTable(Set<InterfaceType> allTypes,
573
577
}
574
578
575
579
Set<String> uniOps(DartType tp) {
576
- if(_uniOps.containsKey(tp)) {
580
+ if (_uniOps.containsKey(tp)) {
577
581
return _uniOps[tp];
578
582
}
579
583
return <String>{};
580
584
}
581
585
582
586
Set<String> binOps(DartType tp) {
583
- if(_binOps.containsKey(tp)) {
587
+ if (_binOps.containsKey(tp)) {
584
588
return _binOps[tp].keys.toSet();
585
589
}
586
590
return <String>{};
587
591
}
588
592
589
593
Set<List<DartType>> binOpParameters(DartType tp, String op) {
590
- if(_binOps.containsKey(tp) &&
594
+ if (_binOps.containsKey(tp) &&
591
595
_binOps[tp].containsKey(op)) {
592
596
return _binOps[tp][op];
593
597
}
594
598
return null;
595
599
}
596
600
597
601
Set<String> assignOps(DartType tp) {
598
- if(_assignOps.containsKey(tp)) {
602
+ if (_assignOps.containsKey(tp)) {
599
603
return _assignOps[tp].keys.toSet();
600
604
}
601
605
return <String>{};
602
606
}
603
607
604
608
Set<DartType> assignOpRhs(DartType tp, String op) {
605
- if(_assignOps.containsKey(tp) &&
609
+ if (_assignOps.containsKey(tp) &&
606
610
_assignOps[tp].containsKey(op)) {
607
611
return _assignOps[tp][op];
608
612
}
@@ -614,14 +618,14 @@ void printTypeTable(Set<InterfaceType> allTypes,
614
618
}
615
619
616
620
Set<String> constructors(DartType tp) {
617
- if(_constructors.containsKey(tp)) {
621
+ if (_constructors.containsKey(tp)) {
618
622
return _constructors[tp].keys.toSet();
619
623
}
620
624
return <String>{};
621
625
}
622
626
623
627
List<DartType> constructorParameters(DartType tp, String constructor) {
624
- if(_constructors.containsKey(tp) &&
628
+ if (_constructors.containsKey(tp) &&
625
629
_constructors[tp].containsKey(constructor)) {
626
630
return _constructors[tp][constructor];
627
631
}
@@ -1198,7 +1202,7 @@ int countOperators(ClassElement ce) {
1198
1202
1199
1203
// Analyze typed_data and core libraries to extract data types.
1200
1204
void getDataTypes (Set <InterfaceType > allTypes, String dartTop) async {
1201
- final AnalysisSession session = DartFuzzUtil .createAnalysisSession (dartTop);
1205
+ final AnalysisSession session = GenUtil .createAnalysisSession (dartTop);
1202
1206
1203
1207
// Visit libraries for type table generation.
1204
1208
await visitLibraryAtUri (session, 'dart:typed_data' , allTypes);
@@ -1298,7 +1302,7 @@ main(List<String> arguments) async {
1298
1302
'exponentially with this, ' +
1299
1303
'therefore types with higher nesting ' +
1300
1304
'depth are partially filtered.' ,
1301
- defaultsTo: '0 ' );
1305
+ defaultsTo: '1 ' );
1302
1306
try {
1303
1307
final results = parser.parse (arguments);
1304
1308
int depth = int .parse (results['depth' ]);
0 commit comments