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

Side by Side Diff: runtime/lib/mirrors_patch.dart

Issue 2751423005: Run dartfmt on all files under runtime. (Closed)
Patch Set: Run dartfmt on all files under runtime. Created 3 years, 9 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
« no previous file with comments | « runtime/lib/math_patch.dart ('k') | runtime/lib/null_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import "dart:async" show Future; 5 import "dart:async" show Future;
6 import "dart:collection" show UnmodifiableListView, UnmodifiableMapView; 6 import "dart:collection" show UnmodifiableListView, UnmodifiableMapView;
7 import "dart:_internal" as internal; 7 import "dart:_internal" as internal;
8 8
9 /** 9 /**
10 * Returns a [MirrorSystem] for the current isolate. 10 * Returns a [MirrorSystem] for the current isolate.
11 */ 11 */
12 @patch MirrorSystem currentMirrorSystem() { 12 @patch
13 MirrorSystem currentMirrorSystem() {
13 return _Mirrors.currentMirrorSystem(); 14 return _Mirrors.currentMirrorSystem();
14 } 15 }
15 16
16 /** 17 /**
17 * Returns an [InstanceMirror] for some Dart language object. 18 * Returns an [InstanceMirror] for some Dart language object.
18 * 19 *
19 * This only works if this mirror system is associated with the 20 * This only works if this mirror system is associated with the
20 * current running isolate. 21 * current running isolate.
21 */ 22 */
22 @patch InstanceMirror reflect(Object reflectee) { 23 @patch
24 InstanceMirror reflect(Object reflectee) {
23 return _Mirrors.reflect(reflectee); 25 return _Mirrors.reflect(reflectee);
24 } 26 }
25 27
26 /** 28 /**
27 * Returns a [ClassMirror] for the class represented by a Dart 29 * Returns a [ClassMirror] for the class represented by a Dart
28 * Type object. 30 * Type object.
29 * 31 *
30 * This only works with objects local to the current isolate. 32 * This only works with objects local to the current isolate.
31 */ 33 */
32 @patch ClassMirror reflectClass(Type key) { 34 @patch
35 ClassMirror reflectClass(Type key) {
33 return _Mirrors.reflectClass(key); 36 return _Mirrors.reflectClass(key);
34 } 37 }
35 38
36 @patch TypeMirror reflectType(Type key, [List<Type> typeArguments]) { 39 @patch
40 TypeMirror reflectType(Type key, [List<Type> typeArguments]) {
37 return _Mirrors.reflectType(key, typeArguments); 41 return _Mirrors.reflectType(key, typeArguments);
38 } 42 }
39 43
40 @patch class MirrorSystem { 44 @patch
41 @patch LibraryMirror findLibrary(Symbol libraryName) { 45 class MirrorSystem {
46 @patch
47 LibraryMirror findLibrary(Symbol libraryName) {
42 var candidates = 48 var candidates =
43 libraries.values.where((lib) => lib.simpleName == libraryName); 49 libraries.values.where((lib) => lib.simpleName == libraryName);
44 if (candidates.length == 1) { 50 if (candidates.length == 1) {
45 return candidates.single; 51 return candidates.single;
46 } 52 }
47 if (candidates.length > 1) { 53 if (candidates.length > 1) {
48 var uris = candidates.map((lib) => lib.uri.toString()).toList(); 54 var uris = candidates.map((lib) => lib.uri.toString()).toList();
49 throw new Exception("There are multiple libraries named " 55 throw new Exception("There are multiple libraries named "
50 "'${getName(libraryName)}': $uris"); 56 "'${getName(libraryName)}': $uris");
51 } 57 }
52 throw new Exception("There is no library named '${getName(libraryName)}'"); 58 throw new Exception("There is no library named '${getName(libraryName)}'");
53 } 59 }
54 60
55 @patch static String getName(Symbol symbol) { 61 @patch
62 static String getName(Symbol symbol) {
56 return internal.Symbol.getUnmangledName(symbol); 63 return internal.Symbol.getUnmangledName(symbol);
57 } 64 }
58 65
59 @patch static Symbol getSymbol(String name, [LibraryMirror library]) { 66 @patch
67 static Symbol getSymbol(String name, [LibraryMirror library]) {
60 if ((library != null && library is! _LocalLibraryMirror) || 68 if ((library != null && library is! _LocalLibraryMirror) ||
61 ((name.length > 0) && (name[0] == '_') && (library == null))) { 69 ((name.length > 0) && (name[0] == '_') && (library == null))) {
62 throw new ArgumentError(library); 70 throw new ArgumentError(library);
63 } 71 }
64 if (library != null) name = _mangleName(name, library._reflectee); 72 if (library != null) name = _mangleName(name, library._reflectee);
65 return new internal.Symbol.unvalidated(name); 73 return new internal.Symbol.unvalidated(name);
66 } 74 }
67 75
68 static _mangleName(String name, _MirrorReference lib) 76 static _mangleName(String name, _MirrorReference lib)
69 native "Mirrors_mangleName"; 77 native "Mirrors_mangleName";
70 } 78 }
OLDNEW
« no previous file with comments | « runtime/lib/math_patch.dart ('k') | runtime/lib/null_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698