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

Side by Side Diff: lib/compiler/implementation/elements/elements.dart

Issue 10916172: num implements Comparable and Hashable. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
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('dart:uri'); 7 #import('dart:uri');
8 8
9 #import('../tree/tree.dart'); 9 #import('../tree/tree.dart');
10 #import('../scanner/scannerlib.dart'); 10 #import('../scanner/scannerlib.dart');
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 // TODO(ahe): Remove this case: Legacy support for pre-0.11 spec. 1543 // TODO(ahe): Remove this case: Legacy support for pre-0.11 spec.
1544 return selector; 1544 return selector;
1545 } else if (str === '?') { 1545 } else if (str === '?') {
1546 return selector; 1546 return selector;
1547 } else { 1547 } else {
1548 throw new Exception('Unhandled selector: ${selector.slowToString()}'); 1548 throw new Exception('Unhandled selector: ${selector.slowToString()}');
1549 } 1549 }
1550 return new SourceString('operator\$$str'); 1550 return new SourceString('operator\$$str');
1551 } 1551 }
1552 1552
1553 static bool isStringSupertype(Element element, Compiler compiler) { 1553 static bool isNumberOrStringSupertype(Element element, Compiler compiler) {
1554 LibraryElement coreLibrary = compiler.coreLibrary; 1554 LibraryElement coreLibrary = compiler.coreLibrary;
1555 return (element == coreLibrary.find(const SourceString('Comparable'))) 1555 return (element == coreLibrary.find(const SourceString('Comparable')))
1556 || (element == coreLibrary.find(const SourceString('Hashable'))) 1556 || (element == coreLibrary.find(const SourceString('Hashable')));
1557 || (element == coreLibrary.find(const SourceString('Pattern'))); 1557 }
1558
1559 static bool isStringOnlySupertype(Element element, Compiler compiler) {
1560 LibraryElement coreLibrary = compiler.coreLibrary;
1561 return element == coreLibrary.find(const SourceString('Pattern'));
1558 } 1562 }
1559 1563
1560 static bool isListSupertype(Element element, Compiler compiler) { 1564 static bool isListSupertype(Element element, Compiler compiler) {
1561 LibraryElement coreLibrary = compiler.coreLibrary; 1565 LibraryElement coreLibrary = compiler.coreLibrary;
1562 return (element == coreLibrary.find(const SourceString('Collection'))) 1566 return (element == coreLibrary.find(const SourceString('Collection')))
1563 || (element == coreLibrary.find(const SourceString('Iterable'))); 1567 || (element == coreLibrary.find(const SourceString('Iterable')));
1564 } 1568 }
1565 } 1569 }
1566 1570
1567 class LabelElement extends Element { 1571 class LabelElement extends Element {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1683 1687
1684 MetadataAnnotation ensureResolved(Compiler compiler) { 1688 MetadataAnnotation ensureResolved(Compiler compiler) {
1685 if (resolutionState == STATE_NOT_STARTED) { 1689 if (resolutionState == STATE_NOT_STARTED) {
1686 compiler.resolver.resolveMetadataAnnotation(this); 1690 compiler.resolver.resolveMetadataAnnotation(this);
1687 } 1691 }
1688 return this; 1692 return this;
1689 } 1693 }
1690 1694
1691 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 1695 String toString() => 'MetadataAnnotation($value, $resolutionState)';
1692 } 1696 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698