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

Side by Side Diff: frog/leg/tree/nodes.dart

Issue 9427012: Allow binary operators on compile-time-constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 interface Visitor<R> { 5 interface Visitor<R> {
6 R visitBlock(Block node); 6 R visitBlock(Block node);
7 R visitBreakStatement(BreakStatement node); 7 R visitBreakStatement(BreakStatement node);
8 R visitCatchBlock(CatchBlock node); 8 R visitCatchBlock(CatchBlock node);
9 R visitClassNode(ClassNode node); 9 R visitClassNode(ClassNode node);
10 R visitConditional(Conditional node); 10 R visitConditional(Conditional node);
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 new RawSourceDartString(source, length); 696 new RawSourceDartString(source, length);
697 factory DartString.escapedString(SourceString source, int length) => 697 factory DartString.escapedString(SourceString source, int length) =>
698 new EscapedSourceDartString(source, length); 698 new EscapedSourceDartString(source, length);
699 DartString(); 699 DartString();
700 abstract int get length(); 700 abstract int get length();
701 bool isEmpty() => length == 0; 701 bool isEmpty() => length == 0;
702 // TODO(lrn): Is this test too expensive? 702 // TODO(lrn): Is this test too expensive?
703 bool definitelyEquals(DartString other) => toString() == other.toString(); 703 bool definitelyEquals(DartString other) => toString() == other.toString();
704 abstract Iterator<int> iterator(); 704 abstract Iterator<int> iterator();
705 abstract String toString(); 705 abstract String toString();
706
707 bool operator ==(var other) {
708 if (other is !DartString) return false;
709 DartString otherString = other;
710 if (length != otherString.length) return false;
711 Iterator it1 = iterator();
712 Iterator it2 = otherString.iterator();
713 while (it1.hasNext()) {
714 assert(it2.hasNext());
ngeoffray 2012/02/21 11:22:09 I find this assert and the one line 717 too much.
floitsch 2012/02/22 10:17:51 Done.
715 if (it1.next() != it2.next()) return false;
716 }
717 assert(!it2.hasNext());
718 return true;
719 }
706 } 720 }
707 721
708 class LiteralDartString extends DartString { 722 class LiteralDartString extends DartString {
709 final String string; 723 final String string;
710 LiteralDartString(this.string); 724 LiteralDartString(this.string);
711 int get length() => string.length; 725 int get length() => string.length;
712 Iterator<int> iterator() => new StringCodeIterator(string); 726 Iterator<int> iterator() => new StringCodeIterator(string);
713 String toString() => string; 727 String toString() => string;
714 } 728 }
715 729
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 static bool isConstructorRedirect(Send node) { 1489 static bool isConstructorRedirect(Send node) {
1476 return (node.receiver === null && 1490 return (node.receiver === null &&
1477 node.selector.asIdentifier() !== null && 1491 node.selector.asIdentifier() !== null &&
1478 node.selector.asIdentifier().isThis()) || 1492 node.selector.asIdentifier().isThis()) ||
1479 (node.receiver !== null && 1493 (node.receiver !== null &&
1480 node.receiver.asIdentifier() !== null && 1494 node.receiver.asIdentifier() !== null &&
1481 node.receiver.asIdentifier().isThis() && 1495 node.receiver.asIdentifier().isThis() &&
1482 node.selector.asIdentifier() !== null); 1496 node.selector.asIdentifier() !== null);
1483 } 1497 }
1484 } 1498 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698