@@ -114,7 +114,7 @@ abstract class _Invocation extends _DependencyTracker
114
114
/// Result type may be saturated if this invocation was invalidated
115
115
/// too many times.
116
116
void setResult (TypeFlowAnalysis typeFlowAnalysis, Type type) {
117
- assertx (type != null );
117
+ assert (type != null );
118
118
result = type;
119
119
120
120
if (invalidatedResult != null ) {
@@ -204,7 +204,7 @@ class _DirectInvocation extends _Invocation {
204
204
205
205
@override
206
206
Type process (TypeFlowAnalysis typeFlowAnalysis) {
207
- assertx (typeFlowAnalysis.currentInvocation == this );
207
+ assert (typeFlowAnalysis.currentInvocation == this );
208
208
209
209
if (selector.member is Field ) {
210
210
return _processField (typeFlowAnalysis);
@@ -220,16 +220,16 @@ class _DirectInvocation extends _Invocation {
220
220
221
221
switch (selector.callKind) {
222
222
case CallKind .PropertyGet :
223
- assertx (args.values.length == firstParamIndex);
224
- assertx (args.names.isEmpty);
223
+ assert (args.values.length == firstParamIndex);
224
+ assert (args.names.isEmpty);
225
225
fieldValue.isGetterUsed = true ;
226
226
return fieldValue.getValue (
227
227
typeFlowAnalysis, field.isStatic ? null : args.values[0 ]);
228
228
229
229
case CallKind .PropertySet :
230
230
case CallKind .SetFieldInConstructor :
231
- assertx (args.values.length == firstParamIndex + 1 );
232
- assertx (args.names.isEmpty);
231
+ assert (args.values.length == firstParamIndex + 1 );
232
+ assert (args.names.isEmpty);
233
233
if (selector.callKind == CallKind .PropertySet ) {
234
234
fieldValue.isSetterUsed = true ;
235
235
}
@@ -253,8 +253,8 @@ class _DirectInvocation extends _Invocation {
253
253
return new Type .nullableAny ();
254
254
255
255
case CallKind .FieldInitializer :
256
- assertx (args.values.length == firstParamIndex);
257
- assertx (args.names.isEmpty);
256
+ assert (args.values.length == firstParamIndex);
257
+ assert (args.names.isEmpty);
258
258
Type initializerResult = typeFlowAnalysis
259
259
.getSummary (field)
260
260
.apply (args, typeFlowAnalysis.hierarchyCache, typeFlowAnalysis);
@@ -290,27 +290,27 @@ class _DirectInvocation extends _Invocation {
290
290
final summaryResult = summary.result;
291
291
if (summaryResult is Type &&
292
292
! typeFlowAnalysis.workList._isPending (this )) {
293
- assertx (result == null || result == summaryResult);
293
+ assert (result == null || result == summaryResult);
294
294
setResult (typeFlowAnalysis, summaryResult);
295
295
}
296
296
return summary.apply (
297
297
args, typeFlowAnalysis.hierarchyCache, typeFlowAnalysis);
298
298
} else {
299
- assertx (selector.callKind == CallKind .Method );
299
+ assert (selector.callKind == CallKind .Method );
300
300
return _processNoSuchMethod (args.receiver, typeFlowAnalysis);
301
301
}
302
302
} else {
303
303
if (selector.callKind == CallKind .PropertyGet ) {
304
304
// Tear-off.
305
305
// TODO(alexmarkov): capture receiver type
306
- assertx ((member is Procedure ) && ! member.isGetter && ! member.isSetter);
306
+ assert ((member is Procedure ) && ! member.isGetter && ! member.isSetter);
307
307
typeFlowAnalysis.addRawCall (new DirectSelector (member));
308
308
typeFlowAnalysis._tearOffTaken.add (member);
309
309
return new Type .nullableAny ();
310
310
} else {
311
311
// Call via getter.
312
312
// TODO(alexmarkov): capture receiver type
313
- assertx ((selector.callKind == CallKind .Method ) &&
313
+ assert ((selector.callKind == CallKind .Method ) &&
314
314
(member is Procedure ) &&
315
315
member.isGetter);
316
316
typeFlowAnalysis.addRawCall (
@@ -325,7 +325,7 @@ class _DirectInvocation extends _Invocation {
325
325
326
326
bool _argumentsValid () {
327
327
final function = selector.member.function;
328
- assertx (function != null );
328
+ assert (function != null );
329
329
330
330
final int positionalArguments = args.positionalCount;
331
331
@@ -378,12 +378,12 @@ class _DispatchableInvocation extends _Invocation {
378
378
379
379
_DispatchableInvocation (Selector selector, Args <Type > args)
380
380
: super (selector, args) {
381
- assertx (selector is ! DirectSelector );
381
+ assert (selector is ! DirectSelector );
382
382
}
383
383
384
384
@override
385
385
Type process (TypeFlowAnalysis typeFlowAnalysis) {
386
- assertx (typeFlowAnalysis.currentInvocation == this );
386
+ assert (typeFlowAnalysis.currentInvocation == this );
387
387
388
388
// Collect all possible targets for this invocation,
389
389
// along with more accurate receiver types for each target.
@@ -415,7 +415,7 @@ class _DispatchableInvocation extends _Invocation {
415
415
416
416
if (target == kNoSuchMethodMarker) {
417
417
// Non-dynamic call-sites must hit NSM-forwarders in Dart 2.
418
- assertx (selector is DynamicSelector );
418
+ assert (selector is DynamicSelector );
419
419
type = _processNoSuchMethod (receiver, typeFlowAnalysis);
420
420
} else {
421
421
final directSelector =
@@ -430,7 +430,7 @@ class _DispatchableInvocation extends _Invocation {
430
430
.getInvocation (directSelector, directArgs);
431
431
432
432
if (! _isPolymorphic) {
433
- assertx (target == _monomorphicTarget);
433
+ assert (target == _monomorphicTarget);
434
434
_monomorphicDirectInvocation = directInvocation;
435
435
}
436
436
@@ -479,20 +479,20 @@ class _DispatchableInvocation extends _Invocation {
479
479
Type receiver,
480
480
Map <Member , _ReceiverTypeBuilder > targets,
481
481
TypeFlowAnalysis typeFlowAnalysis) {
482
- assertx (receiver != const EmptyType ()); // should be filtered earlier
482
+ assert (receiver != const EmptyType ()); // should be filtered earlier
483
483
484
484
final bool isNullableReceiver = receiver is NullableType ;
485
485
if (isNullableReceiver) {
486
486
receiver = (receiver as NullableType ).baseType;
487
- assertx (receiver is ! NullableType );
487
+ assert (receiver is ! NullableType );
488
488
}
489
489
490
490
if (selector is InterfaceSelector ) {
491
491
final staticReceiverType = new ConeType (typeFlowAnalysis.hierarchyCache
492
492
.getTFClass (selector.member.enclosingClass));
493
493
receiver = receiver.intersection (
494
494
staticReceiverType, typeFlowAnalysis.hierarchyCache);
495
- assertx (receiver is ! NullableType );
495
+ assert (receiver is ! NullableType );
496
496
497
497
if (kPrintTrace) {
498
498
tracePrint ("Narrowed down receiver type: $receiver " );
@@ -507,7 +507,7 @@ class _DispatchableInvocation extends _Invocation {
507
507
.specializeTypeCone ((receiver as ConeType ).cls);
508
508
}
509
509
510
- assertx (targets.isEmpty);
510
+ assert (targets.isEmpty);
511
511
512
512
if (receiver is ConcreteType ) {
513
513
_collectTargetsForConcreteType (receiver, targets, typeFlowAnalysis);
@@ -518,7 +518,7 @@ class _DispatchableInvocation extends _Invocation {
518
518
} else if (receiver is AnyType ) {
519
519
_collectTargetsForSelector (targets, typeFlowAnalysis);
520
520
} else {
521
- assertx (receiver is EmptyType );
521
+ assert (receiver is EmptyType );
522
522
}
523
523
524
524
if (isNullableReceiver) {
@@ -585,8 +585,8 @@ class _DispatchableInvocation extends _Invocation {
585
585
if (selector is InterfaceSelector ) {
586
586
// TODO(alexmarkov): support generic types and make sure inferred types
587
587
// are always same or better than static types.
588
- // assertx (selector.member.enclosingClass ==
589
- // _typeFlowAnalysis.environment.coreTypes.objectClass, details: selector );
588
+ // assert (selector.member.enclosingClass ==
589
+ // _typeFlowAnalysis.environment.coreTypes.objectClass);
590
590
selector = new DynamicSelector (selector.callKind, selector.name);
591
591
}
592
592
@@ -596,7 +596,7 @@ class _DispatchableInvocation extends _Invocation {
596
596
597
597
dynamicTargetSet.addDependentInvocation (this );
598
598
599
- assertx (targets.isEmpty);
599
+ assert (targets.isEmpty);
600
600
for (Member target in dynamicTargetSet.targets) {
601
601
_getReceiverTypeBuilder (targets, target).addType (receiver);
602
602
}
@@ -624,8 +624,8 @@ class _DispatchableInvocation extends _Invocation {
624
624
}
625
625
626
626
void _setMonomorphicTarget (Member target) {
627
- assertx (! _isPolymorphic);
628
- assertx ((_monomorphicTarget == null ) || (_monomorphicTarget == target));
627
+ assert (! _isPolymorphic);
628
+ assert ((_monomorphicTarget == null ) || (_monomorphicTarget == target));
629
629
_monomorphicTarget = target;
630
630
631
631
_notifyCallSites ();
@@ -693,23 +693,23 @@ class _ReceiverTypeBuilder {
693
693
return ;
694
694
}
695
695
696
- assertx (_type is ConcreteType );
697
- assertx (_type != type);
696
+ assert (_type is ConcreteType );
697
+ assert (_type != type);
698
698
699
699
_list = new List <ConcreteType >();
700
700
_list.add (_type);
701
701
702
702
_type = null ;
703
703
}
704
704
705
- assertx (_list.last.cls.id < type.cls.id);
705
+ assert (_list.last.cls.id < type.cls.id);
706
706
_list.add (type);
707
707
}
708
708
709
709
/// Appends an arbitrary Type. May be called only once.
710
710
/// Should not be used in conjunction with [addConcreteType] .
711
711
void addType (Type type) {
712
- assertx (_type == null && _list == null );
712
+ assert (_type == null && _list == null );
713
713
_type = type;
714
714
}
715
715
@@ -728,7 +728,7 @@ class _ReceiverTypeBuilder {
728
728
t = new SetType (_list);
729
729
}
730
730
} else {
731
- assertx (_list == null );
731
+ assert (_list == null );
732
732
}
733
733
734
734
if (_nullable) {
@@ -797,7 +797,7 @@ class _InvocationsCache {
797
797
}
798
798
799
799
bool added = _invocations.add (invocation);
800
- assertx (added);
800
+ assert (added);
801
801
++ Statistics .invocationsAddedToCache;
802
802
return invocation;
803
803
}
@@ -833,7 +833,7 @@ class _FieldValue extends _DependencyTracker {
833
833
}
834
834
835
835
final enclosingClass = field.enclosingClass;
836
- assertx (enclosingClass != null );
836
+ assert (enclosingClass != null );
837
837
838
838
// Default value is not observable if every generative constructor
839
839
// is redirecting or initializes the field.
@@ -851,7 +851,7 @@ class _FieldValue extends _DependencyTracker {
851
851
852
852
void ensureInitialized (TypeFlowAnalysis typeFlowAnalysis, Type receiverType) {
853
853
if (field.initializer != null ) {
854
- assertx (field.isStatic == (receiverType == null ));
854
+ assert (field.isStatic == (receiverType == null ));
855
855
final args = ! field.isStatic ? < Type > [receiverType] : const < Type > [];
856
856
final initializerInvocation = typeFlowAnalysis._invocationsCache
857
857
.getInvocation (
@@ -908,7 +908,7 @@ class _FieldValue extends _DependencyTracker {
908
908
: newValue.specialize (hierarchy).intersection (staticType, hierarchy);
909
909
Type newType =
910
910
value.union (narrowedNewValue, hierarchy).specialize (hierarchy);
911
- assertx (newType.isSpecialized);
911
+ assert (newType.isSpecialized);
912
912
913
913
if (newType != value) {
914
914
if (kPrintTrace) {
@@ -1038,7 +1038,7 @@ class GenericInterfacesInfoImpl implements GenericInterfacesInfo {
1038
1038
result = new List <Type >(flattenedTypeArgs.length);
1039
1039
for (int i = 0 ; i < flattenedTypeArgs.length; ++ i) {
1040
1040
final translated = closedTypeTranslator.translate (flattenedTypeArgs[i]);
1041
- assertx (translated is RuntimeType || translated is UnknownType );
1041
+ assert (translated is RuntimeType || translated is UnknownType );
1042
1042
result[i] = translated;
1043
1043
}
1044
1044
cachedFlattenedTypeArgsForNonGeneric[klass] = result;
@@ -1076,7 +1076,7 @@ class _ClassHierarchyCache extends TypeHierarchy {
1076
1076
: objectNoSuchMethod = hierarchy.getDispatchTarget (
1077
1077
environment.coreTypes.objectClass, noSuchMethodName),
1078
1078
super (environment.coreTypes, nullSafety) {
1079
- assertx (objectNoSuchMethod != null );
1079
+ assert (objectNoSuchMethod != null );
1080
1080
}
1081
1081
1082
1082
@override
@@ -1093,8 +1093,8 @@ class _ClassHierarchyCache extends TypeHierarchy {
1093
1093
}
1094
1094
1095
1095
ConcreteType addAllocatedClass (Class cl) {
1096
- assertx (! cl.isAbstract);
1097
- assertx (! _sealed);
1096
+ assert (! cl.isAbstract);
1097
+ assert (! _sealed);
1098
1098
1099
1099
final _TFClassImpl classImpl = getTFClass (cl);
1100
1100
@@ -1187,7 +1187,7 @@ class _ClassHierarchyCache extends TypeHierarchy {
1187
1187
}
1188
1188
1189
1189
void _addDynamicTarget (Class c, _DynamicTargetSet targetSet) {
1190
- assertx (! _sealed);
1190
+ assert (! _sealed);
1191
1191
final selector = targetSet.selector;
1192
1192
final member = hierarchy.getDispatchTarget (c, selector.name,
1193
1193
setter: selector.isSetter);
@@ -1238,19 +1238,19 @@ class _WorkList {
1238
1238
bool _isPending (_Invocation invocation) => invocation.list != null ;
1239
1239
1240
1240
void enqueueInvocation (_Invocation invocation) {
1241
- assertx (invocation.result == null );
1241
+ assert (invocation.result == null );
1242
1242
if (_isPending (invocation)) {
1243
1243
// Re-add the invocation to the tail of the pending queue.
1244
1244
pending.remove (invocation);
1245
- assertx (! _isPending (invocation));
1245
+ assert (! _isPending (invocation));
1246
1246
}
1247
1247
pending.add (invocation);
1248
1248
}
1249
1249
1250
1250
void invalidateInvocation (_Invocation invocation) {
1251
1251
Statistics .invocationsInvalidated++ ;
1252
1252
if (invocation.result != null ) {
1253
- assertx (invocation.invalidatedResult == null );
1253
+ assert (invocation.invalidatedResult == null );
1254
1254
invocation.invalidatedResult = invocation.result;
1255
1255
invocation.result = null ;
1256
1256
}
@@ -1267,7 +1267,7 @@ class _WorkList {
1267
1267
}
1268
1268
// Protobuf handler replaced contents of static field initializers.
1269
1269
for (var field in fields) {
1270
- assertx (field.isStatic);
1270
+ assert (field.isStatic);
1271
1271
// Reset summary in order to rebuild it.
1272
1272
_typeFlowAnalysis._summaries[field] = null ;
1273
1273
// Invalidate (and enqueue) field initializer invocation.
@@ -1285,7 +1285,7 @@ class _WorkList {
1285
1285
if (pending.isEmpty && ! invalidateProtobufFields ()) {
1286
1286
break ;
1287
1287
}
1288
- assertx (callStack.isEmpty && processing.isEmpty);
1288
+ assert (callStack.isEmpty && processing.isEmpty);
1289
1289
Statistics .iterationsOverInvocationsWorkList++ ;
1290
1290
processInvocation (pending.first);
1291
1291
}
@@ -1328,9 +1328,9 @@ class _WorkList {
1328
1328
// same result.
1329
1329
invocation.typeChecksNeeded = true ;
1330
1330
invalidateInvocation (invocation);
1331
- assertx (invocation.result == null );
1332
- assertx (invocation.invalidatedResult != null );
1333
- assertx (_isPending (invocation));
1331
+ assert (invocation.result == null );
1332
+ assert (invocation.invalidatedResult != null );
1333
+ assert (_isPending (invocation));
1334
1334
if (kPrintTrace) {
1335
1335
tracePrint ("Processing deferred due to deep call stack." );
1336
1336
tracePrint (
@@ -1360,7 +1360,7 @@ class _WorkList {
1360
1360
}
1361
1361
1362
1362
final last = callStack.removeLast ();
1363
- assertx (identical (last, invocation));
1363
+ assert (identical (last, invocation));
1364
1364
1365
1365
processing.remove (invocation);
1366
1366
@@ -1580,7 +1580,7 @@ class TypeFlowAnalysis implements EntryPointsListener, CallHandler {
1580
1580
1581
1581
return workList.processInvocation (invocation);
1582
1582
} else {
1583
- assertx (! isResultUsed);
1583
+ assert (! isResultUsed);
1584
1584
1585
1585
if (invocation.result == null ) {
1586
1586
workList.enqueueInvocation (invocation);
@@ -1613,7 +1613,7 @@ class TypeFlowAnalysis implements EntryPointsListener, CallHandler {
1613
1613
if (kPrintDebug) {
1614
1614
debugPrint ("ADD RAW CALL: $selector " );
1615
1615
}
1616
- assertx (selector is ! DynamicSelector ); // TODO(alexmarkov)
1616
+ assert (selector is ! DynamicSelector ); // TODO(alexmarkov)
1617
1617
1618
1618
applyCall (null , selector, summaryCollector.rawArguments (selector),
1619
1619
isResultUsed: false , processImmediately: false );
0 commit comments