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

Side by Side Diff: pkg/smoke/lib/mirrors.dart

Issue 583803002: fix toString calls on Type objects in smoke (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix typo Created 6 years, 3 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
« no previous file with comments | « pkg/smoke/CHANGELOG.md ('k') | pkg/smoke/lib/static.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /// Implementation of the smoke services using mirrors. 5 /// Implementation of the smoke services using mirrors.
6 library smoke.mirrors; 6 library smoke.mirrors;
7 7
8 import 'dart:mirrors'; 8 import 'dart:mirrors';
9 import 'package:smoke/smoke.dart'; 9 import 'package:smoke/smoke.dart';
10 import 'package:logging/logging.dart'; 10 import 'package:logging/logging.dart';
(...skipping 16 matching lines...) Expand all
27 read(Object object, Symbol name) => reflect(object).getField(name).reflectee; 27 read(Object object, Symbol name) => reflect(object).getField(name).reflectee;
28 28
29 void write(Object object, Symbol name, value) { 29 void write(Object object, Symbol name, value) {
30 reflect(object).setField(name, value); 30 reflect(object).setField(name, value);
31 } 31 }
32 32
33 invoke(receiver, Symbol methodName, List args, 33 invoke(receiver, Symbol methodName, List args,
34 {Map namedArgs, bool adjust: false}) { 34 {Map namedArgs, bool adjust: false}) {
35 var receiverMirror; 35 var receiverMirror;
36 var method; 36 var method;
37 if (receiver is Type) { 37 if (receiver is Type && methodName != #toString) {
38 receiverMirror = reflectType(receiver); 38 receiverMirror = reflectType(receiver);
39 method = receiverMirror.declarations[methodName]; 39 method = receiverMirror.declarations[methodName];
40 } else { 40 } else {
41 receiverMirror = reflect(receiver); 41 receiverMirror = reflect(receiver);
42 method = _findMethod(receiverMirror.type, methodName); 42 method = _findMethod(receiverMirror.type, methodName);
43 } 43 }
44 if (method != null && adjust) { 44 if (method != null && adjust) {
45 var required = 0; 45 var required = 0;
46 var optional = 0; 46 var optional = 0;
47 for (var p in method.parameters) { 47 for (var p in method.parameters) {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 String toString() => (new StringBuffer() 311 String toString() => (new StringBuffer()
312 ..write('(mirror-based-declaration ') 312 ..write('(mirror-based-declaration ')
313 ..write(name) 313 ..write(name)
314 ..write(isField ? ' (field) ' 314 ..write(isField ? ' (field) '
315 : (isProperty ? ' (property) ' : ' (method) ')) 315 : (isProperty ? ' (property) ' : ' (method) '))
316 ..write(isFinal ? 'final ' : '') 316 ..write(isFinal ? 'final ' : '')
317 ..write(isStatic ? 'static ' : '') 317 ..write(isStatic ? 'static ' : '')
318 ..write(annotations) 318 ..write(annotations)
319 ..write(')')).toString(); 319 ..write(')')).toString();
320 } 320 }
OLDNEW
« no previous file with comments | « pkg/smoke/CHANGELOG.md ('k') | pkg/smoke/lib/static.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698