dart-sdk/tests/web/late_field_checks_test.dart
Stephen Adams d6e78f27af [dart2js] late annotations with context
Annotations

    @pragma('dart2js:late:trust')
    @pragma('dart2js:late:check')

are now scoped, so that an annotation on a library or class will take effect unless shadowed by a closer `dart2js:late` annotation.
Currently the annotations affect only `late` fields.

Change-Id: Ida5c2b9387449263e29e74925aac9172fb3dc40c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251503
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-07-20 06:04:34 +00:00

30 lines
912 B
Dart

// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// dart2jsOptions=-Ddart2js=true
// Behavioral test for annotations that control checking of late fields.
// See `late_field_checks_common.dart` for details.
import 'package:expect/expect.dart';
import 'late_field_checks_common.dart' show libraryName;
import 'late_field_checks_lib_none.dart' as libNone;
import 'late_field_checks_lib_trust.dart' as libTrust;
import 'late_field_checks_lib_check.dart' as libCheck;
void main() {
libraryName = null;
libNone.main();
Expect.equals('LibraryNone', libraryName);
libraryName = null;
libCheck.main();
Expect.equals('LibraryCheck', libraryName);
libraryName = null;
libTrust.main();
Expect.equals('LibraryTrust', libraryName);
}