OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dart._js_mirrors; | 5 library dart._js_mirrors; |
6 | 6 |
7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
8 import 'dart:_foreign_helper' show JS; | 8 import 'dart:_foreign_helper' show JS; |
9 import 'dart:_internal' as _internal; | 9 import 'dart:_internal' as _internal; |
10 | 10 |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 Symbol get simpleName => _symbol; | 534 Symbol get simpleName => _symbol; |
535 | 535 |
536 // TODO(vsm): Fix this | 536 // TODO(vsm): Fix this |
537 final bool isStatic = false; | 537 final bool isStatic = false; |
538 | 538 |
539 JsVariableMirror._(Symbol symbol, Type t, List annotations, | 539 JsVariableMirror._(Symbol symbol, Type t, List annotations, |
540 {this.isFinal: false}) | 540 {this.isFinal: false}) |
541 : _symbol = symbol, | 541 : _symbol = symbol, |
542 _name = getName(symbol), | 542 _name = getName(symbol), |
543 type = reflectType(t), | 543 type = reflectType(t), |
544 metadata = | 544 metadata = new List<InstanceMirror>.unmodifiable( |
545 new List<InstanceMirror>.unmodifiable(annotations.map(reflect)); | 545 annotations?.map(reflect) ?? []); |
546 | 546 |
547 JsVariableMirror._fromField(Symbol symbol, fieldInfo) | 547 JsVariableMirror._fromField(Symbol symbol, fieldInfo) |
548 : this._(symbol, _wrap(JS('', '#.type', fieldInfo)), | 548 : this._(symbol, _wrap(JS('', '#.type', fieldInfo)), |
549 JS('', '#.metadata', fieldInfo), | 549 JS('', '#.metadata', fieldInfo), |
550 isFinal: JS('bool', '#.isFinal', fieldInfo)); | 550 isFinal: JS('bool', '#.isFinal', fieldInfo)); |
551 | 551 |
552 String toString() => "VariableMirror on '$_name'"; | 552 String toString() => "VariableMirror on '$_name'"; |
553 } | 553 } |
554 | 554 |
555 class JsParameterMirror extends JsVariableMirror implements ParameterMirror { | 555 class JsParameterMirror extends JsVariableMirror implements ParameterMirror { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 var param = | 647 var param = |
648 new JsParameterMirror._(new Symbol(''), _wrap(type), metadata); | 648 new JsParameterMirror._(new Symbol(''), _wrap(type), metadata); |
649 params[i + args.length] = param; | 649 params[i + args.length] = param; |
650 } | 650 } |
651 | 651 |
652 _params = new List.unmodifiable(params); | 652 _params = new List.unmodifiable(params); |
653 } | 653 } |
654 | 654 |
655 String toString() => "MethodMirror on '$_name'"; | 655 String toString() => "MethodMirror on '$_name'"; |
656 } | 656 } |
OLD | NEW |