Chromium Code Reviews| Index: tool/input_sdk/private/debugger.dart |
| diff --git a/tool/input_sdk/private/debugger.dart b/tool/input_sdk/private/debugger.dart |
| index 8cdbeb0a45826ebc4dca27e7ad74b90edc36df5f..a701234e15060d0a91ca526ec99ede757ce555f1 100644 |
| --- a/tool/input_sdk/private/debugger.dart |
| +++ b/tool/input_sdk/private/debugger.dart |
| @@ -557,33 +557,40 @@ class LibraryFormatter extends ObjectFormatter { |
| if (value != null) { |
|
Alan Knight
2016/07/25 20:53:00
You could even split this up more/ reduce the leve
bmilligan
2016/07/25 23:28:31
The generic types that get caught in the the first
|
| var genericTypeConstructor = dart.getGenericTypeCtor(value); |
| if (genericTypeConstructor != null) { |
| - genericName = name; |
| - // Using JS toString() eliminates the leading metadata that is generated |
| - // with the toString function provided in operations.dart. |
| - // Splitting by => and taking the first element gives the list of |
| - // arguments in the constructor. |
| - genericArguments = |
| - JS('String', '#.toString()', genericTypeConstructor) |
| - .split(' =>') |
| - .first |
| - .replaceAll(new RegExp(r'[(|)]'), ''); |
| + genericClassHandler(name, genericTypeConstructor); |
| } else if (value is Type) { |
| - var typeName = getTypeName(value); |
| - // Generic class names are generated with a $ at the end, so the |
| - // corresponding non-generic class can be identified by adding $. |
| - if ('$name\$' == genericName) { |
| - typeName = '$typeName<$genericArguments>'; |
| - } |
| - children.add(new NameValuePair( |
| - name: typeName, value: new ClassMetadata(value, name: typeName))); |
| + addClassChild(name, value, children); |
|
Alan Knight
2016/07/25 20:53:00
Good, but maybe for consistency with the clause be
bmilligan
2016/07/25 23:28:31
Done.
|
| } else { |
| - children.add( |
| - new NameValuePair(name: name, value: new ClassMetadata(value))); |
| + children.add(new NameValuePair(name: name, value: value)); |
| } |
| } |
| } |
| return children.toList(); |
| } |
| + |
| + genericClassHandler(String name, Object genericTypeConstructor) { |
|
Alan Knight
2016/07/25 20:53:00
"Handler" is another one of those non-value-adding
bmilligan
2016/07/25 23:28:31
Done.
|
| + genericName = name; |
| + // Using JS toString() eliminates the leading metadata that is generated |
| + // with the toString function provided in operations.dart. |
| + // Splitting by => and taking the first element gives the list of |
| + // arguments in the constructor. |
| + genericArguments = JS('String', '#.toString()', genericTypeConstructor) |
| + .split(' =>') |
| + .first |
| + .replaceAll(new RegExp(r'[(|)]'), ''); |
| + } |
| + |
| + addClassChild( |
| + String name, Object child, LinkedHashSet<NameValuePair> children) { |
| + var typeName = getTypeName(child); |
| + // Generic class names are generated with a $ at the end, so the |
| + // corresponding non-generic class can be identified by adding $. |
| + if ('$name\$' == genericName) { |
| + typeName = '$typeName<$genericArguments>'; |
| + } |
| + children.add(new NameValuePair( |
| + name: typeName, value: new ClassMetadata(child, name: typeName))); |
| + } |
| } |
| /// Formatter for Dart Function objects. |