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

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

Issue 61753019: Allow creation of public symbols using MirrorSystem.getSymbol when passing a null library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | « no previous file | tests/lib/mirrors/private_symbol_test.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:nativewrappers";
rmacnak 2013/11/20 00:27:46 We haven't needed this since the introduction of M
6 // TODO(ahe): Move _symbol_dev.Symbol to its own "private" library? 5 // TODO(ahe): Move _symbol_dev.Symbol to its own "private" library?
7 import "dart:_collection-dev" as _symbol_dev; 6 import "dart:_collection-dev" as _symbol_dev;
8 7
9 /** 8 /**
10 * Returns a [MirrorSystem] for the current isolate. 9 * Returns a [MirrorSystem] for the current isolate.
11 */ 10 */
12 patch MirrorSystem currentMirrorSystem() { 11 patch MirrorSystem currentMirrorSystem() {
13 return _Mirrors.currentMirrorSystem(); 12 return _Mirrors.currentMirrorSystem();
14 } 13 }
15 14
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 result.write(char); 70 result.write(char);
72 } 71 }
73 } 72 }
74 if (add_setter_suffix) { 73 if (add_setter_suffix) {
75 result.write('='); 74 result.write('=');
76 } 75 }
77 return result.toString(); 76 return result.toString();
78 } 77 }
79 78
80 /* patch */ static Symbol getSymbol(String name, [LibraryMirror library]) { 79 /* patch */ static Symbol getSymbol(String name, [LibraryMirror library]) {
81 if (library is! LibraryMirror || 80 if ((library != null && library is! _LocalLibraryMirror) ||
ahe 2013/11/21 09:07:02 Why are you checking for is! _LocalLibraryMirror?
82 ((name.length > 0) && (name[0] == '_') && (library == null))) { 81 ((name.length > 0) && (name[0] == '_') && (library == null))) {
83 throw new ArgumentError(library); 82 throw new ArgumentError(library);
84 } 83 }
85 if (library != null) name = _mangleName(name, library._reflectee); 84 if (library != null) name = _mangleName(name, library._reflectee);
86 return new _symbol_dev.Symbol.unvalidated(name); 85 return new _symbol_dev.Symbol.unvalidated(name);
87 } 86 }
88 87
89 static _mangleName(String name, _MirrorReference lib) 88 static _mangleName(String name, _MirrorReference lib)
90 native "Mirrors_mangleName"; 89 native "Mirrors_mangleName";
91 } 90 }
92 91
93 // TODO(rmacnak): Eliminate this class. 92 // TODO(rmacnak): Eliminate this class.
94 class MirroredCompilationError { 93 class MirroredCompilationError {
95 final String message; 94 final String message;
96 95
97 MirroredCompilationError(this.message); 96 MirroredCompilationError(this.message);
98 97
99 String toString() { 98 String toString() {
100 return "Compile-time error during mirrored execution: <$message>"; 99 return "Compile-time error during mirrored execution: <$message>";
101 } 100 }
102 } 101 }
OLDNEW
« no previous file with comments | « no previous file | tests/lib/mirrors/private_symbol_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698