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

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

Issue 12473003: Remove deprecated StringBuffer.add, addAll and addCharCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | 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 // VM-specific implementation of the dart:mirrors library. 5 // VM-specific implementation of the dart:mirrors library.
6 6
7 // These values are allowed to be passed directly over the wire. 7 // These values are allowed to be passed directly over the wire.
8 bool _isSimpleValue(var value) { 8 bool _isSimpleValue(var value) {
9 return (value == null || value is num || value is String || value is bool); 9 return (value == null || value is num || value is String || value is bool);
10 } 10 }
11 11
12 Map _filterMap(Map old_map, bool filter(key, value)) { 12 Map _filterMap(Map old_map, bool filter(key, value)) {
13 Map new_map = new Map(); 13 Map new_map = new Map();
14 old_map.forEach((key, value) { 14 old_map.forEach((key, value) {
15 if (filter(key, value)) { 15 if (filter(key, value)) {
16 new_map[key] = value; 16 new_map[key] = value;
17 } 17 }
18 }); 18 });
19 return new_map; 19 return new_map;
20 } 20 }
21 21
22 String _makeSignatureString(TypeMirror returnType, 22 String _makeSignatureString(TypeMirror returnType,
23 List<ParameterMirror> parameters) { 23 List<ParameterMirror> parameters) {
24 StringBuffer buf = new StringBuffer(); 24 StringBuffer buf = new StringBuffer();
25 buf.add(returnType.qualifiedName); 25 buf.write(returnType.qualifiedName);
26 buf.add(' ('); 26 buf.write(' (');
27 bool found_optional_param = false; 27 bool found_optional_param = false;
28 for (int i = 0; i < parameters.length; i++) { 28 for (int i = 0; i < parameters.length; i++) {
29 var param = parameters[i]; 29 var param = parameters[i];
30 if (param.isOptional && !found_optional_param) { 30 if (param.isOptional && !found_optional_param) {
31 buf.add('['); 31 buf.write('[');
32 found_optional_param = true; 32 found_optional_param = true;
33 } 33 }
34 buf.add(param.type.qualifiedName); 34 buf.write(param.type.qualifiedName);
35 if (i < (parameters.length - 1)) { 35 if (i < (parameters.length - 1)) {
36 buf.add(', '); 36 buf.write(', ');
37 } 37 }
38 } 38 }
39 if (found_optional_param) { 39 if (found_optional_param) {
40 buf.add(']'); 40 buf.write(']');
41 } 41 }
42 buf.add(')'); 42 buf.write(')');
43 return buf.toString(); 43 return buf.toString();
44 } 44 }
45 45
46 class _LocalMirrorSystemImpl implements MirrorSystem { 46 class _LocalMirrorSystemImpl implements MirrorSystem {
47 _LocalMirrorSystemImpl(this.libraries, this.isolate) 47 _LocalMirrorSystemImpl(this.libraries, this.isolate)
48 : _functionTypes = new Map<String, FunctionTypeMirror>() {} 48 : _functionTypes = new Map<String, FunctionTypeMirror>() {}
49 49
50 final Map<String, LibraryMirror> libraries; 50 final Map<String, LibraryMirror> libraries;
51 final IsolateMirror isolate; 51 final IsolateMirror isolate;
52 52
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 default: 246 default:
247 // TODO(lrn): Someone decide if this should combine surrogate pairs. 247 // TODO(lrn): Someone decide if this should combine surrogate pairs.
248 int code = input.codeUnitAt(0); 248 int code = input.codeUnitAt(0);
249 if (isNice(code)) { 249 if (isNice(code)) {
250 output = input; 250 output = input;
251 } else { 251 } else {
252 output = '\\u{${code.toRadixString(16)}}'; 252 output = '\\u{${code.toRadixString(16)}}';
253 } 253 }
254 break; 254 break;
255 } 255 }
256 buf.add(output); 256 buf.write(output);
257 } 257 }
258 return buf.toString(); 258 return buf.toString();
259 } 259 }
260 260
261 class _LocalInstanceMirrorImpl extends _LocalObjectMirrorImpl 261 class _LocalInstanceMirrorImpl extends _LocalObjectMirrorImpl
262 implements InstanceMirror { 262 implements InstanceMirror {
263 _LocalInstanceMirrorImpl(ref, 263 _LocalInstanceMirrorImpl(ref,
264 this._type, 264 this._type,
265 this._reflectee) : super(ref) {} 265 this._reflectee) : super(ref) {}
266 266
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 965
966 // Creates a new local InstanceMirror 966 // Creates a new local InstanceMirror
967 static InstanceMirror makeLocalInstanceMirror(Object reflectee) 967 static InstanceMirror makeLocalInstanceMirror(Object reflectee)
968 native 'Mirrors_makeLocalInstanceMirror'; 968 native 'Mirrors_makeLocalInstanceMirror';
969 969
970 // Creates a new local mirror for some Object. 970 // Creates a new local mirror for some Object.
971 static InstanceMirror reflect(Object reflectee) { 971 static InstanceMirror reflect(Object reflectee) {
972 return makeLocalInstanceMirror(reflectee); 972 return makeLocalInstanceMirror(reflectee);
973 } 973 }
974 } 974 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698