Skip to content

Commit dfbb908

Browse files
mkustermanncommit-bot@chromium.org
authored andcommitted
[vm] Allow vm tests to import private platform libraries for testing purposes
Issue #36097 Change-Id: I1acec0b7c683ffa363e9b6f7056e76ea2f61d27d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114843 Reviewed-by: Johnni Winther <[email protected]> Reviewed-by: Jens Johansen <[email protected]> Commit-Queue: Martin Kustermann <[email protected]>
1 parent 4b19400 commit dfbb908

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

pkg/vm/lib/target/vm.dart

+7
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,13 @@ class VmTarget extends Target {
349349
]));
350350
}
351351

352+
// In addition to the default implementation, we allow VM tests to import
353+
// private platform libraries - such as `dart:_internal` - for testing
354+
// purposes.
355+
bool allowPlatformPrivateLibraryAccess(Uri importer, Uri imported) =>
356+
super.allowPlatformPrivateLibraryAccess(importer, imported) ||
357+
importer.path.contains('runtime/tests/vm/dart');
358+
352359
// TODO(sigmund,ahe): limit this to `dart-ext` libraries only (see
353360
// https://github.com/dart-lang/sdk/issues/29763).
354361
@override
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'dart:_internal';
6+
7+
void main(List<String> args) {
8+
// Ensure we can import and use members of `dart:_internal`.
9+
print(unsafeCast);
10+
}

0 commit comments

Comments
 (0)