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

Unified Diff: sky/framework/reflect.dart

Issue 1132063007: Rationalize Dart mojo and sky package structure (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/framework/node.dart ('k') | sky/framework/shell.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/reflect.dart
diff --git a/sky/framework/reflect.dart b/sky/framework/reflect.dart
deleted file mode 100644
index 0e132b91caaac827001d2dc713c37555a6b0b0cc..0000000000000000000000000000000000000000
--- a/sky/framework/reflect.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'dart:mirrors';
-import 'dart:collection';
-
-final HashMap<ClassMirror, List> _fieldCache = new HashMap<ClassMirror, List>();
-
-List<Symbol> _getPublicFields(ClassMirror mirror) {
- return _fieldCache.putIfAbsent(mirror, () {
- List<Symbol> fields = new List<Symbol>();
-
- while (mirror != null) {
- var decls = mirror.declarations;
- fields.addAll(decls.keys.where((symbol) {
- var mirror = decls[symbol];
- if (mirror is! VariableMirror) {
- return false;
- }
-
- var vMirror = mirror as VariableMirror;
- return !vMirror.isPrivate && !vMirror.isStatic && !vMirror.isFinal;
- }));
-
- mirror = mirror.superclass;
- }
-
- return fields;
- });
-}
-
-void copyPublicFields(Object source, Object target) {
- assert(source.runtimeType == target.runtimeType);
-
- var sourceMirror = reflect(source);
- var targetMirror = reflect(target);
- for (var symbol in _getPublicFields(sourceMirror.type)) {
- targetMirror.setField(symbol, sourceMirror.getField(symbol).reflectee);
- }
-}
« no previous file with comments | « sky/framework/node.dart ('k') | sky/framework/shell.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698