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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Test reflection of private functions in core classes. 5 // Test that static const fields are accessible by reflection.
6 // Regression test for http://dartbug.com/23811.
6 7
8 @MirrorsUsed(targets: const [A])
9 import "dart:mirrors";
7 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
8 import "dart:mirrors"; 11
12 class A {
13 static const ONE = 1;
14 }
9 15
10 main() { 16 main() {
11 var s = "string"; 17 Expect.equals(1, reflectClass(A).getField(#ONE).reflectee);
12 var im = reflect(s);
13 Expect.throws(() => im.invoke(const Symbol("_setAt"), [0, 65]), (e) => e is No SuchMethodError);
14 } 18 }
15
OLDNEW
« 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