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

Side by Side Diff: dart/lib/compiler/implementation/tree/dartstring.dart

Issue 10880040: Support abstract getters without parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update language.status 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 /** 5 /**
6 * The [DartString] type represents a Dart string value as a sequence of Unicode 6 * The [DartString] type represents a Dart string value as a sequence of Unicode
7 * Scalar Values. 7 * Scalar Values.
8 * After parsing, any valid [LiteralString] will contain a [DartString] 8 * After parsing, any valid [LiteralString] will contain a [DartString]
9 * representing its content after removing quotes and resolving escapes in 9 * representing its content after removing quotes and resolving escapes in
10 * its source. 10 * its source.
11 */ 11 */
12 class DartString implements Iterable<int> { 12 class DartString implements Iterable<int> {
13 factory DartString.empty() => const LiteralDartString(""); 13 factory DartString.empty() => const LiteralDartString("");
14 // This is a convenience constructor. If you need a const literal DartString, 14 // This is a convenience constructor. If you need a const literal DartString,
15 // use [const LiteralDartString(string)] directly. 15 // use [const LiteralDartString(string)] directly.
16 factory DartString.literal(String string) => new LiteralDartString(string); 16 factory DartString.literal(String string) => new LiteralDartString(string);
17 factory DartString.rawString(SourceString source, int length) => 17 factory DartString.rawString(SourceString source, int length) =>
18 new RawSourceDartString(source, length); 18 new RawSourceDartString(source, length);
19 factory DartString.escapedString(SourceString source, int length) => 19 factory DartString.escapedString(SourceString source, int length) =>
20 new EscapedSourceDartString(source, length); 20 new EscapedSourceDartString(source, length);
21 factory DartString.concat(DartString first, DartString second) { 21 factory DartString.concat(DartString first, DartString second) {
22 if (first.isEmpty()) return second; 22 if (first.isEmpty()) return second;
23 if (second.isEmpty()) return first; 23 if (second.isEmpty()) return first;
24 return new ConsDartString(first, second); 24 return new ConsDartString(first, second);
25 } 25 }
26 const DartString(); 26 const DartString();
27 abstract int get length(); 27 abstract int get length;
28 bool isEmpty() => length == 0; 28 bool isEmpty() => length == 0;
29 abstract Iterator<int> iterator(); 29 abstract Iterator<int> iterator();
30 abstract String slowToString(); 30 abstract String slowToString();
31 31
32 bool operator ==(var other) { 32 bool operator ==(var other) {
33 if (other is !DartString) return false; 33 if (other is !DartString) return false;
34 DartString otherString = other; 34 DartString otherString = other;
35 if (length != otherString.length) return false; 35 if (length != otherString.length) return false;
36 Iterator it1 = iterator(); 36 Iterator it1 = iterator();
37 Iterator it2 = otherString.iterator(); 37 Iterator it2 = otherString.iterator();
38 while (it1.hasNext()) { 38 while (it1.hasNext()) {
39 if (it1.next() != it2.next()) return false; 39 if (it1.next() != it2.next()) return false;
40 } 40 }
41 return true; 41 return true;
42 } 42 }
43 String toString() => "DartString#${length}:${slowToString()}"; 43 String toString() => "DartString#${length}:${slowToString()}";
44 abstract SourceString get source(); 44 abstract SourceString get source;
45 } 45 }
46 46
47 47
48 /** 48 /**
49 * A [DartString] where the content is represented by an actual [String]. 49 * A [DartString] where the content is represented by an actual [String].
50 */ 50 */
51 class LiteralDartString extends DartString { 51 class LiteralDartString extends DartString {
52 final String string; 52 final String string;
53 const LiteralDartString(this.string); 53 const LiteralDartString(this.string);
54 int get length => string.length; 54 int get length => string.length;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 for (int i = 0; i < 3; i++) { 200 for (int i = 0; i < 3; i++) {
201 code = source.next(); 201 code = source.next();
202 value = value * 16 + hexDigitValue(code); 202 value = value * 16 + hexDigitValue(code);
203 } 203 }
204 return value; 204 return value;
205 } 205 }
206 return code; 206 return code;
207 } 207 }
208 } 208 }
209 209
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/ssa/nodes.dart ('k') | dart/lib/compiler/implementation/tree/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698