Skip to content

Commit dedf5d4

Browse files
committed
Update LKG
1 parent 6443552 commit dedf5d4

File tree

6 files changed

+250
-347
lines changed

6 files changed

+250
-347
lines changed

lib/tsc.js

Lines changed: 40 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -23597,7 +23597,7 @@ var ts;
2359723597
})(ts || (ts = {}));
2359823598
var ts;
2359923599
(function (ts) {
23600-
function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getIndexTypeOfStructuredType, getConstraintFromTypeParameter, getFirstIdentifier) {
23600+
function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getIndexTypeOfStructuredType, getConstraintOfTypeParameter, getFirstIdentifier) {
2360123601
return getSymbolWalker;
2360223602
function getSymbolWalker(accept) {
2360323603
if (accept === void 0) { accept = function () { return true; }; }
@@ -23670,7 +23670,7 @@ var ts;
2367023670
ts.forEach(type.typeArguments, visitType);
2367123671
}
2367223672
function visitTypeParameter(type) {
23673-
visitType(getConstraintFromTypeParameter(type));
23673+
visitType(getConstraintOfTypeParameter(type));
2367423674
}
2367523675
function visitUnionOrIntersectionType(type) {
2367623676
ts.forEach(type.types, visitType);
@@ -23973,7 +23973,7 @@ var ts;
2397323973
getEmitResolver: getEmitResolver,
2397423974
getExportsOfModule: getExportsOfModuleAsArray,
2397523975
getExportsAndPropertiesOfModule: getExportsAndPropertiesOfModule,
23976-
getSymbolWalker: ts.createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getIndexTypeOfStructuredType, getConstraintFromTypeParameter, getFirstIdentifier),
23976+
getSymbolWalker: ts.createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getIndexTypeOfStructuredType, getConstraintOfTypeParameter, getFirstIdentifier),
2397723977
getAmbientModules: getAmbientModules,
2397823978
getAllAttributesTypeFromJsxOpeningLikeElement: function (nodeIn) {
2397923979
var node = ts.getParseTreeNode(nodeIn, ts.isJsxOpeningLikeElement);
@@ -26710,7 +26710,7 @@ var ts;
2671026710
return ts.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode);
2671126711
}
2671226712
function typeParameterToDeclaration(type, context, constraint) {
26713-
if (constraint === void 0) { constraint = getConstraintFromTypeParameter(type); }
26713+
if (constraint === void 0) { constraint = getConstraintOfTypeParameter(type); }
2671426714
var constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
2671526715
return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
2671626716
}
@@ -27225,23 +27225,19 @@ var ts;
2722527225
return -1;
2722627226
}
2722727227
function hasType(target, propertyName) {
27228-
if (propertyName === 0) {
27229-
return !!getSymbolLinks(target).type;
27230-
}
27231-
if (propertyName === 2) {
27232-
return !!getSymbolLinks(target).declaredType;
27233-
}
27234-
if (propertyName === 1) {
27235-
return !!target.resolvedBaseConstructorType;
27236-
}
27237-
if (propertyName === 3) {
27238-
return !!target.resolvedReturnType;
27239-
}
27240-
if (propertyName === 4) {
27241-
var bc = target.immediateBaseConstraint;
27242-
return !!bc && bc !== circularConstraintType;
27228+
switch (propertyName) {
27229+
case 0:
27230+
return !!getSymbolLinks(target).type;
27231+
case 2:
27232+
return !!getSymbolLinks(target).declaredType;
27233+
case 1:
27234+
return !!target.resolvedBaseConstructorType;
27235+
case 3:
27236+
return !!target.resolvedReturnType;
27237+
case 4:
27238+
return !!target.immediateBaseConstraint;
2724327239
}
27244-
return ts.Debug.fail("Unhandled TypeSystemPropertyName " + propertyName);
27240+
return ts.Debug.assertNever(propertyName);
2724527241
}
2724627242
function popTypeResolution() {
2724727243
resolutionTargets.pop();
@@ -29299,20 +29295,12 @@ var ts;
2929929295
}
2930029296
return undefined;
2930129297
}
29302-
function getBaseConstraintOfInstantiableNonPrimitiveUnionOrIntersection(type) {
29298+
function getBaseConstraintOfType(type) {
2930329299
if (type.flags & (14745600 | 786432)) {
2930429300
var constraint = getResolvedBaseConstraint(type);
29305-
if (constraint !== noConstraintType && constraint !== circularConstraintType) {
29306-
return constraint;
29307-
}
29308-
}
29309-
}
29310-
function getBaseConstraintOfType(type) {
29311-
var constraint = getBaseConstraintOfInstantiableNonPrimitiveUnionOrIntersection(type);
29312-
if (!constraint && type.flags & 1048576) {
29313-
return keyofConstraintType;
29301+
return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined;
2931429302
}
29315-
return constraint;
29303+
return type.flags & 1048576 ? keyofConstraintType : undefined;
2931629304
}
2931729305
function getBaseConstraintOrType(type) {
2931829306
return getBaseConstraintOfType(type) || type;
@@ -29321,29 +29309,24 @@ var ts;
2932129309
return getResolvedBaseConstraint(type) !== circularConstraintType;
2932229310
}
2932329311
function getResolvedBaseConstraint(type) {
29324-
var circular;
29325-
if (!type.resolvedBaseConstraint) {
29326-
var constraint = getBaseConstraint(type);
29327-
type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type);
29312+
return type.resolvedBaseConstraint ||
29313+
(type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), type));
29314+
function getImmediateBaseConstraint(t) {
29315+
if (!t.immediateBaseConstraint) {
29316+
if (!pushTypeResolution(t, 4)) {
29317+
return circularConstraintType;
29318+
}
29319+
var result = computeBaseConstraint(getSimplifiedType(t));
29320+
if (!popTypeResolution()) {
29321+
result = circularConstraintType;
29322+
}
29323+
t.immediateBaseConstraint = result || noConstraintType;
29324+
}
29325+
return t.immediateBaseConstraint;
2932829326
}
29329-
return type.resolvedBaseConstraint;
2933029327
function getBaseConstraint(t) {
29331-
if (t.immediateBaseConstraint) {
29332-
return t.immediateBaseConstraint === noConstraintType ? undefined : t.immediateBaseConstraint;
29333-
}
29334-
if (!pushTypeResolution(t, 4)) {
29335-
circular = true;
29336-
t.immediateBaseConstraint = circularConstraintType;
29337-
return undefined;
29338-
}
29339-
var result = computeBaseConstraint(getSimplifiedType(t));
29340-
if (!popTypeResolution()) {
29341-
circular = true;
29342-
t.immediateBaseConstraint = circularConstraintType;
29343-
return undefined;
29344-
}
29345-
t.immediateBaseConstraint = !result ? noConstraintType : result;
29346-
return result;
29328+
var c = getImmediateBaseConstraint(t);
29329+
return c !== noConstraintType && c !== circularConstraintType ? c : undefined;
2934729330
}
2934829331
function computeBaseConstraint(t) {
2934929332
if (t.flags & 65536) {
@@ -31107,7 +31090,7 @@ var ts;
3110731090
return type.simplified = substituteIndexedMappedType(objectType, type);
3110831091
}
3110931092
if (objectType.flags & 65536) {
31110-
var constraint = getConstraintFromTypeParameter(objectType);
31093+
var constraint = getConstraintOfTypeParameter(objectType);
3111131094
if (constraint && isGenericMappedType(constraint)) {
3111231095
return type.simplified = substituteIndexedMappedType(constraint, type);
3111331096
}
@@ -33569,7 +33552,7 @@ var ts;
3356933552
return false;
3357033553
}
3357133554
function isUnconstrainedTypeParameter(type) {
33572-
return type.flags & 65536 && !getConstraintFromTypeParameter(type);
33555+
return type.flags & 65536 && !getConstraintOfTypeParameter(type);
3357333556
}
3357433557
function isTypeReferenceWithGenericArguments(type) {
3357533558
return !!(ts.getObjectFlags(type) & 4) && ts.some(type.typeArguments, function (t) { return isUnconstrainedTypeParameter(t) || isTypeReferenceWithGenericArguments(t); });
@@ -37819,7 +37802,7 @@ var ts;
3781937802
return false;
3782037803
}
3782137804
var thisType = getTypeFromTypeNode(thisParameter.type);
37822-
enclosingClass = ((thisType.flags & 65536) ? getConstraintFromTypeParameter(thisType) : thisType);
37805+
enclosingClass = ((thisType.flags & 65536) ? getConstraintOfTypeParameter(thisType) : thisType);
3782337806
}
3782437807
if (flags & 32) {
3782537808
return true;
@@ -38940,7 +38923,7 @@ var ts;
3894038923
typeArguments.pop();
3894138924
}
3894238925
while (typeArguments.length < typeParameters.length) {
38943-
typeArguments.push(getConstraintFromTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(ts.isInJavaScriptFile(node)));
38926+
typeArguments.push(getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(ts.isInJavaScriptFile(node)));
3894438927
}
3894538928
var instantiated = createSignatureInstantiation(candidate, typeArguments);
3894638929
candidates[bestIndex] = instantiated;
@@ -43382,7 +43365,7 @@ var ts;
4338243365
return false;
4338343366
}
4338443367
var sourceConstraint = source.constraint && getTypeFromTypeNode(source.constraint);
43385-
var targetConstraint = getConstraintFromTypeParameter(target);
43368+
var targetConstraint = getConstraintOfTypeParameter(target);
4338643369
if (sourceConstraint) {
4338743370
if (!targetConstraint || !isTypeIdenticalTo(sourceConstraint, targetConstraint)) {
4338843371
return false;

0 commit comments

Comments
 (0)