2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
- // @dart = 2.10
6
-
7
5
library js_backend.backend.annotations;
8
6
9
7
import 'package:kernel/ast.dart' as ir;
@@ -14,7 +12,7 @@ import '../ir/annotations.dart';
14
12
import '../ir/util.dart' ;
15
13
import '../kernel/dart2js_target.dart' ;
16
14
import '../options.dart' ;
17
- import '../serialization/serialization .dart' ;
15
+ import '../serialization/serialization_interfaces .dart' ;
18
16
import '../util/enumset.dart' ;
19
17
20
18
class PragmaAnnotation {
@@ -213,7 +211,7 @@ EnumSet<PragmaAnnotation> processMemberAnnotations(
213
211
Map <PragmaAnnotation , EnumSet <PragmaAnnotation >> reportedExclusions = {};
214
212
for (PragmaAnnotation annotation
215
213
in annotations.iterable (PragmaAnnotation .values)) {
216
- Set <PragmaAnnotation > implies = PragmaAnnotation .implies[annotation];
214
+ Set <PragmaAnnotation >? implies = PragmaAnnotation .implies[annotation];
217
215
if (implies != null ) {
218
216
for (PragmaAnnotation other in implies) {
219
217
if (annotations.contains (other)) {
@@ -225,7 +223,7 @@ EnumSet<PragmaAnnotation> processMemberAnnotations(
225
223
}
226
224
}
227
225
}
228
- Set <PragmaAnnotation > excludes = PragmaAnnotation .excludes[annotation];
226
+ Set <PragmaAnnotation >? excludes = PragmaAnnotation .excludes[annotation];
229
227
if (excludes != null ) {
230
228
for (PragmaAnnotation other in excludes) {
231
229
if (annotations.contains (other) &&
@@ -239,7 +237,7 @@ EnumSet<PragmaAnnotation> processMemberAnnotations(
239
237
}
240
238
}
241
239
}
242
- Set <PragmaAnnotation > requires = PragmaAnnotation .requires[annotation];
240
+ Set <PragmaAnnotation >? requires = PragmaAnnotation .requires[annotation];
243
241
if (requires != null ) {
244
242
for (PragmaAnnotation other in requires) {
245
243
if (! annotations.contains (other)) {
@@ -309,30 +307,30 @@ abstract class AnnotationsData {
309
307
/// What should the compiler do with parameter type assertions in [member] .
310
308
///
311
309
/// If [member] is `null` , the default policy is returned.
312
- CheckPolicy getParameterCheckPolicy (MemberEntity member);
310
+ CheckPolicy getParameterCheckPolicy (MemberEntity ? member);
313
311
314
312
/// What should the compiler do with implicit downcasts in [member] .
315
313
///
316
314
/// If [member] is `null` , the default policy is returned.
317
- CheckPolicy getImplicitDowncastCheckPolicy (MemberEntity member);
315
+ CheckPolicy getImplicitDowncastCheckPolicy (MemberEntity ? member);
318
316
319
317
/// What the compiler should do with a boolean value in a condition context
320
318
/// in [member] when the language specification says it is a runtime error for
321
319
/// it to be null.
322
320
///
323
321
/// If [member] is `null` , the default policy is returned.
324
- CheckPolicy getConditionCheckPolicy (MemberEntity member);
322
+ CheckPolicy getConditionCheckPolicy (MemberEntity ? member);
325
323
326
324
/// Whether should the compiler do with explicit casts in [member] .
327
325
///
328
326
/// If [member] is `null` , the default policy is returned.
329
- CheckPolicy getExplicitCastCheckPolicy (MemberEntity member);
327
+ CheckPolicy getExplicitCastCheckPolicy (MemberEntity ? member);
330
328
331
329
/// What should the compiler do with index bounds checks `[]` , `[]=` and
332
330
/// `removeLast()` operations in the body of [member] .
333
331
///
334
332
/// If [member] is `null` , the default policy is returned.
335
- CheckPolicy getIndexBoundsCheckPolicy (MemberEntity member);
333
+ CheckPolicy getIndexBoundsCheckPolicy (MemberEntity ? member);
336
334
}
337
335
338
336
class AnnotationsDataImpl implements AnnotationsData {
@@ -378,7 +376,7 @@ class AnnotationsDataImpl implements AnnotationsData {
378
376
}
379
377
380
378
bool _hasPragma (MemberEntity member, PragmaAnnotation annotation) {
381
- EnumSet <PragmaAnnotation > set = pragmaAnnotations[member];
379
+ EnumSet <PragmaAnnotation >? set = pragmaAnnotations[member];
382
380
return set != null && set .contains (annotation);
383
381
}
384
382
@@ -415,7 +413,7 @@ class AnnotationsDataImpl implements AnnotationsData {
415
413
pragmaAnnotations
416
414
.forEach ((MemberEntity member, EnumSet <PragmaAnnotation > set ) {
417
415
if (set .contains (PragmaAnnotation .noInline)) {
418
- f (member);
416
+ f (member as FunctionEntity );
419
417
}
420
418
});
421
419
}
@@ -425,7 +423,7 @@ class AnnotationsDataImpl implements AnnotationsData {
425
423
pragmaAnnotations
426
424
.forEach ((MemberEntity member, EnumSet <PragmaAnnotation > set ) {
427
425
if (set .contains (PragmaAnnotation .tryInline)) {
428
- f (member);
426
+ f (member as FunctionEntity );
429
427
}
430
428
});
431
429
}
@@ -435,7 +433,7 @@ class AnnotationsDataImpl implements AnnotationsData {
435
433
pragmaAnnotations
436
434
.forEach ((MemberEntity member, EnumSet <PragmaAnnotation > set ) {
437
435
if (set .contains (PragmaAnnotation .noThrows)) {
438
- f (member);
436
+ f (member as FunctionEntity );
439
437
}
440
438
});
441
439
}
@@ -445,15 +443,15 @@ class AnnotationsDataImpl implements AnnotationsData {
445
443
pragmaAnnotations
446
444
.forEach ((MemberEntity member, EnumSet <PragmaAnnotation > set ) {
447
445
if (set .contains (PragmaAnnotation .noSideEffects)) {
448
- f (member);
446
+ f (member as FunctionEntity );
449
447
}
450
448
});
451
449
}
452
450
453
451
@override
454
- CheckPolicy getParameterCheckPolicy (MemberEntity member) {
452
+ CheckPolicy getParameterCheckPolicy (MemberEntity ? member) {
455
453
if (member != null ) {
456
- EnumSet <PragmaAnnotation > annotations = pragmaAnnotations[member];
454
+ EnumSet <PragmaAnnotation >? annotations = pragmaAnnotations[member];
457
455
if (annotations != null ) {
458
456
if (annotations.contains (PragmaAnnotation .typesTrust)) {
459
457
return CheckPolicy .trusted;
@@ -470,9 +468,9 @@ class AnnotationsDataImpl implements AnnotationsData {
470
468
}
471
469
472
470
@override
473
- CheckPolicy getImplicitDowncastCheckPolicy (MemberEntity member) {
471
+ CheckPolicy getImplicitDowncastCheckPolicy (MemberEntity ? member) {
474
472
if (member != null ) {
475
- EnumSet <PragmaAnnotation > annotations = pragmaAnnotations[member];
473
+ EnumSet <PragmaAnnotation >? annotations = pragmaAnnotations[member];
476
474
if (annotations != null ) {
477
475
if (annotations.contains (PragmaAnnotation .typesTrust)) {
478
476
return CheckPolicy .trusted;
@@ -489,9 +487,9 @@ class AnnotationsDataImpl implements AnnotationsData {
489
487
}
490
488
491
489
@override
492
- CheckPolicy getConditionCheckPolicy (MemberEntity member) {
490
+ CheckPolicy getConditionCheckPolicy (MemberEntity ? member) {
493
491
if (member != null ) {
494
- EnumSet <PragmaAnnotation > annotations = pragmaAnnotations[member];
492
+ EnumSet <PragmaAnnotation >? annotations = pragmaAnnotations[member];
495
493
if (annotations != null ) {
496
494
if (annotations.contains (PragmaAnnotation .typesTrust)) {
497
495
return CheckPolicy .trusted;
@@ -508,9 +506,9 @@ class AnnotationsDataImpl implements AnnotationsData {
508
506
}
509
507
510
508
@override
511
- CheckPolicy getExplicitCastCheckPolicy (MemberEntity member) {
509
+ CheckPolicy getExplicitCastCheckPolicy (MemberEntity ? member) {
512
510
if (member != null ) {
513
- EnumSet <PragmaAnnotation > annotations = pragmaAnnotations[member];
511
+ EnumSet <PragmaAnnotation >? annotations = pragmaAnnotations[member];
514
512
if (annotations != null ) {
515
513
if (annotations.contains (PragmaAnnotation .asTrust)) {
516
514
return CheckPolicy .trusted;
@@ -523,9 +521,9 @@ class AnnotationsDataImpl implements AnnotationsData {
523
521
}
524
522
525
523
@override
526
- CheckPolicy getIndexBoundsCheckPolicy (MemberEntity member) {
524
+ CheckPolicy getIndexBoundsCheckPolicy (MemberEntity ? member) {
527
525
if (member != null ) {
528
- EnumSet <PragmaAnnotation > annotations = pragmaAnnotations[member];
526
+ EnumSet <PragmaAnnotation >? annotations = pragmaAnnotations[member];
529
527
if (annotations != null ) {
530
528
if (annotations.contains (PragmaAnnotation .indexBoundsTrust)) {
531
529
return CheckPolicy .trusted;
0 commit comments