| Index: tests/compiler/dart2js_extra/mirror_invalid_field_access3_test.dart
|
| diff --git a/tests/compiler/dart2js_extra/mirror_invalid_field_access3_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_field_access3_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f51d43b26fe963ae7da373d820f65e6df4de0f8d
|
| --- /dev/null
|
| +++ b/tests/compiler/dart2js_extra/mirror_invalid_field_access3_test.dart
|
| @@ -0,0 +1,28 @@
|
| +// Copyright (c) 2013, 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.
|
| +
|
| +// Test that we cannot reflect on elements not covered by the `MirrorsUsed`
|
| +// annotation.
|
| +
|
| +library test;
|
| +
|
| +@MirrorsUsed(targets: 'C.foo')
|
| +import 'dart:mirrors';
|
| +
|
| +import 'package:expect/expect.dart';
|
| +
|
| +class C {
|
| + static var foo;
|
| + static var bar;
|
| +}
|
| +
|
| +main() {
|
| + C.bar = 1;
|
| + var local = C.bar;
|
| + var mirror = reflect(new C()).type; // Workaround bug 12799.
|
| + Expect.equals(1, mirror.setField(const Symbol('foo'), 1).reflectee);
|
| + Expect.equals(1, mirror.getField(const Symbol('foo')).reflectee);
|
| + Expect.throws(() => mirror.setField(const Symbol('bar'), 2));
|
| + Expect.throws(() => mirror.getField(const Symbol('bar')));
|
| +}
|
|
|