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

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

Issue 53883002: Ensure constructorName symbols include private manglings. (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
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"; 5 import "dart:nativewrappers";
6 // TODO(ahe): Move _symbol_dev.Symbol to its own "private" library? 6 // TODO(ahe): Move _symbol_dev.Symbol to its own "private" library?
7 import "dart:_collection-dev" as _symbol_dev; 7 import "dart:_collection-dev" as _symbol_dev;
8 8
9 /** 9 /**
10 * Returns a [MirrorSystem] for the current isolate. 10 * Returns a [MirrorSystem] for the current isolate.
(...skipping 30 matching lines...) Expand all
41 return _Mirrors.reflectClass(key); 41 return _Mirrors.reflectClass(key);
42 } 42 }
43 43
44 patch TypeMirror reflectType(Type key) { 44 patch TypeMirror reflectType(Type key) {
45 return _Mirrors.reflectType(key); 45 return _Mirrors.reflectType(key);
46 } 46 }
47 47
48 patch class MirrorSystem { 48 patch class MirrorSystem {
49 /* patch */ static String getName(Symbol symbol) { 49 /* patch */ static String getName(Symbol symbol) {
50 String string = _symbol_dev.Symbol.getName(symbol); 50 String string = _symbol_dev.Symbol.getName(symbol);
51 if (string.contains(' with ')) return string; 51 if (string.contains(' with ')) {
52 // Constructor names of anonymous mixin applications
53 var at_pos = string.indexOf('@');
54 if (at_pos == -1) return string;
55 return string.substring(0, at_pos);
56 }
52 return _unmangleName(string); 57 return _unmangleName(string);
53 } 58 }
54 /* patch */ static Symbol getSymbol(String name, [LibraryMirror library]) { 59 /* patch */ static Symbol getSymbol(String name, [LibraryMirror library]) {
55 if (library is! LibraryMirror || 60 if (library is! LibraryMirror ||
56 ((name[0] == '_') && (library == null))) { 61 ((name.length > 0) && (name[0] == '_') && (library == null))) {
57 throw new ArgumentError(library); 62 throw new ArgumentError(library);
58 } 63 }
59 if (library != null) name = _mangleName(name, library._reflectee); 64 if (library != null) name = _mangleName(name, library._reflectee);
60 return new _symbol_dev.Symbol.unvalidated(name); 65 return new _symbol_dev.Symbol.unvalidated(name);
61 } 66 }
62 67
63 static _unmangleName(String name) 68 static _unmangleName(String name)
64 native "Mirrors_unmangleName"; 69 native "Mirrors_unmangleName";
65 static _mangleName(String name, _MirrorReference lib) 70 static _mangleName(String name, _MirrorReference lib)
66 native "Mirrors_mangleName"; 71 native "Mirrors_mangleName";
67 } 72 }
68 73
69 // TODO(rmacnak): Eliminate this class. 74 // TODO(rmacnak): Eliminate this class.
70 class MirroredCompilationError { 75 class MirroredCompilationError {
71 final String message; 76 final String message;
72 77
73 MirroredCompilationError(this.message); 78 MirroredCompilationError(this.message);
74 79
75 String toString() { 80 String toString() {
76 return "Compile-time error during mirrored execution: <$message>"; 81 return "Compile-time error during mirrored execution: <$message>";
77 } 82 }
78 } 83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698