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

Unified Diff: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart

Issue 2703263002: Custom formatter cleanup Fix case where displaying a class constructor generated unreadable huge ou… (Closed)
Patch Set: Custom formatter cleanup Fix case where displaying a class constructor generated unreadable huge ou… Created 3 years, 10 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
Index: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart
index 344c592fcd546a3ab4a87e9176c17d80cf61456d..dc776c86d689a9ee2e75840b9895e580f8f76cdb 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart
@@ -74,6 +74,8 @@ lazyFn(closure, computeType) {
final _runtimeType = JS('', 'Symbol("_runtimeType")');
final isNamedConstructor = JS('', 'Symbol("isNamedConstructor")');
+final _moduleName = JS('', 'Symbol("_moduleName")');
+
_checkPrimitiveType(obj) {
// TODO(jmesserly): JS is used to prevent type literal wrapping. Is there a
// better way we can handle this? (sra: It is super dodgy that the values
@@ -187,9 +189,9 @@ unwrapType(WrappedType obj) => obj._wrappedType;
_getRuntimeType(value) => JS('', '#[#]', value, _runtimeType);
getIsNamedConstructor(value) => JS('', '#[#]', value, isNamedConstructor);
-// TODO(bmilligan): Define the symbol in rtti.dart instead of dart_library.js
-// and get rid of the call to dart_library in the JS here.
-getDartLibraryName(value) => JS('', '#[dart_library.dartLibraryName]', value);
+
+/// Return the module name for a raw library object.
+getModuleName(value) => JS('', '#[#]', value, _moduleName);
/// Tag the runtime type of [value] to be type [t].
void tag(value, t) {
@@ -204,3 +206,22 @@ void tagLazy(value, compute) {
JS('', '#(#, #, { get: # })', defineLazyProperty, value, _runtimeType,
compute);
}
+
+var _loadedModules = JS('', 'new Map()');
+
+List getModuleNames() {
+ return JS('', 'Array.from(#.keys())', _loadedModules);
+}
+
+/// Return all library objects in the specified module.
+getModuleLibraries(String name) {
+ var module = JS('', '#.get(#)', _loadedModules, name);
+ if (module == null) return null;
+ JS('', '#[#] = #', module, _moduleName, name);
+ return module;
+}
+
+/// Track all libraries
+void trackLibraries(String moduleName, libraries) {
+ JS('', '#.set(#, #)', _loadedModules, moduleName, libraries);
+}

Powered by Google App Engine
This is Rietveld 408576698