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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/mirrors_patch.dart

Issue 1212513002: sdk files reorganization to make dart2js a proper package (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: renamed Created 5 years, 5 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Patch library for dart:mirrors.
6
7 import 'dart:_js_helper' show patch;
8 import 'dart:_js_mirrors' as js;
9
10 @patch
11 class MirrorSystem {
12 @patch
13 static String getName(Symbol symbol) => js.getName(symbol);
14
15 @patch
16 static Symbol getSymbol(String name, [LibraryMirror library]) {
17 return js.getSymbol(name, library);
18 }
19 }
20
21 @patch
22 MirrorSystem currentMirrorSystem() => js.currentJsMirrorSystem;
23
24 @patch
25 InstanceMirror reflect(Object reflectee) => js.reflect(reflectee);
26
27 @patch
28 ClassMirror reflectClass(Type key) {
29 if (key is! Type || key == dynamic) {
30 throw new ArgumentError('$key does not denote a class');
31 }
32 TypeMirror tm = reflectType(key);
33 if (tm is! ClassMirror) {
34 throw new ArgumentError("$key does not denote a class");
35 }
36 return (tm as ClassMirror).originalDeclaration;
37 }
38
39 @patch
40 TypeMirror reflectType(Type key) {
41 if (key == dynamic) {
42 return currentMirrorSystem().dynamicType;
43 }
44 return js.reflectType(key);
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698