lints 2.0 fixes

In anticipation of lints v 2.0.

(Note the ignores -- I was leery of making API changes but happy to with some guidance.)

See: https://dart-review.googlesource.com/c/sdk/+/237746

Change-Id: I93323e912911bbd62a583b379f0f8140a8ca448d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237764
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
pq 2022-03-17 23:41:27 +00:00 committed by Commit Bot
parent b036052077
commit 47ac47fe90
4 changed files with 20 additions and 10 deletions

View file

@ -244,9 +244,9 @@ void find(ArgResults options) {
final addr = dwarf.virtualAddressOf(offset);
final frames = dwarf
.callInfoFor(addr, includeInternalFrames: verbose)
?.map((CallInfo c) => ' ' + c.toString());
?.map((CallInfo c) => ' $c');
final addrString =
addr > 0 ? '0x' + addr.toRadixString(16) : addr.toString();
addr > 0 ? '0x${addr.toRadixString(16)}' : addr.toString();
print('For virtual address $addrString:');
if (frames == null) {
print(' Invalid virtual address.');
@ -283,7 +283,7 @@ Future<void> translate(ArgResults options) async {
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform(DwarfStackTraceDecoder(dwarf, includeInternalFrames: verbose))
.map((s) => s + '\n')
.map((s) => '$s\n')
.transform(utf8.encoder);
await output.addStream(convertedStream);

View file

@ -165,7 +165,7 @@ class _Attribute {
case _AttributeForm.flag:
return value.toString();
case _AttributeForm.address:
return '0x' + paddedHex(value as int, unit?.header.addressSize ?? 0);
return '0x${paddedHex(value as int, unit?.header.addressSize ?? 0)}';
case _AttributeForm.sectionOffset:
return paddedHex(value as int, 4);
case _AttributeForm.constant:
@ -274,6 +274,7 @@ class _AbbreviationsTable {
class DebugInformationEntry {
// The index of the entry in the abbreviation table for this DIE.
final int code;
// ignore: library_private_types_in_public_api
final Map<_Attribute, Object> attributes;
final Map<int, DebugInformationEntry> children;
@ -310,8 +311,10 @@ class DebugInformationEntry {
return null;
}
// ignore: library_private_types_in_public_api
bool containsKey(_AttributeName name) => _namedAttribute(name) != null;
// ignore: library_private_types_in_public_api
Object? operator [](_AttributeName name) => attributes[_namedAttribute(name)];
int? get sectionOffset => this[_AttributeName.statementList] as int?;
@ -408,7 +411,7 @@ class DebugInformationEntry {
..write(' (at offset 0x')
..write(paddedHex(offset))
..writeln('):');
child.writeToStringBuffer(buffer, unit: unit, indent: indent + ' ');
child.writeToStringBuffer(buffer, unit: unit, indent: '$indent ');
}
}
}
@ -426,13 +429,16 @@ class CompilationUnitHeader {
final int version;
final int abbreviationsOffset;
final int addressSize;
// ignore: library_private_types_in_public_api
final _AbbreviationsTable abbreviations;
CompilationUnitHeader._(this.size, this.version, this.abbreviationsOffset,
this.addressSize, this.abbreviations);
static CompilationUnitHeader? fromReader(
Reader reader, Map<int, _AbbreviationsTable> abbreviationsTables) {
Reader reader,
// ignore: library_private_types_in_public_api
Map<int, _AbbreviationsTable> abbreviationsTables) {
final size = _initialLengthValue(reader);
// An empty unit is an ending marker.
if (size == 0) return null;
@ -481,7 +487,9 @@ class CompilationUnit {
CompilationUnit._(this.header, this.referenceTable);
static CompilationUnit? fromReader(
Reader reader, Map<int, _AbbreviationsTable> abbreviationsTables) {
Reader reader,
// ignore: library_private_types_in_public_api
Map<int, _AbbreviationsTable> abbreviationsTables) {
final header =
CompilationUnitHeader.fromReader(reader, abbreviationsTables);
if (header == null) return null;
@ -553,7 +561,9 @@ class DebugInfo {
DebugInfo._(this.units);
static DebugInfo fromReader(
Reader reader, Map<int, _AbbreviationsTable> abbreviationsTable) {
Reader reader,
// ignore: library_private_types_in_public_api
Map<int, _AbbreviationsTable> abbreviationsTable) {
final units = reader
.readRepeated(
(r) => CompilationUnit.fromReader(reader, abbreviationsTable))

View file

@ -102,7 +102,7 @@ class Text {
String render(int width) {
if (value.length > width) {
// Narrowed column.
return value.substring(0, width - 2) + '..';
return '${value.substring(0, width - 2)}..';
}
switch (direction) {
case AlignmentDirection.left:

View file

@ -91,7 +91,7 @@ stderr: ${result.stderr}
});
}
late final shouldKeepTemporaryDirectories =
final shouldKeepTemporaryDirectories =
Platform.environment['KEEP_TEMPORARY_DIRECTORIES']?.isNotEmpty == true;
Future withTempDir(Future Function(String dir) f) async {