Revert "Dart SDK roll for 2018/07/26 (#5876)" (flutter/engine#5881)

This reverts commit a64160715f.
This commit is contained in:
Ben Konyi
2018-07-26 15:09:23 -07:00
committed by GitHub
parent 0295aab475
commit e690f59b65
4 changed files with 87 additions and 87 deletions

View File

@@ -26,7 +26,7 @@ enum FileType {
typedef Reader = List<int> Function();
class BytesOf extends Key { BytesOf(dynamic value) : super(value); }
class utf8Of extends Key { utf8Of(dynamic value) : super(value); }
class UTF8Of extends Key { UTF8Of(dynamic value) : super(value); }
class Latin1Of extends Key { Latin1Of(dynamic value) : super(value); }
bool matchesSignature(List<int> bytes, List<int> signature) {
@@ -59,7 +59,7 @@ const String kMultiLicenseFileHeader = 'Notices for files contained in';
bool isMultiLicenseNotice(Reader reader) {
List<int> bytes = reader();
return (ascii.decode(bytes.take(kMultiLicenseFileHeader.length).toList(), allowInvalid: true) == kMultiLicenseFileHeader);
return (ASCII.decode(bytes.take(kMultiLicenseFileHeader.length).toList(), allowInvalid: true) == kMultiLicenseFileHeader);
}
FileType identifyFile(String name, Reader reader) {
@@ -114,7 +114,7 @@ FileType identifyFile(String name, Reader reader) {
case 'tzdata': return FileType.binary;
case 'compressed_atrace_data.txt': return FileType.binary;
// Source files that don't use UTF-8
case 'Messages_de_DE.properties': // has a few non-ascii characters they forgot to escape (from gnu-libstdc++)
case 'Messages_de_DE.properties': // has a few non-ASCII characters they forgot to escape (from gnu-libstdc++)
case 'mmx_blendtmp.h': // author name in comment contains latin1 (mesa)
case 'calling_convention.txt': // contains a soft hyphen instead of a real hyphen for some reason (mesa)
// Character encoding data files
@@ -310,11 +310,11 @@ abstract class TextFile extends File {
}
// mixin
abstract class utf8TextFile extends TextFile {
abstract class UTF8TextFile extends TextFile {
@override
String readString() {
try {
return cache(new utf8Of(this), () => utf8.decode(readBytes()));
return cache(new UTF8Of(this), () => UTF8.decode(readBytes()));
} on FormatException {
print(fullName);
rethrow;
@@ -330,15 +330,15 @@ abstract class Latin1TextFile extends TextFile {
final List<int> bytes = readBytes();
if (bytes.any((int byte) => byte == 0x00))
throw '$fullName contains a U+0000 NULL and is probably not actually encoded as Win1252';
bool isutf8 = false;
bool isUTF8 = false;
try {
cache(new utf8Of(this), () => utf8.decode(readBytes()));
isutf8 = true;
cache(new UTF8Of(this), () => UTF8.decode(readBytes()));
isUTF8 = true;
} on FormatException {
}
if (isutf8)
if (isUTF8)
throw '$fullName contains valid UTF-8 and is probably not actually encoded as Win1252';
return latin1.decode(bytes);
return LATIN1.decode(bytes);
});
}
}
@@ -460,7 +460,7 @@ class FileSystemDirectory extends IoNode implements Directory {
case FileType.tar: yield new FileSystemTarFile(fileEntity); break;
case FileType.gz: yield new FileSystemGZipFile(fileEntity); break;
case FileType.bzip2: yield new FileSystemBZip2File(fileEntity); break;
case FileType.text: yield new FileSystemutf8TextFile(fileEntity); break;
case FileType.text: yield new FileSystemUTF8TextFile(fileEntity); break;
case FileType.latin1Text: yield new FileSystemLatin1TextFile(fileEntity); break;
case FileType.metadata: break; // ignore this file
}
@@ -499,8 +499,8 @@ class FileSystemFile extends IoNode implements File {
}
}
class FileSystemutf8TextFile extends FileSystemFile with utf8TextFile {
FileSystemutf8TextFile(io.File file) : super(file);
class FileSystemUTF8TextFile extends FileSystemFile with UTF8TextFile {
FileSystemUTF8TextFile(io.File file) : super(file);
}
class FileSystemLatin1TextFile extends FileSystemFile with Latin1TextFile {
@@ -554,7 +554,7 @@ class ArchiveDirectory extends IoNode implements Directory {
case FileType.tar: _files.add(new ArchiveTarFile(entryFullName, entry)); break;
case FileType.gz: _files.add(new ArchiveGZipFile(entryFullName, entry)); break;
case FileType.bzip2: _files.add(new ArchiveBZip2File(entryFullName, entry)); break;
case FileType.text: _files.add(new Archiveutf8TextFile(entryFullName, entry)); break;
case FileType.text: _files.add(new ArchiveUTF8TextFile(entryFullName, entry)); break;
case FileType.latin1Text: _files.add(new ArchiveLatin1TextFile(entryFullName, entry)); break;
case FileType.metadata: break; // ignore this file
}
@@ -595,8 +595,8 @@ class ArchiveFile extends IoNode implements File {
}
}
class Archiveutf8TextFile extends ArchiveFile with utf8TextFile {
Archiveutf8TextFile(String fullName, a.ArchiveFile file) : super(fullName, file);
class ArchiveUTF8TextFile extends ArchiveFile with UTF8TextFile {
ArchiveUTF8TextFile(String fullName, a.ArchiveFile file) : super(fullName, file);
}
class ArchiveLatin1TextFile extends ArchiveFile with Latin1TextFile {
@@ -634,7 +634,7 @@ class InMemoryFile extends IoNode implements File {
case FileType.tar: return new InMemoryTarFile(fullName, bytes); break;
case FileType.gz: return new InMemoryGZipFile(fullName, bytes); break;
case FileType.bzip2: return new InMemoryBZip2File(fullName, bytes); break;
case FileType.text: return new InMemoryutf8TextFile(fullName, bytes); break;
case FileType.text: return new InMemoryUTF8TextFile(fullName, bytes); break;
case FileType.latin1Text: return new InMemoryLatin1TextFile(fullName, bytes); break;
case FileType.metadata: break; // ignore this file
}
@@ -654,8 +654,8 @@ class InMemoryFile extends IoNode implements File {
List<int> readBytes() => _bytes;
}
class InMemoryutf8TextFile extends InMemoryFile with utf8TextFile {
InMemoryutf8TextFile(String fullName, List<int> file) : super(fullName, file);
class InMemoryUTF8TextFile extends InMemoryFile with UTF8TextFile {
InMemoryUTF8TextFile(String fullName, List<int> file) : super(fullName, file);
}
class InMemoryLatin1TextFile extends InMemoryFile with Latin1TextFile {

View File

@@ -322,25 +322,25 @@ abstract class License implements Comparable<License> {
throw 'incomplete license detected:\n---\n$body\n---';
// if (type == LicenseType.unknown)
// print('need detector for:\n----\n$body\n----');
bool isutf8 = true;
bool isUTF8 = true;
List<int> latin1Encoded;
try {
latin1Encoded = latin1.encode(body);
isutf8 = false;
latin1Encoded = LATIN1.encode(body);
isUTF8 = false;
} on ArgumentError { }
if (!isutf8) {
if (!isUTF8) {
bool isAscii = false;
try {
ascii.decode(latin1Encoded);
ASCII.decode(latin1Encoded);
isAscii = true;
} on FormatException { }
if (isAscii)
return;
try {
utf8.decode(latin1Encoded);
isutf8 = true;
UTF8.decode(latin1Encoded);
isUTF8 = true;
} on FormatException { }
if (isutf8)
if (isUTF8)
throw 'tried to create a License object with text that appears to have been misdecoded as Latin1 instead of as UTF-8:\n$body';
}
}

View File

@@ -92,7 +92,7 @@ class RepositorySourceFile extends RepositoryLicensedFile {
try {
contents = io.readString();
} on FormatException {
print('non-utf8 data in $io');
print('non-UTF8 data in $io');
system.exit(2);
}
_licenses = determineLicensesFor(contents, name, parent, origin: '$this');
@@ -736,33 +736,33 @@ class RepositoryMultiLicenseNoticesForFilesFile extends RepositoryLicenseFile {
// "Notices for files contained in the"
// ...then have a second line which is 60 "=" characters
final List<List<int>> contents = splitIntList(io.readBytes(), 0x0A).toList();
if (!ascii.decode(contents[0]).startsWith('Notices for files contained in') ||
ascii.decode(contents[1]) != '============================================================\n')
if (!ASCII.decode(contents[0]).startsWith('Notices for files contained in') ||
ASCII.decode(contents[1]) != '============================================================\n')
throw 'unrecognised syntax: ${io.fullName}';
int index = 2;
while (index < contents.length) {
if (ascii.decode(contents[index]) != 'Notices for file(s):\n')
if (ASCII.decode(contents[index]) != 'Notices for file(s):\n')
throw 'unrecognised syntax on line ${index + 1}: ${io.fullName}';
index += 1;
final List<String> names = <String>[];
do {
names.add(ascii.decode(contents[index]));
names.add(ASCII.decode(contents[index]));
index += 1;
} while (ascii.decode(contents[index]) != '------------------------------------------------------------\n');
} while (ASCII.decode(contents[index]) != '------------------------------------------------------------\n');
index += 1;
final List<List<int>> body = <List<int>>[];
do {
body.add(contents[index]);
index += 1;
} while (index < contents.length &&
ascii.decode(contents[index], allowInvalid: true) != '============================================================\n');
ASCII.decode(contents[index], allowInvalid: true) != '============================================================\n');
index += 1;
final List<int> bodyBytes = body.expand((List<int> line) => line).toList();
String bodyText;
try {
bodyText = utf8.decode(bodyBytes);
bodyText = UTF8.decode(bodyBytes);
} on FormatException {
bodyText = latin1.decode(bodyBytes);
bodyText = LATIN1.decode(bodyBytes);
}
License license = new License.unique(bodyText, LicenseType.unknown, origin: io.fullName);
for (String name in names) {
@@ -2545,7 +2545,7 @@ Future<Null> main(List<String> arguments) async {
system.File goldenFile = new system.File(
path.join(argResults['golden'], 'licenses_${component.io.name}'));
String goldenSignature = await goldenFile.openRead()
.transform(utf8.decoder).transform(new LineSplitter()).first;
.transform(UTF8.decoder).transform(new LineSplitter()).first;
Match goldenMatch = signaturePattern.matchAsPrefix(goldenSignature);
if (goldenMatch != null && goldenMatch.group(1) == signature) {
system.stderr.writeln(' Skipping this component - no change in signature');