Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Unified Diff: tool/input_sdk/private/debugger.dart

Issue 2176233002: Library children object fix (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Refactoring library children method Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/runtime/dart_sdk.js ('k') | tool/sdk_expected_errors.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « lib/runtime/dart_sdk.js ('k') | tool/sdk_expected_errors.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698