Drop Pair util class (dart-lang/yaml#169)
diff --git a/pkgs/yaml/lib/src/parser.dart b/pkgs/yaml/lib/src/parser.dart index ddbfd4e..e924e40 100644 --- a/pkgs/yaml/lib/src/parser.dart +++ b/pkgs/yaml/lib/src/parser.dart
@@ -174,9 +174,7 @@ // Parse an explicit document. var start = token.span; - var pair = _processDirectives(); - var versionDirective = pair.first; - var tagDirectives = pair.last; + var (versionDirective, tagDirectives) = _processDirectives(); token = _scanner.peek()!; if (token.type != TokenType.documentStart) { throw YamlException('Expected document start.', token.span); @@ -667,7 +665,7 @@ ScalarEvent(location.pointSpan() as FileSpan, '', ScalarStyle.PLAIN); /// Parses directives. - Pair<VersionDirective?, List<TagDirective>> _processDirectives() { + (VersionDirective?, List<TagDirective>) _processDirectives() { var token = _scanner.peek()!; VersionDirective? versionDirective; @@ -707,7 +705,7 @@ TagDirective('!!', 'tag:yaml.org,2002:'), token.span.start.pointSpan(), allowDuplicates: true); - return Pair(versionDirective, tagDirectives); + return (versionDirective, tagDirectives); } /// Adds a tag directive to the directives stack.
diff --git a/pkgs/yaml/lib/src/scanner.dart b/pkgs/yaml/lib/src/scanner.dart index 4b155e1..1cfd3af 100644 --- a/pkgs/yaml/lib/src/scanner.dart +++ b/pkgs/yaml/lib/src/scanner.dart
@@ -1142,8 +1142,8 @@ // Scan the leading line breaks to determine the indentation level if // needed. var pair = _scanBlockScalarBreaks(indent); - indent = pair.first; - var trailingBreaks = pair.last; + indent = pair.indent; + var trailingBreaks = pair.trailingBreaks; // Scan the block scalar contents. var buffer = StringBuffer(); @@ -1194,8 +1194,8 @@ // Eat the following indentation and spaces. var pair = _scanBlockScalarBreaks(indent); - indent = pair.first; - trailingBreaks = pair.last; + indent = pair.indent; + trailingBreaks = pair.trailingBreaks; } // Chomp the tail. @@ -1210,7 +1210,7 @@ /// /// Determines the intendation level if needed. Returns the new indentation /// level and the text of the line breaks. - Pair<int, String> _scanBlockScalarBreaks(int indent) { + ({int indent, String trailingBreaks}) _scanBlockScalarBreaks(int indent) { var maxIndent = 0; var breaks = StringBuffer(); @@ -1238,7 +1238,7 @@ // be supported by the spec. } - return Pair(indent, breaks.toString()); + return (indent: indent, trailingBreaks: breaks.toString()); } // Scans a quoted scalar.
diff --git a/pkgs/yaml/lib/src/utils.dart b/pkgs/yaml/lib/src/utils.dart index d9e20d1..0dc132f 100644 --- a/pkgs/yaml/lib/src/utils.dart +++ b/pkgs/yaml/lib/src/utils.dart
@@ -7,17 +7,6 @@ import 'package:source_span/source_span.dart'; -/// A pair of values. -class Pair<E, F> { - final E first; - final F last; - - Pair(this.first, this.last); - - @override - String toString() => '($first, $last)'; -} - /// Print a warning. /// /// If [span] is passed, associates the warning with that span.