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 library org_dartlang_compiler_util; | 5 library org_dartlang_compiler_util; |
6 | 6 |
7 import 'util_implementation.dart'; | 7 import 'util_implementation.dart'; |
8 import 'characters.dart'; | 8 import 'characters.dart'; |
9 | 9 |
10 part 'link.dart'; | 10 part 'link.dart'; |
11 | 11 |
12 /** | 12 /** |
13 * Tagging interface for classes from which source spans can be generated. | 13 * Tagging interface for classes from which source spans can be generated. |
14 */ | 14 */ |
15 // TODO(johnniwinther): Find a better name. | 15 // TODO(johnniwinther): Find a better name. |
16 // TODO(ahe): How about "Bolt"? | 16 // TODO(ahe): How about "Bolt"? |
17 abstract class Spannable {} | 17 abstract class Spannable {} |
18 | 18 |
19 class SpannableAssertionFailure { | 19 class SpannableAssertionFailure { |
20 final Spannable node; | 20 final Spannable node; |
21 final String message; | 21 final String message; |
22 SpannableAssertionFailure(this.node, this.message); | 22 SpannableAssertionFailure(this.node, this.message); |
23 | 23 |
24 String toString() => 'compiler crashed.'; | 24 String toString() => 'Compiler crashed: $message.'; |
25 } | 25 } |
26 | 26 |
27 /// Writes the characters of [iterator] on [buffer]. The characters | 27 /// Writes the characters of [iterator] on [buffer]. The characters |
28 /// are escaped as suitable for JavaScript and JSON. [buffer] is | 28 /// are escaped as suitable for JavaScript and JSON. [buffer] is |
29 /// anything which supports [:add:] and [:addCharCode:], for example, | 29 /// anything which supports [:add:] and [:addCharCode:], for example, |
30 /// [StringBuffer]. | 30 /// [StringBuffer]. |
31 void writeJsonEscapedCharsOn(Iterator<int> iterator, buffer, onError(code)) { | 31 void writeJsonEscapedCharsOn(Iterator<int> iterator, buffer, onError(code)) { |
32 while (iterator.hasNext) { | 32 while (iterator.hasNext) { |
33 int code = iterator.next(); | 33 int code = iterator.next(); |
34 if (identical(code, $SQ)) { | 34 if (identical(code, $SQ)) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 buffer.add('0'); | 66 buffer.add('0'); |
67 } | 67 } |
68 } | 68 } |
69 buffer.add(code.toRadixString(16)); | 69 buffer.add(code.toRadixString(16)); |
70 } else { | 70 } else { |
71 buffer.addCharCode(code); | 71 buffer.addCharCode(code); |
72 } | 72 } |
73 } | 73 } |
74 } | 74 } |
75 } | 75 } |
OLD | NEW |