OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 import 'dart:mirrors'; | 5 import 'dart:mirrors'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 | 7 |
8 final HashMap<ClassMirror, List> _fieldCache = new HashMap<ClassMirror, List>(); | 8 final HashMap<ClassMirror, List> _fieldCache = new HashMap<ClassMirror, List>(); |
9 | 9 |
10 List<Symbol> _getPublicFields(ClassMirror mirror) { | 10 List<Symbol> _getPublicFields(ClassMirror mirror) { |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 void copyPublicFields(Object source, Object target) { | 33 void copyPublicFields(Object source, Object target) { |
34 assert(source.runtimeType == target.runtimeType); | 34 assert(source.runtimeType == target.runtimeType); |
35 | 35 |
36 var sourceMirror = reflect(source); | 36 var sourceMirror = reflect(source); |
37 var targetMirror = reflect(target); | 37 var targetMirror = reflect(target); |
38 for (var symbol in _getPublicFields(sourceMirror.type)) { | 38 for (var symbol in _getPublicFields(sourceMirror.type)) { |
39 targetMirror.setField(symbol, sourceMirror.getField(symbol).reflectee); | 39 targetMirror.setField(symbol, sourceMirror.getField(symbol).reflectee); |
40 } | 40 } |
41 } | 41 } |
OLD | NEW |