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

Unified Diff: test/dart_codegen/expect/convert/latin1.dart

Issue 1148283010: Remove dart backend (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/dart_codegen/expect/convert/json.dart ('k') | test/dart_codegen/expect/convert/line_splitter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/dart_codegen/expect/convert/latin1.dart
diff --git a/test/dart_codegen/expect/convert/latin1.dart b/test/dart_codegen/expect/convert/latin1.dart
deleted file mode 100644
index 3d6f2c3fee6aaff38336f44e4c5df05dd8ae4739..0000000000000000000000000000000000000000
--- a/test/dart_codegen/expect/convert/latin1.dart
+++ /dev/null
@@ -1,86 +0,0 @@
-part of dart.convert;
- const Latin1Codec LATIN1 = const Latin1Codec();
- const int _LATIN1_MASK = 0xFF;
- class Latin1Codec extends Encoding {final bool _allowInvalid;
- const Latin1Codec({
- bool allowInvalid : false}
-) : _allowInvalid = allowInvalid;
- String get name => "iso-8859-1";
- String decode(List<int> bytes, {
- bool allowInvalid}
-) {
- if (allowInvalid == null) allowInvalid = _allowInvalid;
- if (allowInvalid) {
- return const Latin1Decoder(allowInvalid: true).convert(bytes);
- }
- else {
- return const Latin1Decoder(allowInvalid: false).convert(bytes);
- }
- }
- Converter<String, List<int>> get encoder => const Latin1Encoder();
- Converter<List<int>, String> get decoder => _allowInvalid ? const Latin1Decoder(allowInvalid: true) : const Latin1Decoder(allowInvalid: false);
-}
- class Latin1Encoder extends _UnicodeSubsetEncoder {const Latin1Encoder() : super(_LATIN1_MASK);
-}
- class Latin1Decoder extends _UnicodeSubsetDecoder {const Latin1Decoder({
-bool allowInvalid : false}
-) : super(allowInvalid, _LATIN1_MASK);
- ByteConversionSink startChunkedConversion(Sink<String> sink) {
-StringConversionSink stringSink;
- if (sink is StringConversionSink) {
-stringSink = sink;
-}
- else {
-stringSink = new StringConversionSink.from(sink);
-}
- if (!_allowInvalid) return new _Latin1DecoderSink(stringSink);
- return new _Latin1AllowInvalidDecoderSink(stringSink);
-}
-}
- class _Latin1DecoderSink extends ByteConversionSinkBase {StringConversionSink _sink;
- _Latin1DecoderSink(this._sink);
- void close() {
-_sink.close();
-}
- void add(List<int> source) {
-addSlice(source, 0, source.length, false);
-}
- void _addSliceToSink(List<int> source, int start, int end, bool isLast) {
-_sink.add(new String.fromCharCodes(source, start, end));
- if (isLast) close();
-}
- void addSlice(List<int> source, int start, int end, bool isLast) {
-RangeError.checkValidRange(start, end, source.length);
- for (int i = start; i < end; i++) {
-int char = source[i];
- if (char > _LATIN1_MASK || char < 0) {
-throw new FormatException("Source contains non-Latin-1 characters.");
-}
-}
- if (start < end) {
-_addSliceToSink(source, start, end, isLast);
-}
- if (isLast) {
-close();
-}
-}
-}
- class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink {_Latin1AllowInvalidDecoderSink(StringConversionSink sink) : super(sink);
- void addSlice(List<int> source, int start, int end, bool isLast) {
-RangeError.checkValidRange(start, end, source.length);
- for (int i = start; i < end; i++) {
-int char = source[i];
- if (char > _LATIN1_MASK || char < 0) {
-if (i > start) _addSliceToSink(source, start, i, false);
- _addSliceToSink(const <int> [0xFFFD], 0, 1, false);
- start = i + 1;
-}
-}
- if (start < end) {
-_addSliceToSink(source, start, end, isLast);
-}
- if (isLast) {
-close();
-}
-}
-}
« no previous file with comments | « test/dart_codegen/expect/convert/json.dart ('k') | test/dart_codegen/expect/convert/line_splitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698