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

Side by Side Diff: pkg/compiler/lib/src/elements/elements.dart

Issue 1293953006: Refactor qualified send sets. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 elements; 5 library elements;
6 6
7 import '../compiler.dart' show 7 import '../compiler.dart' show
8 Compiler, 8 Compiler,
9 isPrivateName; 9 isPrivateName;
10 import '../constants/constructors.dart'; 10 import '../constants/constructors.dart';
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 if (element.isNative) return true; 514 if (element.isNative) return true;
515 assert(element.isResolved); 515 assert(element.isResolved);
516 return isNativeOrExtendsNative(element.superclass); 516 return isNativeOrExtendsNative(element.superclass);
517 } 517 }
518 518
519 static bool isInstanceSend(Send send, TreeElements elements) { 519 static bool isInstanceSend(Send send, TreeElements elements) {
520 Element element = elements[send]; 520 Element element = elements[send];
521 if (element == null) return !isClosureSend(send, element); 521 if (element == null) return !isClosureSend(send, element);
522 return isInstanceMethod(element) || 522 return isInstanceMethod(element) ||
523 isInstanceField(element) || 523 isInstanceField(element) ||
524 send.isConditional; 524 (send.isConditional && !element.isStatic);
Siggi Cherem (dart-lang) 2015/08/24 21:25:17 I think it should be fine to delete this whole lin
Johnni Winther 2015/08/25 07:25:58 This makes C?.foo _not_ an instance-send.
Siggi Cherem (dart-lang) 2015/08/25 15:48:06 I'm probably missing something - isInstanceMethod
Johnni Winther 2015/08/26 07:18:35 Ahh. I didn't go into the cases of isInstanceMetho
525 } 525 }
526 526
527 static bool isClosureSend(Send send, Element element) { 527 static bool isClosureSend(Send send, Element element) {
528 if (send.isPropertyAccess) return false; 528 if (send.isPropertyAccess) return false;
529 if (send.receiver != null) return false; 529 if (send.receiver != null) return false;
530 Node selector = send.selector; 530 Node selector = send.selector;
531 // this(). 531 // this().
532 if (selector.isThis()) return true; 532 if (selector.isThis()) return true;
533 // (o)() or foo()(). 533 // (o)() or foo()().
534 if (element == null && selector.asIdentifier() == null) return true; 534 if (element == null && selector.asIdentifier() == null) return true;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 if (identical(op, '<<=')) return '<<'; 653 if (identical(op, '<<=')) return '<<';
654 if (identical(op, '>>=')) return '>>'; 654 if (identical(op, '>>=')) return '>>';
655 if (identical(op, '&=')) return '&'; 655 if (identical(op, '&=')) return '&';
656 if (identical(op, '^=')) return '^'; 656 if (identical(op, '^=')) return '^';
657 if (identical(op, '|=')) return '|'; 657 if (identical(op, '|=')) return '|';
658 if (identical(op, '??=')) return '??'; 658 if (identical(op, '??=')) return '??';
659 659
660 return null; 660 return null;
661 } 661 }
662 662
663 static String mapToUserOperator(String op) {
664 String userOperator = mapToUserOperatorOrNull(op);
665 if (userOperator == null) throw 'Unhandled operator: $op';
666 else return userOperator;
667 }
668
669 static bool isNumberOrStringSupertype(Element element, Compiler compiler) { 663 static bool isNumberOrStringSupertype(Element element, Compiler compiler) {
670 LibraryElement coreLibrary = compiler.coreLibrary; 664 LibraryElement coreLibrary = compiler.coreLibrary;
671 return (element == coreLibrary.find('Comparable')); 665 return (element == coreLibrary.find('Comparable'));
672 } 666 }
673 667
674 static bool isStringOnlySupertype(Element element, Compiler compiler) { 668 static bool isStringOnlySupertype(Element element, Compiler compiler) {
675 LibraryElement coreLibrary = compiler.coreLibrary; 669 LibraryElement coreLibrary = compiler.coreLibrary;
676 return element == coreLibrary.find('Pattern'); 670 return element == coreLibrary.find('Pattern');
677 } 671 }
678 672
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 bool get isDeclaredByField; 1651 bool get isDeclaredByField;
1658 1652
1659 /// Returns `true` if this member is abstract. 1653 /// Returns `true` if this member is abstract.
1660 bool get isAbstract; 1654 bool get isAbstract;
1661 1655
1662 /// If abstract, [implementation] points to the overridden concrete member, 1656 /// If abstract, [implementation] points to the overridden concrete member,
1663 /// if any. Otherwise [implementation] points to the member itself. 1657 /// if any. Otherwise [implementation] points to the member itself.
1664 Member get implementation; 1658 Member get implementation;
1665 } 1659 }
1666 1660
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/resolution/members.dart » ('j') | pkg/compiler/lib/src/resolution/members.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698