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

Unified Diff: pkg/dev_compiler/lib/js/es6/dart_sdk.js

Issue 2516483002: fix #27336, ddc with recursive generic class type args (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
« no previous file with comments | « pkg/dev_compiler/lib/js/common/dart_sdk.js ('k') | pkg/dev_compiler/lib/js/legacy/dart_sdk.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/lib/js/es6/dart_sdk.js
diff --git a/pkg/dev_compiler/lib/js/es6/dart_sdk.js b/pkg/dev_compiler/lib/js/es6/dart_sdk.js
index c16638f3fe3ac6dc4a1aa1d7a168dedc8b9a6ba1..bb1cb3586a7eae2df9efad353a52702000849de5 100644
--- a/pkg/dev_compiler/lib/js/es6/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/es6/dart_sdk.js
@@ -795,43 +795,48 @@ dart.flattenFutures = function(builder) {
}
return flatten;
};
-dart.generic = function(typeConstructor) {
- let length = typeConstructor.length;
- if (length < 1) {
- dart.throwInternalError('must have at least one generic type argument');
- }
- let resultMap = new Map();
- function makeGenericType(...args) {
- if (args.length != length && args.length != 0) {
- dart.throwInternalError('requires ' + length + ' or 0 type arguments');
- }
- while (args.length < length)
- args.push(dart.dynamic);
- let value = resultMap;
- for (let i = 0; i < length; i++) {
- let arg = args[i];
- if (arg == null) {
- dart.throwInternalError('type arguments should not be null: ' + typeConstructor);
- }
- let map = value;
- value = map.get(arg);
- if (value === void 0) {
- if (i + 1 == length) {
- value = typeConstructor.apply(null, args);
- if (value) {
- value[dart._typeArguments] = args;
- value[dart._originalDeclaration] = makeGenericType;
+dart.generic = function(typeConstructor, setBaseClass) {
+ if (setBaseClass === void 0) setBaseClass = null;
+ return (() => {
+ let length = typeConstructor.length;
+ if (length < 1) {
+ dart.throwInternalError('must have at least one generic type argument');
+ }
+ let resultMap = new Map();
+ function makeGenericType(...args) {
+ if (args.length != length && args.length != 0) {
+ dart.throwInternalError('requires ' + length + ' or 0 type arguments');
+ }
+ while (args.length < length)
+ args.push(dart.dynamic);
+ let value = resultMap;
+ for (let i = 0; i < length; i++) {
+ let arg = args[i];
+ if (arg == null) {
+ dart.throwInternalError('type arguments should not be null: ' + typeConstructor);
+ }
+ let map = value;
+ value = map.get(arg);
+ if (value === void 0) {
+ if (i + 1 == length) {
+ value = typeConstructor.apply(null, args);
+ if (value) {
+ value[dart._typeArguments] = args;
+ value[dart._originalDeclaration] = makeGenericType;
+ }
+ map.set(arg, value);
+ if (setBaseClass) setBaseClass(value);
+ } else {
+ value = new Map();
+ map.set(arg, value);
}
- } else {
- value = new Map();
}
- map.set(arg, value);
}
+ return value;
}
- return value;
- }
- makeGenericType[dart._genericTypeCtor] = typeConstructor;
- return makeGenericType;
+ makeGenericType[dart._genericTypeCtor] = typeConstructor;
+ return makeGenericType;
+ })();
};
dart.getGenericClass = function(type) {
return dart.safeGetOwnProperty(type, dart._originalDeclaration);
@@ -26758,7 +26763,6 @@ collection._UserDoubleLinkedQueueEntry$ = dart.generic(E => {
return this[_nextLink];
}
}
- dart.setBaseClass(_UserDoubleLinkedQueueEntry, collection._DoubleLink$(_UserDoubleLinkedQueueEntry));
_UserDoubleLinkedQueueEntry[dart.implements] = () => [DoubleLinkedQueueEntryOfE()];
dart.setSignature(_UserDoubleLinkedQueueEntry, {
constructors: () => ({new: dart.definiteFunctionType(collection._UserDoubleLinkedQueueEntry$(E), [E])}),
@@ -26772,6 +26776,8 @@ collection._UserDoubleLinkedQueueEntry$ = dart.generic(E => {
})
});
return _UserDoubleLinkedQueueEntry;
+}, _UserDoubleLinkedQueueEntry => {
+ dart.setBaseClass(_UserDoubleLinkedQueueEntry, collection._DoubleLink$(_UserDoubleLinkedQueueEntry));
});
collection._UserDoubleLinkedQueueEntry = _UserDoubleLinkedQueueEntry();
const _queue = Symbol('_queue');
@@ -26801,7 +26807,6 @@ collection._DoubleLinkedQueueEntry$ = dart.generic(E => {
return this[_previousLink][_asNonSentinelEntry]();
}
}
- dart.setBaseClass(_DoubleLinkedQueueEntry, collection._DoubleLink$(_DoubleLinkedQueueEntry));
dart.setSignature(_DoubleLinkedQueueEntry, {
constructors: () => ({new: dart.definiteFunctionType(collection._DoubleLinkedQueueEntry$(E), [DoubleLinkedQueueOfE()])}),
fields: () => ({[_queue]: DoubleLinkedQueueOfE()}),
@@ -26813,6 +26818,8 @@ collection._DoubleLinkedQueueEntry$ = dart.generic(E => {
})
});
return _DoubleLinkedQueueEntry;
+}, _DoubleLinkedQueueEntry => {
+ dart.setBaseClass(_DoubleLinkedQueueEntry, collection._DoubleLink$(_DoubleLinkedQueueEntry));
});
collection._DoubleLinkedQueueEntry = _DoubleLinkedQueueEntry();
const _elementCount = Symbol('_elementCount');
« no previous file with comments | « pkg/dev_compiler/lib/js/common/dart_sdk.js ('k') | pkg/dev_compiler/lib/js/legacy/dart_sdk.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698