OLD | NEW |
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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 if (other is !DartString) return false; | 745 if (other is !DartString) return false; |
746 DartString otherString = other; | 746 DartString otherString = other; |
747 if (length != otherString.length) return false; | 747 if (length != otherString.length) return false; |
748 Iterator it1 = iterator(); | 748 Iterator it1 = iterator(); |
749 Iterator it2 = otherString.iterator(); | 749 Iterator it2 = otherString.iterator(); |
750 while (it1.hasNext()) { | 750 while (it1.hasNext()) { |
751 if (it1.next() != it2.next()) return false; | 751 if (it1.next() != it2.next()) return false; |
752 } | 752 } |
753 return true; | 753 return true; |
754 } | 754 } |
755 String toString() => "DartString#${length()}:${slowToString()}"; | 755 String toString() => "DartString#${length}:${slowToString()}"; |
756 abstract SourceString get source(); | 756 abstract SourceString get source(); |
757 } | 757 } |
758 | 758 |
759 class LiteralDartString extends DartString { | 759 class LiteralDartString extends DartString { |
760 final String string; | 760 final String string; |
761 const LiteralDartString(this.string); | 761 const LiteralDartString(this.string); |
762 int get length() => string.length; | 762 int get length() => string.length; |
763 Iterator<int> iterator() => new StringCodeIterator(string); | 763 Iterator<int> iterator() => new StringCodeIterator(string); |
764 String slowToString() => string; | 764 String slowToString() => string; |
765 SourceString get source() => new StringWrapper(string); | 765 SourceString get source() => new StringWrapper(string); |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 static bool isConstructorRedirect(Send node) { | 1707 static bool isConstructorRedirect(Send node) { |
1708 return (node.receiver === null && | 1708 return (node.receiver === null && |
1709 node.selector.asIdentifier() !== null && | 1709 node.selector.asIdentifier() !== null && |
1710 node.selector.asIdentifier().isThis()) || | 1710 node.selector.asIdentifier().isThis()) || |
1711 (node.receiver !== null && | 1711 (node.receiver !== null && |
1712 node.receiver.asIdentifier() !== null && | 1712 node.receiver.asIdentifier() !== null && |
1713 node.receiver.asIdentifier().isThis() && | 1713 node.receiver.asIdentifier().isThis() && |
1714 node.selector.asIdentifier() !== null); | 1714 node.selector.asIdentifier() !== null); |
1715 } | 1715 } |
1716 } | 1716 } |
OLD | NEW |