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

Side by Side Diff: tests/lib/mirrors/mirrors_nsm_test.dart

Issue 228023004: Revert "Add support for closure calls through getters." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « tests/lib/mirrors/invoke_closurization_test.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
(Empty)
1 // Copyright (c) 2011, 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 library MirrorsTest;
6
7 import 'dart:mirrors';
8 import 'package:expect/expect.dart';
9
10 bool isNSMContainingFieldName(e, String fieldName, bool isSetter) {
11 print(e);
12 if (e is! NoSuchMethodError) return false;
13 String needle = fieldName;
14 if (isSetter) needle += "=";
15 return "$e".contains(needle) && ! "$e".contains(needle + "=");
16 }
17
18 class A {}
19
20 main() {
21 var mirrors = currentMirrorSystem();
22 var libMirror = mirrors.findLibrary(#MirrorsTest);
23 Expect.throws(() => libMirror.invoke(#foo, []),
24 (e) => isNSMContainingFieldName(e, "foo", false));
25 Expect.throws(() => libMirror.getField(#foo),
26 (e) => isNSMContainingFieldName(e, "foo", false));
27 Expect.throws(() => libMirror.setField(#foo, null), /// vm: ok
28 (e) => isNSMContainingFieldName(e, "foo", true)); /// vm: contin ued
29
30 var classMirror = reflect(A);
31 Expect.throws(() => classMirror.invoke(#foo, []),
32 (e) => isNSMContainingFieldName(e, "foo", false));
33 Expect.throws(() => classMirror.getField(#foo),
34 (e) => isNSMContainingFieldName(e, "foo", false));
35 Expect.throws(() => classMirror.setField(#foo, null),
36 (e) => isNSMContainingFieldName(e, "foo", true));
37
38 var instanceMirror = reflect(new A());
39 Expect.throws(() => instanceMirror.invoke(#foo, []),
40 (e) => isNSMContainingFieldName(e, "foo", false));
41 Expect.throws(() => instanceMirror.getField(#foo),
42 (e) => isNSMContainingFieldName(e, "foo", false));
43 Expect.throws(() => instanceMirror.setField(#foo, null),
44 (e) => isNSMContainingFieldName(e, "foo", true));
45
46 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/invoke_closurization_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698