OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 /// Test that MirrorSystem.getName works correctly on symbols returned from |
| 6 /// Invocation.memberName. This is especially relevant when minifying. |
| 7 |
| 8 import 'dart:mirrors' show MirrorSystem; |
| 9 |
| 10 class Foo { |
| 11 String noSuchMethod(Invocation invocation) { |
| 12 return MirrorSystem.getName(invocation.memberName); |
| 13 } |
| 14 } |
| 15 |
| 16 expect(expected, actual) { |
| 17 if (expected != actual) { |
| 18 throw 'Expected: "$expected", but got "$actual"'; |
| 19 } |
| 20 } |
| 21 |
| 22 main() { |
| 23 var foo = new Foo(); |
| 24 expect('foo', foo.foo); |
| 25 expect('foo', foo.foo()); |
| 26 expect('foo', foo.foo(null)); |
| 27 // TODO(ahe): Why does the following not work in dart2js/minified. |
| 28 // expect('foo', foo.foo(null, null)); |
| 29 expect('foo', foo.foo(a: null, b: null)); |
| 30 |
| 31 expect('baz', foo.baz); |
| 32 expect('baz', foo.baz()); |
| 33 expect('baz', foo.baz(null)); |
| 34 // TODO(ahe): Why does the following not work in dart2js/minified. |
| 35 // expect('baz', foo.baz(null, null)); |
| 36 expect('baz', foo.baz(a: null, b: null)); |
| 37 } |
OLD | NEW |