Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1369)

Unified Diff: pkg/analyzer/test/src/dart/sdk/patch_test.dart

Issue 2413403002: Allow new public names in patches for the dart:_internal library. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/dart/sdk/patch.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/dart/sdk/patch_test.dart
diff --git a/pkg/analyzer/test/src/dart/sdk/patch_test.dart b/pkg/analyzer/test/src/dart/sdk/patch_test.dart
index 6f3d34609bb73cdda6ee7b2a1493afd3defa205a..dc3a9034f6a31ddc9e16ec6739737932741a0eff 100644
--- a/pkg/analyzer/test/src/dart/sdk/patch_test.dart
+++ b/pkg/analyzer/test/src/dart/sdk/patch_test.dart
@@ -279,7 +279,7 @@ class A {
}, throwsArgumentError);
}
- test_class_field_append_publiInPrivateClass() {
+ test_class_field_append_publicInPrivateClass() {
CompilationUnit unit = _doTopLevelPatching(
r'''
class _C {
@@ -480,6 +480,47 @@ final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
}, throwsArgumentError);
}
+ test_internal_allowNewPublicNames() {
+ _setSdkLibraries(r'''
+final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
+ '_internal' : const LibraryInfo(
+ 'internal/internal.dart',
+ patches: {VM_PLATFORM: ['internal/internal_patch.dart']}),
+};''');
+ File file = provider.newFile(
+ _p('/sdk/lib/internal/internal.dart'),
+ r'''
+library dart._internal;
+class A {}
+class B {
+ B();
+}
+''');
+ provider.newFile(
+ _p('/sdk/lib/internal/internal_patch.dart'),
+ r'''
+@patch
+class B {
+ int newField;
+ B.newConstructor();
+ int newMethod() => 1;
+}
+class NewClass {}
+int newFunction() => 2;
+''');
+
+ _createSdk();
+
+ Source source = file.createSource(FastUri.parse('dart:_internal'));
+ CompilationUnit unit = SdkPatcher.parse(source, true, listener);
+ patcher.patch(sdk, SdkLibraryImpl.VM_PLATFORM, listener, source, unit);
+ _assertUnitCode(
+ unit,
+ 'library dart._internal; class A {} '
+ 'class B {B(); int newField; B.newConstructor(); int newMethod() => 1;} '
+ 'class NewClass {} int newFunction() => 2;');
+ }
+
test_part() {
String baseLibCode = r'''
library test;
« no previous file with comments | « pkg/analyzer/lib/src/dart/sdk/patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698