Skip to content

Commit

Permalink
Update LKG
Browse files Browse the repository at this point in the history
  • Loading branch information
mhegazy committed Jan 5, 2017
1 parent c26f402 commit 2dbc531
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 48 deletions.
22 changes: 13 additions & 9 deletions lib/tsc.js
Expand Up @@ -39606,6 +39606,9 @@ var ts;
return decoded ? ts.createLiteral(decoded, node) : node;
}
else if (node.kind === 252) {
if (node.expression === undefined) {
return ts.createLiteral(true);
}
return visitJsxExpression(node);
}
else {
Expand Down Expand Up @@ -40699,7 +40702,8 @@ var ts;
addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!");
}
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);
var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94;
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset);
if (superCaptureStatus === 1 || superCaptureStatus === 2) {
statementOffset++;
}
Expand All @@ -40710,7 +40714,7 @@ var ts;
});
ts.addRange(statements, body);
}
if (extendsClauseElement
if (isDerivedClass
&& superCaptureStatus !== 2
&& !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) {
statements.push(ts.createReturn(ts.createIdentifier("_this")));
Expand Down Expand Up @@ -40741,8 +40745,8 @@ var ts;
}
return false;
}
function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) {
if (!hasExtendsClause) {
function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) {
if (!isDerivedClass) {
if (ctor) {
addCaptureThisForNodeIfNeeded(statements, ctor);
}
Expand Down Expand Up @@ -40779,17 +40783,17 @@ var ts;
statements.push(returnStatement);
return 2;
}
captureThisForNode(statements, ctor, superCallExpression, firstStatement);
captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement);
if (superCallExpression) {
return 1;
}
return 0;
}
function createActualThis() {
return ts.setEmitFlags(ts.createThis(), 4);
}
function createDefaultSuperCallOrThis() {
var actualThis = ts.createThis();
ts.setEmitFlags(actualThis, 4);
var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments"));
return ts.createLogicalOr(superCall, actualThis);
return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis());
}
function visitParameter(node) {
if (node.dotDotDotToken) {
Expand Down
26 changes: 15 additions & 11 deletions lib/tsserver.js
Expand Up @@ -41116,6 +41116,9 @@ var ts;
return decoded ? ts.createLiteral(decoded, node) : node;
}
else if (node.kind === 252) {
if (node.expression === undefined) {
return ts.createLiteral(true);
}
return visitJsxExpression(node);
}
else {
Expand Down Expand Up @@ -42209,7 +42212,8 @@ var ts;
addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!");
}
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);
var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94;
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset);
if (superCaptureStatus === 1 || superCaptureStatus === 2) {
statementOffset++;
}
Expand All @@ -42220,7 +42224,7 @@ var ts;
});
ts.addRange(statements, body);
}
if (extendsClauseElement
if (isDerivedClass
&& superCaptureStatus !== 2
&& !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) {
statements.push(ts.createReturn(ts.createIdentifier("_this")));
Expand Down Expand Up @@ -42251,8 +42255,8 @@ var ts;
}
return false;
}
function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) {
if (!hasExtendsClause) {
function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) {
if (!isDerivedClass) {
if (ctor) {
addCaptureThisForNodeIfNeeded(statements, ctor);
}
Expand Down Expand Up @@ -42289,17 +42293,17 @@ var ts;
statements.push(returnStatement);
return 2;
}
captureThisForNode(statements, ctor, superCallExpression, firstStatement);
captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement);
if (superCallExpression) {
return 1;
}
return 0;
}
function createActualThis() {
return ts.setEmitFlags(ts.createThis(), 4);
}
function createDefaultSuperCallOrThis() {
var actualThis = ts.createThis();
ts.setEmitFlags(actualThis, 4);
var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments"));
return ts.createLogicalOr(superCall, actualThis);
return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis());
}
function visitParameter(node) {
if (node.dotDotDotToken) {
Expand Down Expand Up @@ -65201,7 +65205,7 @@ var ts;
var ModuleBuilderFileInfo = (function (_super) {
__extends(ModuleBuilderFileInfo, _super);
function ModuleBuilderFileInfo() {
var _this = _super.apply(this, arguments) || this;
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.references = [];
_this.referencedBy = [];
return _this;
Expand Down Expand Up @@ -69807,7 +69811,7 @@ var ts;
var IOSession = (function (_super) {
__extends(IOSession, _super);
function IOSession(host, cancellationToken, installerEventPort, canUseEvents, useSingleInferredProject, disableAutomaticTypingAcquisition, globalTypingsCacheLocation, telemetryEnabled, logger) {
var _this;
var _this = this;
var typingsInstaller = disableAutomaticTypingAcquisition
? undefined
: new NodeTypingsInstaller(telemetryEnabled, logger, host, installerEventPort, globalTypingsCacheLocation, host.newLine);
Expand Down
24 changes: 14 additions & 10 deletions lib/tsserverlibrary.js
Expand Up @@ -41116,6 +41116,9 @@ var ts;
return decoded ? ts.createLiteral(decoded, node) : node;
}
else if (node.kind === 252) {
if (node.expression === undefined) {
return ts.createLiteral(true);
}
return visitJsxExpression(node);
}
else {
Expand Down Expand Up @@ -42209,7 +42212,8 @@ var ts;
addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!");
}
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);
var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94;
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset);
if (superCaptureStatus === 1 || superCaptureStatus === 2) {
statementOffset++;
}
Expand All @@ -42220,7 +42224,7 @@ var ts;
});
ts.addRange(statements, body);
}
if (extendsClauseElement
if (isDerivedClass
&& superCaptureStatus !== 2
&& !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) {
statements.push(ts.createReturn(ts.createIdentifier("_this")));
Expand Down Expand Up @@ -42251,8 +42255,8 @@ var ts;
}
return false;
}
function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) {
if (!hasExtendsClause) {
function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) {
if (!isDerivedClass) {
if (ctor) {
addCaptureThisForNodeIfNeeded(statements, ctor);
}
Expand Down Expand Up @@ -42289,17 +42293,17 @@ var ts;
statements.push(returnStatement);
return 2;
}
captureThisForNode(statements, ctor, superCallExpression, firstStatement);
captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement);
if (superCallExpression) {
return 1;
}
return 0;
}
function createActualThis() {
return ts.setEmitFlags(ts.createThis(), 4);
}
function createDefaultSuperCallOrThis() {
var actualThis = ts.createThis();
ts.setEmitFlags(actualThis, 4);
var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments"));
return ts.createLogicalOr(superCall, actualThis);
return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis());
}
function visitParameter(node) {
if (node.dotDotDotToken) {
Expand Down Expand Up @@ -65201,7 +65205,7 @@ var ts;
var ModuleBuilderFileInfo = (function (_super) {
__extends(ModuleBuilderFileInfo, _super);
function ModuleBuilderFileInfo() {
var _this = _super.apply(this, arguments) || this;
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.references = [];
_this.referencedBy = [];
return _this;
Expand Down
24 changes: 15 additions & 9 deletions lib/typescript.js
Expand Up @@ -48649,6 +48649,9 @@ var ts;
return decoded ? ts.createLiteral(decoded, /*location*/ node) : node;
}
else if (node.kind === 252 /* JsxExpression */) {
if (node.expression === undefined) {
return ts.createLiteral(true);
}
return visitJsxExpression(node);
}
else {
Expand Down Expand Up @@ -50079,7 +50082,10 @@ var ts;
addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!");
}
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);
// determine whether the class is known syntactically to be a derived class (e.g. a
// class that extends a value that is not syntactically known to be `null`).
var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94 /* NullKeyword */;
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset);
// The last statement expression was replaced. Skip it.
if (superCaptureStatus === 1 /* ReplaceSuperCapture */ || superCaptureStatus === 2 /* ReplaceWithReturn */) {
statementOffset++;
Expand All @@ -50093,7 +50099,7 @@ var ts;
}
// Return `_this` unless we're sure enough that it would be pointless to add a return statement.
// If there's a constructor that we can tell returns in enough places, then we *do not* want to add a return.
if (extendsClauseElement
if (isDerivedClass
&& superCaptureStatus !== 2 /* ReplaceWithReturn */
&& !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) {
statements.push(ts.createReturn(ts.createIdentifier("_this")));
Expand Down Expand Up @@ -50138,9 +50144,9 @@ var ts;
*
* @returns The new statement offset into the `statements` array.
*/
function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) {
function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) {
// If this isn't a derived class, just capture 'this' for arrow functions if necessary.
if (!hasExtendsClause) {
if (!isDerivedClass) {
if (ctor) {
addCaptureThisForNodeIfNeeded(statements, ctor);
}
Expand Down Expand Up @@ -50204,18 +50210,18 @@ var ts;
return 2 /* ReplaceWithReturn */;
}
// Perform the capture.
captureThisForNode(statements, ctor, superCallExpression, firstStatement);
captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement);
// If we're actually replacing the original statement, we need to signal this to the caller.
if (superCallExpression) {
return 1 /* ReplaceSuperCapture */;
}
return 0 /* NoReplacement */;
}
function createActualThis() {
return ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */);
}
function createDefaultSuperCallOrThis() {
var actualThis = ts.createThis();
ts.setEmitFlags(actualThis, 4 /* NoSubstitution */);
var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments"));
return ts.createLogicalOr(superCall, actualThis);
return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis());
}
/**
* Visits a parameter declaration.
Expand Down
24 changes: 15 additions & 9 deletions lib/typescriptServices.js
Expand Up @@ -48649,6 +48649,9 @@ var ts;
return decoded ? ts.createLiteral(decoded, /*location*/ node) : node;
}
else if (node.kind === 252 /* JsxExpression */) {
if (node.expression === undefined) {
return ts.createLiteral(true);
}
return visitJsxExpression(node);
}
else {
Expand Down Expand Up @@ -50079,7 +50082,10 @@ var ts;
addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!");
}
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);
// determine whether the class is known syntactically to be a derived class (e.g. a
// class that extends a value that is not syntactically known to be `null`).
var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94 /* NullKeyword */;
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset);
// The last statement expression was replaced. Skip it.
if (superCaptureStatus === 1 /* ReplaceSuperCapture */ || superCaptureStatus === 2 /* ReplaceWithReturn */) {
statementOffset++;
Expand All @@ -50093,7 +50099,7 @@ var ts;
}
// Return `_this` unless we're sure enough that it would be pointless to add a return statement.
// If there's a constructor that we can tell returns in enough places, then we *do not* want to add a return.
if (extendsClauseElement
if (isDerivedClass
&& superCaptureStatus !== 2 /* ReplaceWithReturn */
&& !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) {
statements.push(ts.createReturn(ts.createIdentifier("_this")));
Expand Down Expand Up @@ -50138,9 +50144,9 @@ var ts;
*
* @returns The new statement offset into the `statements` array.
*/
function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) {
function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) {
// If this isn't a derived class, just capture 'this' for arrow functions if necessary.
if (!hasExtendsClause) {
if (!isDerivedClass) {
if (ctor) {
addCaptureThisForNodeIfNeeded(statements, ctor);
}
Expand Down Expand Up @@ -50204,18 +50210,18 @@ var ts;
return 2 /* ReplaceWithReturn */;
}
// Perform the capture.
captureThisForNode(statements, ctor, superCallExpression, firstStatement);
captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement);
// If we're actually replacing the original statement, we need to signal this to the caller.
if (superCallExpression) {
return 1 /* ReplaceSuperCapture */;
}
return 0 /* NoReplacement */;
}
function createActualThis() {
return ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */);
}
function createDefaultSuperCallOrThis() {
var actualThis = ts.createThis();
ts.setEmitFlags(actualThis, 4 /* NoSubstitution */);
var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments"));
return ts.createLogicalOr(superCall, actualThis);
return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis());
}
/**
* Visits a parameter declaration.
Expand Down

0 comments on commit 2dbc531

Please sign in to comment.