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

Side by Side Diff: test/dart_codegen/expect/convert/html_escape.dart

Issue 1038583004: Rationalize coercions (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase Created 5 years, 9 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
OLDNEW
1 part of dart.convert; 1 part of dart.convert;
2 const HtmlEscape HTML_ESCAPE = const HtmlEscape(); 2 const HtmlEscape HTML_ESCAPE = const HtmlEscape();
3 class HtmlEscapeMode {final String _name; 3 class HtmlEscapeMode {final String _name;
4 final bool escapeLtGt; 4 final bool escapeLtGt;
5 final bool escapeQuot; 5 final bool escapeQuot;
6 final bool escapeApos; 6 final bool escapeApos;
7 final bool escapeSlash; 7 final bool escapeSlash;
8 static const HtmlEscapeMode UNKNOWN = const HtmlEscapeMode._('unknown', true, t rue, true, true); 8 static const HtmlEscapeMode UNKNOWN = const HtmlEscapeMode._('unknown', true, t rue, true, true);
9 static const HtmlEscapeMode ATTRIBUTE = const HtmlEscapeMode._('attribute', fal se, true, false, false); 9 static const HtmlEscapeMode ATTRIBUTE = const HtmlEscapeMode._('attribute', fal se, true, false, false);
10 static const HtmlEscapeMode ELEMENT = const HtmlEscapeMode._('element', true, f alse, false, true); 10 static const HtmlEscapeMode ELEMENT = const HtmlEscapeMode._('element', true, f alse, false, true);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 } 47 }
48 return result != null ? result.toString() : null; 48 return result != null ? result.toString() : null;
49 } 49 }
50 StringConversionSink startChunkedConversion(Sink<String> sink) { 50 StringConversionSink startChunkedConversion(Sink<String> sink) {
51 if (sink is! StringConversionSink) { 51 if (sink is! StringConversionSink) {
52 sink = new StringConversionSink.from(sink); 52 sink = new StringConversionSink.from(sink);
53 } 53 }
54 return new _HtmlEscapeSink(this, DEVC$RT.cast(sink, DEVC$RT.type((Sink<String> _) { 54 return new _HtmlEscapeSink(this, DEVC$RT.cast(sink, DEVC$RT.type((Sink<String> _) {
55 } 55 }
56 ), StringConversionSink, "CastGeneral", """line 79, column 38 of dart:convert/ht ml_escape.dart: """, sink is StringConversionSink, true)); 56 ), StringConversionSink, "ImplicitCast", """line 79, column 38 of dart:convert/h tml_escape.dart: """, sink is StringConversionSink, true));
57 } 57 }
58 } 58 }
59 class _HtmlEscapeSink extends StringConversionSinkBase {final HtmlEscape _escap e; 59 class _HtmlEscapeSink extends StringConversionSinkBase {final HtmlEscape _escap e;
60 final StringConversionSink _sink; 60 final StringConversionSink _sink;
61 _HtmlEscapeSink(this._escape, this._sink); 61 _HtmlEscapeSink(this._escape, this._sink);
62 void addSlice(String chunk, int start, int end, bool isLast) { 62 void addSlice(String chunk, int start, int end, bool isLast) {
63 var val = _escape._convert(chunk, start, end); 63 var val = _escape._convert(chunk, start, end);
64 if (val == null) { 64 if (val == null) {
65 _sink.addSlice(chunk, start, end, isLast); 65 _sink.addSlice(chunk, start, end, isLast);
66 } 66 }
67 else { 67 else {
68 _sink.add(val); 68 _sink.add(val);
69 if (isLast) _sink.close(); 69 if (isLast) _sink.close();
70 } 70 }
71 } 71 }
72 void close() => _sink.close(); 72 void close() => _sink.close();
73 } 73 }
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/convert/encoding.dart ('k') | test/dart_codegen/expect/convert/json.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698