Refactor SemanticsData and SemanticsNode to use Diagnosticable. (#11957)

* Refactor SemanticsData and SemanticsNode to use Diagnosticable.

* Switch toStringDeep to take named parameters.
This commit is contained in:
Jacob Richman
2017-09-11 09:25:58 -07:00
committed by GitHub
parent ff90ba5b3a
commit 0229711ba1
10 changed files with 247 additions and 98 deletions

View File

@@ -507,7 +507,7 @@ class _HasGoodToStringDeep extends Matcher {
final String prefixOtherLines = 'PREFIX_OTHER_LINES_';
final List<String> prefixIssues = <String>[];
String descriptionWithPrefixes =
object.toStringDeep(prefixLineOne, prefixOtherLines);
object.toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines);
if (descriptionWithPrefixes.endsWith('\n')) {
// Trim off trailing \n as the remaining calculations assume
// the description does not end with a trailing \n.
@@ -532,7 +532,7 @@ class _HasGoodToStringDeep extends Matcher {
if (prefixIssues.isNotEmpty) {
errorDescription.writeln(
'Bad toStringDeep("$prefixLineOne", "$prefixOtherLines"):');
'Bad toStringDeep(prefixLineOne: "$prefixLineOne", prefixOtherLines: "$prefixOtherLines"):');
errorDescription.writeln(descriptionWithPrefixes);
errorDescription.writeAll(prefixIssues, '\n');
}

View File

@@ -26,7 +26,7 @@ class _MockToStringDeep {
/// line break.
List<String> _lines;
String toStringDeep([String prefixLineOne="", String prefixOtherLines=""]) {
String toStringDeep({ String prefixLineOne: "", String prefixOtherLines: "" }) {
final StringBuffer sb = new StringBuffer();
if (_lines.isNotEmpty)
sb.write('$prefixLineOne${_lines.first}');