| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Patch library for dart:mirrors. | 5 // Patch library for dart:mirrors. |
| 6 | 6 |
| 7 import 'dart:_js_mirrors' as js; | 7 import 'dart:_js_mirrors' as js; |
| 8 | 8 |
| 9 patch class MirrorSystem { | 9 patch class MirrorSystem { |
| 10 patch static String getName(Symbol symbol) => js.getName(symbol); | 10 patch static String getName(Symbol symbol) => js.getName(symbol); |
| 11 } | 11 } |
| 12 | 12 |
| 13 patch MirrorSystem currentMirrorSystem() => js.currentJsMirrorSystem; | 13 patch MirrorSystem currentMirrorSystem() => js.currentJsMirrorSystem; |
| 14 | 14 |
| 15 patch Future<MirrorSystem> mirrorSystemOf(SendPort port) { | 15 patch Future<MirrorSystem> mirrorSystemOf(SendPort port) { |
| 16 throw new UnsupportedError("MirrorSystem not implemented"); | 16 throw new UnsupportedError("MirrorSystem not implemented"); |
| 17 } | 17 } |
| 18 | 18 |
| 19 patch InstanceMirror reflect(Object reflectee) => js.reflect(reflectee); | 19 patch InstanceMirror reflect(Object reflectee) => js.reflect(reflectee); |
| 20 | 20 |
| 21 patch ClassMirror reflectClass(Type key) { | 21 patch ClassMirror reflectClass(Type key) { |
| 22 return js.reflectType(key).originalDeclaration; | 22 TypeMirror tm = reflectType(key); |
| 23 if (tm is ClassMirror) { |
| 24 return (tm as ClassMirror).originalDeclaration; |
| 25 } |
| 26 throw new ArgumentError("$key does not denote a class"); |
| 23 } | 27 } |
| 28 |
| 29 patch TypeMirror reflectType(Type key) => js.reflectType(key); |
| OLD | NEW |