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

Unified Diff: pkg/dev_compiler/lib/js/common/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/amd/dart_sdk.js ('k') | pkg/dev_compiler/lib/js/es6/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/common/dart_sdk.js
diff --git a/pkg/dev_compiler/lib/js/common/dart_sdk.js b/pkg/dev_compiler/lib/js/common/dart_sdk.js
index 78f09d29a9f5c88ff391585d2f56496ed36a7f4f..f853c405607f2404f4d42b633fab9c051e1b8a8a 100644
--- a/pkg/dev_compiler/lib/js/common/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/common/dart_sdk.js
@@ -797,43 +797,48 @@
}
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 @@
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 @@
})
});
return _UserDoubleLinkedQueueEntry;
+ }, _UserDoubleLinkedQueueEntry => {
+ dart.setBaseClass(_UserDoubleLinkedQueueEntry, collection._DoubleLink$(_UserDoubleLinkedQueueEntry));
});
collection._UserDoubleLinkedQueueEntry = _UserDoubleLinkedQueueEntry();
const _queue = Symbol('_queue');
@@ -26803,7 +26809,6 @@
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 @@
})
});
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/amd/dart_sdk.js ('k') | pkg/dev_compiler/lib/js/es6/dart_sdk.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698