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

Side by Side Diff: sky/sdk/lib/framework/fn2.dart

Issue 1160923008: Silence a bunch of annoying bogus dartanalyzer warnings. (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 | « no previous file | sky/sdk/lib/framework/rendering/object.dart » ('j') | 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 library fn; 5 library fn;
6 6
7 import 'app.dart'; 7 import 'app.dart';
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:collection'; 9 import 'dart:collection';
10 import 'dart:mirrors'; 10 import 'dart:mirrors';
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 329
330 OneChildRenderObjectWrapper({ this.child, Object key }) : super(key: key); 330 OneChildRenderObjectWrapper({ this.child, Object key }) : super(key: key);
331 331
332 void syncRenderObject(RenderObjectWrapper old) { 332 void syncRenderObject(RenderObjectWrapper old) {
333 super.syncRenderObject(old); 333 super.syncRenderObject(old);
334 UINode oldChild = old == null ? null : (old as OneChildRenderObjectWrapper). child; 334 UINode oldChild = old == null ? null : (old as OneChildRenderObjectWrapper). child;
335 syncChild(child, oldChild, null); 335 syncChild(child, oldChild, null);
336 } 336 }
337 337
338 void insert(RenderObjectWrapper child, dynamic slot) { 338 void insert(RenderObjectWrapper child, dynamic slot) {
339 final root = this.root; // TODO(ianh): Remove this once the analyzer is clev erer
339 assert(slot == null); 340 assert(slot == null);
341 assert(root is RenderObjectWithChildMixin);
340 root.child = child.root; 342 root.child = child.root;
343 assert(root == this.root); // TODO(ianh): Remove this once the analyzer is c leverer
341 } 344 }
342 345
343 void removeChild(UINode node) { 346 void removeChild(UINode node) {
347 final root = this.root; // TODO(ianh): Remove this once the analyzer is clev erer
348 assert(root is RenderObjectWithChildMixin);
344 root.child = null; 349 root.child = null;
345 super.removeChild(node); 350 super.removeChild(node);
351 assert(root == this.root); // TODO(ianh): Remove this once the analyzer is c leverer
346 } 352 }
347 353
348 void _remove() { 354 void _remove() {
349 if (child != null) 355 if (child != null)
350 removeChild(child); 356 removeChild(child);
351 super._remove(); 357 super._remove();
352 } 358 }
353 } 359 }
354 360
355 class Clip extends OneChildRenderObjectWrapper { 361 class Clip extends OneChildRenderObjectWrapper {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 Object key, 481 Object key,
476 List<UINode> children 482 List<UINode> children
477 }) : this.children = children == null ? _emptyList : children, 483 }) : this.children = children == null ? _emptyList : children,
478 super( 484 super(
479 key: key 485 key: key
480 ) { 486 ) {
481 assert(!_debugHasDuplicateIds()); 487 assert(!_debugHasDuplicateIds());
482 } 488 }
483 489
484 void insert(RenderObjectWrapper child, dynamic slot) { 490 void insert(RenderObjectWrapper child, dynamic slot) {
491 final root = this.root; // TODO(ianh): Remove this once the analyzer is clev erer
485 assert(slot == null || slot is RenderObject); 492 assert(slot == null || slot is RenderObject);
486 assert(root is ContainerRenderObjectMixin); 493 assert(root is ContainerRenderObjectMixin);
487 root.add(child.root, before: slot); 494 root.add(child.root, before: slot);
495 assert(root == this.root); // TODO(ianh): Remove this once the analyzer is c leverer
488 } 496 }
489 497
490 void removeChild(UINode node) { 498 void removeChild(UINode node) {
499 final root = this.root; // TODO(ianh): Remove this once the analyzer is clev erer
491 assert(root is ContainerRenderObjectMixin); 500 assert(root is ContainerRenderObjectMixin);
492 root.remove(node.root); 501 root.remove(node.root);
493 super.removeChild(node); 502 super.removeChild(node);
503 assert(root == this.root); // TODO(ianh): Remove this once the analyzer is c leverer
494 } 504 }
495 505
496 void _remove() { 506 void _remove() {
497 assert(children != null); 507 assert(children != null);
498 for (var child in children) { 508 for (var child in children) {
499 assert(child != null); 509 assert(child != null);
500 removeChild(child); 510 removeChild(child);
501 } 511 }
502 super._remove(); 512 super._remove();
503 } 513 }
(...skipping 10 matching lines...) Expand all
514 of another node, they must have unique keys. 524 of another node, they must have unique keys.
515 Duplicate: "${child._key}"'''; 525 Duplicate: "${child._key}"''';
516 } 526 }
517 } 527 }
518 return false; 528 return false;
519 } 529 }
520 530
521 void syncRenderObject(MultiChildRenderObjectWrapper old) { 531 void syncRenderObject(MultiChildRenderObjectWrapper old) {
522 super.syncRenderObject(old); 532 super.syncRenderObject(old);
523 533
534 final root = this.root; // TODO(ianh): Remove this once the analyzer is clev erer
524 if (root is! ContainerRenderObjectMixin) 535 if (root is! ContainerRenderObjectMixin)
525 return; 536 return;
526 537
527 var startIndex = 0; 538 var startIndex = 0;
528 var endIndex = children.length; 539 var endIndex = children.length;
529 540
530 var oldChildren = old == null ? [] : old.children; 541 var oldChildren = old == null ? [] : old.children;
531 var oldStartIndex = 0; 542 var oldStartIndex = 0;
532 var oldEndIndex = oldChildren.length; 543 var oldEndIndex = oldChildren.length;
533 544
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 ensureOldIdMap(); 601 ensureOldIdMap();
591 oldNode = oldNodeIdMap[currentNode._key]; 602 oldNode = oldNodeIdMap[currentNode._key];
592 if (oldNode == null) 603 if (oldNode == null)
593 return false; 604 return false;
594 605
595 oldNodeIdMap[currentNode._key] = null; // mark it reordered 606 oldNodeIdMap[currentNode._key] = null; // mark it reordered
596 assert(root is ContainerRenderObjectMixin); 607 assert(root is ContainerRenderObjectMixin);
597 assert(old.root is ContainerRenderObjectMixin); 608 assert(old.root is ContainerRenderObjectMixin);
598 assert(oldNode.root != null); 609 assert(oldNode.root != null);
599 610
600 old.root.remove(oldNode.root); 611 (old.root as ContainerRenderObjectMixin).remove(oldNode.root); // TODO(ian h): Remove cast once the analyzer is cleverer
601 root.add(oldNode.root, before: nextSibling); 612 root.add(oldNode.root, before: nextSibling);
602 613
603 return true; 614 return true;
604 } 615 }
605 616
606 // Scan forwards, this time we may re-order; 617 // Scan forwards, this time we may re-order;
607 nextSibling = root.firstChild; 618 nextSibling = root.firstChild;
608 while (startIndex < endIndex && oldStartIndex < oldEndIndex) { 619 while (startIndex < endIndex && oldStartIndex < oldEndIndex) {
609 currentNode = children[startIndex]; 620 currentNode = children[startIndex];
610 oldNode = oldChildren[oldStartIndex]; 621 oldNode = oldChildren[oldStartIndex];
(...skipping 21 matching lines...) Expand all
632 startIndex++; 643 startIndex++;
633 } 644 }
634 645
635 // Removals 646 // Removals
636 currentNode = null; 647 currentNode = null;
637 while (oldStartIndex < oldEndIndex) { 648 while (oldStartIndex < oldEndIndex) {
638 oldNode = oldChildren[oldStartIndex]; 649 oldNode = oldChildren[oldStartIndex];
639 removeChild(oldNode); 650 removeChild(oldNode);
640 advanceOldStartIndex(); 651 advanceOldStartIndex();
641 } 652 }
653
654 assert(root == this.root); // TODO(ianh): Remove this once the analyzer is c leverer
642 } 655 }
643 } 656 }
644 657
645 class BlockContainer extends MultiChildRenderObjectWrapper { 658 class BlockContainer extends MultiChildRenderObjectWrapper {
646 RenderBlock root; 659 RenderBlock root;
647 RenderBlock createNode() => new RenderBlock(); 660 RenderBlock createNode() => new RenderBlock();
648 661
649 BlockContainer({ Object key, List<UINode> children }) 662 BlockContainer({ Object key, List<UINode> children })
650 : super(key: key, children: children); 663 : super(key: key, children: children);
651 } 664 }
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 assert(root.parent is RenderView); 1030 assert(root.parent is RenderView);
1018 } 1031 }
1019 } 1032 }
1020 1033
1021 class Text extends Component { 1034 class Text extends Component {
1022 Text(this.data) : super(key: '*text*'); 1035 Text(this.data) : super(key: '*text*');
1023 final String data; 1036 final String data;
1024 bool get interchangeable => true; 1037 bool get interchangeable => true;
1025 UINode build() => new Paragraph(text: data); 1038 UINode build() => new Paragraph(text: data);
1026 } 1039 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/framework/rendering/object.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698