OLD | NEW |
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 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // course). | 135 // course). |
136 VMReference _reference; | 136 VMReference _reference; |
137 } | 137 } |
138 | 138 |
139 abstract class _LocalObjectMirrorImpl extends _LocalVMObjectMirrorImpl | 139 abstract class _LocalObjectMirrorImpl extends _LocalVMObjectMirrorImpl |
140 implements ObjectMirror { | 140 implements ObjectMirror { |
141 _LocalObjectMirrorImpl(ref) : super(ref) {} | 141 _LocalObjectMirrorImpl(ref) : super(ref) {} |
142 | 142 |
143 Future<InstanceMirror> invoke(String memberName, | 143 Future<InstanceMirror> invoke(String memberName, |
144 List positionalArguments, | 144 List positionalArguments, |
145 [Map<String,Dynamic> namedArguments]) { | 145 [Map<String,dynamic> namedArguments]) { |
146 if (namedArguments != null) { | 146 if (namedArguments != null) { |
147 throw new UnimplementedError( | 147 throw new UnimplementedError( |
148 'named argument support is not implemented'); | 148 'named argument support is not implemented'); |
149 } | 149 } |
150 // Walk the arguments and make sure they are legal. | 150 // Walk the arguments and make sure they are legal. |
151 for (int i = 0; i < positionalArguments.length; i++) { | 151 for (int i = 0; i < positionalArguments.length; i++) { |
152 var arg = positionalArguments[i]; | 152 var arg = positionalArguments[i]; |
153 _validateArgument(i, arg); | 153 _validateArgument(i, arg); |
154 } | 154 } |
155 Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); | 155 Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 | 496 |
497 ClassMirror get genericDeclaration { | 497 ClassMirror get genericDeclaration { |
498 throw new UnimplementedError( | 498 throw new UnimplementedError( |
499 'ClassMirror.originalDeclaration is not implemented'); | 499 'ClassMirror.originalDeclaration is not implemented'); |
500 } | 500 } |
501 | 501 |
502 String toString() => "ClassMirror on '$simpleName'"; | 502 String toString() => "ClassMirror on '$simpleName'"; |
503 | 503 |
504 Future<InstanceMirror> newInstance(String constructorName, | 504 Future<InstanceMirror> newInstance(String constructorName, |
505 List positionalArguments, | 505 List positionalArguments, |
506 [Map<String,Dynamic> namedArguments]) { | 506 [Map<String,dynamic> namedArguments]) { |
507 if (namedArguments != null) { | 507 if (namedArguments != null) { |
508 throw new UnimplementedError( | 508 throw new UnimplementedError( |
509 'named argument support is not implemented'); | 509 'named argument support is not implemented'); |
510 } | 510 } |
511 // Walk the arguments and make sure they are legal. | 511 // Walk the arguments and make sure they are legal. |
512 for (int i = 0; i < positionalArguments.length; i++) { | 512 for (int i = 0; i < positionalArguments.length; i++) { |
513 var arg = positionalArguments[i]; | 513 var arg = positionalArguments[i]; |
514 _LocalObjectMirrorImpl._validateArgument(i, arg); | 514 _LocalObjectMirrorImpl._validateArgument(i, arg); |
515 } | 515 } |
516 Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); | 516 Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 | 964 |
965 // Creates a new local InstanceMirror | 965 // Creates a new local InstanceMirror |
966 static InstanceMirror makeLocalInstanceMirror(Object reflectee) | 966 static InstanceMirror makeLocalInstanceMirror(Object reflectee) |
967 native 'Mirrors_makeLocalInstanceMirror'; | 967 native 'Mirrors_makeLocalInstanceMirror'; |
968 | 968 |
969 // Creates a new local mirror for some Object. | 969 // Creates a new local mirror for some Object. |
970 static InstanceMirror reflect(Object reflectee) { | 970 static InstanceMirror reflect(Object reflectee) { |
971 return makeLocalInstanceMirror(reflectee); | 971 return makeLocalInstanceMirror(reflectee); |
972 } | 972 } |
973 } | 973 } |
OLD | NEW |