Chromium Code Reviews

Side by Side Diff: test/codegen/lib/mirrors/get_field_cache_test.dart

Issue 2265533002: Add mirrors tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 @MirrorsUsed(targets: const ["A", "B"])
6 import 'dart:mirrors';
7
8 import 'package:expect/expect.dart';
9
10 class A {
11 toString() => "A";
12 }
13
14 class B {
15 int x = 99;
16 toString() => "B";
17 }
18
19 void main() {
20 var a = new A();
21 var am = reflect(a);
22 for (int i = 0; i < 10; i++) {
23 // Adds a probe function on the symbol.
24 am.getField(#toString);
25 }
26 var b = new B();
27 var bm = reflect(b);
28 for (int i = 0; i < 10; i++) {
29 // Adds a field-cache on the mirror.
30 bm.getField(#x);
31 }
32 // There is a cache now, but the cache should not contain 'toString' from
33 // JavaScript's Object.prototype.
34 var toString = bm.getField(#toString).reflectee;
35 Expect.equals("B", toString());
36 }
OLDNEW
« no previous file with comments | « test/codegen/lib/mirrors/generics_test.dart ('k') | test/codegen/lib/mirrors/get_field_static_test.dart » ('j') | no next file with comments »

Powered by Google App Engine