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

Side by Side Diff: sky/sdk/lib/widgets/widget.dart

Issue 1182323009: Zero warnings from the analyzer! (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « sky/sdk/lib/widgets/ink_well.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 import 'dart:sky' as sky; 8 import 'dart:sky' as sky;
9 9
10 import '../base/hit_test.dart'; 10 import '../base/hit_test.dart';
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 void removeChild(Widget node) { 103 void removeChild(Widget node) {
104 node.remove(); 104 node.remove();
105 } 105 }
106 106
107 void detachRoot(); 107 void detachRoot();
108 108
109 // Returns the child which should be retained as the child of this node. 109 // Returns the child which should be retained as the child of this node.
110 Widget syncChild(Widget node, Widget oldNode, dynamic slot) { 110 Widget syncChild(Widget node, Widget oldNode, dynamic slot) {
111 111
112 assert(oldNode is! Component || !oldNode._disqualifiedFromEverAppearingAgain ); 112 assert(oldNode is! Component || (oldNode is Component && !oldNode._disqualif iedFromEverAppearingAgain)); // TODO(ianh): Simplify this once the analyzer is c leverer
113 113
114 if (node == oldNode) { 114 if (node == oldNode) {
115 assert(node == null || node.mounted); 115 assert(node == null || node.mounted);
116 assert(node is! RenderObjectWrapper || node._ancestor != null); 116 assert(node is! RenderObjectWrapper || (node is RenderObjectWrapper && nod e._ancestor != null)); // TODO(ianh): Simplify this once the analyzer is clevere r
117 return node; // Nothing to do. Subtrees must be identical. 117 return node; // Nothing to do. Subtrees must be identical.
118 } 118 }
119 119
120 if (node == null) { 120 if (node == null) {
121 // the child in this slot has gone away 121 // the child in this slot has gone away
122 assert(oldNode.mounted); 122 assert(oldNode.mounted);
123 oldNode.detachRoot(); 123 oldNode.detachRoot();
124 removeChild(oldNode); 124 removeChild(oldNode);
125 assert(!oldNode.mounted); 125 assert(!oldNode.mounted);
126 return null; 126 return null;
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 RenderObject createNode(); 488 RenderObject createNode();
489 489
490 static final Map<RenderObject, RenderObjectWrapper> _nodeMap = 490 static final Map<RenderObject, RenderObjectWrapper> _nodeMap =
491 new HashMap<RenderObject, RenderObjectWrapper>(); 491 new HashMap<RenderObject, RenderObjectWrapper>();
492 static RenderObjectWrapper _getMounted(RenderObject node) => _nodeMap[node]; 492 static RenderObjectWrapper _getMounted(RenderObject node) => _nodeMap[node];
493 493
494 RenderObjectWrapper _ancestor; 494 RenderObjectWrapper _ancestor;
495 void insertChildRoot(RenderObjectWrapper child, dynamic slot); 495 void insertChildRoot(RenderObjectWrapper child, dynamic slot);
496 void detachChildRoot(RenderObjectWrapper child); 496 void detachChildRoot(RenderObjectWrapper child);
497 497
498 void _sync(Widget old, dynamic slot) { 498 void _sync(RenderObjectWrapper old, dynamic slot) {
499 // TODO(abarth): We should split RenderObjectWrapper into two pieces so that 499 // TODO(abarth): We should split RenderObjectWrapper into two pieces so that
500 // RenderViewObject doesn't need to inherit all this code it 500 // RenderViewObject doesn't need to inherit all this code it
501 // doesn't need. 501 // doesn't need.
502 assert(parent != null || this is RenderViewWrapper); 502 assert(parent != null || this is RenderViewWrapper);
503 if (old == null) { 503 if (old == null) {
504 _root = createNode(); 504 _root = createNode();
505 _ancestor = findAncestor(RenderObjectWrapper); 505 _ancestor = findAncestor(RenderObjectWrapper);
506 if (_ancestor is RenderObjectWrapper) 506 if (_ancestor is RenderObjectWrapper)
507 _ancestor.insertChildRoot(this, slot); 507 _ancestor.insertChildRoot(this, slot);
508 } else { 508 } else {
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 if (root.parent == null) { 907 if (root.parent == null) {
908 // we haven't attached it yet 908 // we haven't attached it yet
909 assert(_container.child == null); 909 assert(_container.child == null);
910 _container.child = root; 910 _container.child = root;
911 } 911 }
912 assert(root.parent == _container); 912 assert(root.parent == _container);
913 } 913 }
914 914
915 Widget build() => builder(); 915 Widget build() => builder();
916 } 916 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/ink_well.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698