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

Unified Diff: pkg/dev_compiler/lib/js/amd/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 | « no previous file | pkg/dev_compiler/lib/js/common/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/amd/dart_sdk.js
diff --git a/pkg/dev_compiler/lib/js/amd/dart_sdk.js b/pkg/dev_compiler/lib/js/amd/dart_sdk.js
index c2cb69796da24ba6a63bbd4832294ccc15ea9750..2ed85987c8edbc57be0739bd79db50c401100bc6 100644
--- a/pkg/dev_compiler/lib/js/amd/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/amd/dart_sdk.js
@@ -797,43 +797,48 @@ define([], function() {
}
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);
@@ -26760,7 +26765,6 @@ define([], function() {
return this[_nextLink];
}
}
- dart.setBaseClass(_UserDoubleLinkedQueueEntry, collection._DoubleLink$(_UserDoubleLinkedQueueEntry));
_UserDoubleLinkedQueueEntry[dart.implements] = () => [DoubleLinkedQueueEntryOfE()];
dart.setSignature(_UserDoubleLinkedQueueEntry, {
constructors: () => ({new: dart.definiteFunctionType(collection._UserDoubleLinkedQueueEntry$(E), [E])}),
@@ -26774,6 +26778,8 @@ define([], function() {
})
});
return _UserDoubleLinkedQueueEntry;
+ }, _UserDoubleLinkedQueueEntry => {
+ dart.setBaseClass(_UserDoubleLinkedQueueEntry, collection._DoubleLink$(_UserDoubleLinkedQueueEntry));
});
collection._UserDoubleLinkedQueueEntry = _UserDoubleLinkedQueueEntry();
const _queue = Symbol('_queue');
@@ -26803,7 +26809,6 @@ define([], function() {
return this[_previousLink][_asNonSentinelEntry]();
}
}
- dart.setBaseClass(_DoubleLinkedQueueEntry, collection._DoubleLink$(_DoubleLinkedQueueEntry));
dart.setSignature(_DoubleLinkedQueueEntry, {
constructors: () => ({new: dart.definiteFunctionType(collection._DoubleLinkedQueueEntry$(E), [DoubleLinkedQueueOfE()])}),
fields: () => ({[_queue]: DoubleLinkedQueueOfE()}),
@@ -26815,6 +26820,8 @@ define([], function() {
})
});
return _DoubleLinkedQueueEntry;
+ }, _DoubleLinkedQueueEntry => {
+ dart.setBaseClass(_DoubleLinkedQueueEntry, collection._DoubleLink$(_DoubleLinkedQueueEntry));
});
collection._DoubleLinkedQueueEntry = _DoubleLinkedQueueEntry();
const _elementCount = Symbol('_elementCount');
« no previous file with comments | « no previous file | pkg/dev_compiler/lib/js/common/dart_sdk.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698