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

Unified Diff: tests/lib/mirrors/static_const_field_test.dart

Issue 1225083004: dart2js: Emit static const fields if accessible by reflections. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rebase Created 5 years, 5 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/compiler/lib/src/js_emitter/program_builder/program_builder.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/static_const_field_test.dart
diff --git a/tests/language/vm/reflect_core_vm_test.dart b/tests/lib/mirrors/static_const_field_test.dart
similarity index 54%
copy from tests/language/vm/reflect_core_vm_test.dart
copy to tests/lib/mirrors/static_const_field_test.dart
index 2474b216f7bf0b641535f0b18af4573eb9c7e723..f6fd959de34473e068f0c6434d1ab41e24014ab2 100644
--- a/tests/language/vm/reflect_core_vm_test.dart
+++ b/tests/lib/mirrors/static_const_field_test.dart
@@ -2,14 +2,17 @@
// 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.
-// Test reflection of private functions in core classes.
+// Test that static const fields are accessible by reflection.
+// Regression test for http://dartbug.com/23811.
-import "package:expect/expect.dart";
+@MirrorsUsed(targets: const [A])
import "dart:mirrors";
+import "package:expect/expect.dart";
-main() {
- var s = "string";
- var im = reflect(s);
- Expect.throws(() => im.invoke(const Symbol("_setAt"), [0, 65]), (e) => e is NoSuchMethodError);
+class A {
+ static const ONE = 1;
}
+main() {
+ Expect.equals(1, reflectClass(A).getField(#ONE).reflectee);
+}
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698