Merge pull request #10762 from Microsoft/useReturnedThisFromSuperCalls

Use returned values from super calls as 'this'
This commit is contained in:
Daniel Rosenwasser
2016-09-30 00:08:32 -07:00
committed by GitHub
680 changed files with 3493 additions and 1963 deletions
+2 -1
View File
@@ -9421,8 +9421,8 @@ namespace ts {
let container = getSuperContainer(node, /*stopOnFunctions*/ true);
let needToCaptureLexicalThis = false;
// adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
if (!isCallExpression) {
// adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting
while (container && container.kind === SyntaxKind.ArrowFunction) {
container = getSuperContainer(container, /*stopOnFunctions*/ true);
needToCaptureLexicalThis = languageVersion < ScriptTarget.ES6;
@@ -14439,6 +14439,7 @@ namespace ts {
// constructors of derived classes must contain at least one super call somewhere in their function body.
const containingClassDecl = <ClassDeclaration>node.parent;
if (getClassExtendsHeritageClauseElement(containingClassDecl)) {
captureLexicalThis(node.parent, containingClassDecl);
const classExtendsNull = classDeclarationExtendsNull(containingClassDecl);
const superCall = getSuperCallInConstructor(node);
if (superCall) {
+237 -57
View File
@@ -139,6 +139,30 @@ namespace ts {
loopOutParameters?: LoopOutParameter[];
}
const enum SuperCaptureResult {
/**
* A capture may have been added for calls to 'super', but
* the caller should emit subsequent statements normally.
*/
NoReplacement,
/**
* A call to 'super()' got replaced with a capturing statement like:
*
* var _this = _super.call(...) || this;
*
* Callers should skip the current statement.
*/
ReplaceSuperCapture,
/**
* A call to 'super()' got replaced with a capturing statement like:
*
* return _super.call(...) || this;
*
* Callers should skip the current statement and avoid any returns of '_this'.
*/
ReplaceWithReturn,
}
export function transformES6(context: TransformationContext) {
const {
startLexicalEnvironment,
@@ -197,7 +221,7 @@ namespace ts {
: visitorWorker(node);
}
function saveStateAndInvoke<T>(node: Node, f: (node: Node) => T): T {
function saveStateAndInvoke<T extends Node, U>(node: T, f: (node: T) => U): U {
const savedEnclosingFunction = enclosingFunction;
const savedEnclosingNonArrowFunction = enclosingNonArrowFunction;
const savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody;
@@ -756,7 +780,8 @@ namespace ts {
function addConstructor(statements: Statement[], node: ClassExpression | ClassDeclaration, extendsClauseElement: ExpressionWithTypeArguments): void {
const constructor = getFirstConstructorWithBody(node);
const hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);
statements.push(
const constructorFunction =
createFunctionDeclaration(
/*decorators*/ undefined,
/*modifiers*/ undefined,
@@ -767,8 +792,12 @@ namespace ts {
/*type*/ undefined,
transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper),
/*location*/ constructor || node
)
);
);
if (extendsClauseElement) {
setEmitFlags(constructorFunction, EmitFlags.CapturesThis);
}
statements.push(constructorFunction);
}
/**
@@ -800,22 +829,53 @@ namespace ts {
* @param hasSynthesizedSuper A value indicating whether the constructor starts with a
* synthesized `super` call.
*/
function transformConstructorBody(constructor: ConstructorDeclaration, node: ClassDeclaration | ClassExpression, extendsClauseElement: ExpressionWithTypeArguments, hasSynthesizedSuper: boolean) {
function transformConstructorBody(constructor: ConstructorDeclaration | undefined, node: ClassDeclaration | ClassExpression, extendsClauseElement: ExpressionWithTypeArguments, hasSynthesizedSuper: boolean) {
const statements: Statement[] = [];
startLexicalEnvironment();
if (constructor) {
addCaptureThisForNodeIfNeeded(statements, constructor);
addDefaultValueAssignmentsIfNeeded(statements, constructor);
addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
let statementOffset = -1;
if (hasSynthesizedSuper) {
// If a super call has already been synthesized,
// we're going to assume that we should just transform everything after that.
// The assumption is that no prior step in the pipeline has added any prologue directives.
statementOffset = 1;
}
else if (constructor) {
// Otherwise, try to emit all potential prologue directives first.
statementOffset = addPrologueDirectives(statements, constructor.body.statements, /*ensureUseStrict*/ false, visitor);
}
addDefaultSuperCallIfNeeded(statements, constructor, extendsClauseElement, hasSynthesizedSuper);
if (constructor) {
addDefaultValueAssignmentsIfNeeded(statements, constructor);
addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!");
}
const superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);
// The last statement expression was replaced. Skip it.
if (superCaptureStatus === SuperCaptureResult.ReplaceSuperCapture || superCaptureStatus === SuperCaptureResult.ReplaceWithReturn) {
statementOffset++;
}
if (constructor) {
const body = saveStateAndInvoke(constructor, hasSynthesizedSuper ? transformConstructorBodyWithSynthesizedSuper : transformConstructorBodyWithoutSynthesizedSuper);
const body = saveStateAndInvoke(constructor, constructor => visitNodes(constructor.body.statements, visitor, isStatement, /*start*/ statementOffset));
addRange(statements, body);
}
// 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
&& superCaptureStatus !== SuperCaptureResult.ReplaceWithReturn
&& !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) {
statements.push(
createReturn(
createIdentifier("_this")
)
);
}
addRange(statements, endLexicalEnvironment());
const block = createBlock(
createNodeArray(
@@ -833,41 +893,130 @@ namespace ts {
return block;
}
function transformConstructorBodyWithSynthesizedSuper(node: ConstructorDeclaration) {
return visitNodes(node.body.statements, visitor, isStatement, 1);
}
/**
* We want to try to avoid emitting a return statement in certain cases if a user already returned something.
* It would generate obviously dead code, so we'll try to make things a little bit prettier
* by doing a minimal check on whether some common patterns always explicitly return.
*/
function isSufficientlyCoveredByReturnStatements(statement: Statement): boolean {
// A return statement is considered covered.
if (statement.kind === SyntaxKind.ReturnStatement) {
return true;
}
// An if-statement with two covered branches is covered.
else if (statement.kind === SyntaxKind.IfStatement) {
const ifStatement = statement as IfStatement;
if (ifStatement.elseStatement) {
return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&
isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement);
}
}
// A block is covered if it has a last statement which is covered.
else if (statement.kind === SyntaxKind.Block) {
const lastStatement = lastOrUndefined((statement as Block).statements);
if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {
return true;
}
}
function transformConstructorBodyWithoutSynthesizedSuper(node: ConstructorDeclaration) {
return visitNodes(node.body.statements, visitor, isStatement, 0);
return false;
}
/**
* Adds a synthesized call to `_super` if it is needed.
* Declares a `_this` variable for derived classes and for when arrow functions capture `this`.
*
* @param statements The statements for the new constructor body.
* @param constructor The constructor for the class.
* @param extendsClauseElement The expression for the class `extends` clause.
* @param hasSynthesizedSuper A value indicating whether the constructor starts with a
* synthesized `super` call.
* @returns The new statement offset into the `statements` array.
*/
function addDefaultSuperCallIfNeeded(statements: Statement[], constructor: ConstructorDeclaration, extendsClauseElement: ExpressionWithTypeArguments, hasSynthesizedSuper: boolean) {
// If the TypeScript transformer needed to synthesize a constructor for property
// initializers, it would have also added a synthetic `...args` parameter and
// `super` call.
// If this is the case, or if the class has an `extends` clause but no
// constructor, we emit a synthesized call to `_super`.
if (constructor ? hasSynthesizedSuper : extendsClauseElement) {
statements.push(
createStatement(
createFunctionApply(
createIdentifier("_super"),
createThis(),
createIdentifier("arguments")
),
/*location*/ extendsClauseElement
)
);
function declareOrCaptureOrReturnThisForConstructorIfNeeded(
statements: Statement[],
ctor: ConstructorDeclaration | undefined,
hasExtendsClause: boolean,
hasSynthesizedSuper: boolean,
statementOffset: number) {
// If this isn't a derived class, just capture 'this' for arrow functions if necessary.
if (!hasExtendsClause) {
if (ctor) {
addCaptureThisForNodeIfNeeded(statements, ctor);
}
return SuperCaptureResult.NoReplacement;
}
// We must be here because the user didn't write a constructor
// but we needed to call 'super(...args)' anyway as per 14.5.14 of the ES2016 spec.
// If that's the case we can just immediately return the result of a 'super()' call.
if (!ctor) {
statements.push(createReturn(createDefaultSuperCallOrThis()));
return SuperCaptureResult.ReplaceWithReturn;
}
// The constructor exists, but it and the 'super()' call it contains were generated
// for something like property initializers.
// Create a captured '_this' variable and assume it will subsequently be used.
if (hasSynthesizedSuper) {
captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
enableSubstitutionsForCapturedThis();
return SuperCaptureResult.ReplaceSuperCapture;
}
// Most of the time, a 'super' call will be the first real statement in a constructor body.
// In these cases, we'd like to transform these into a *single* statement instead of a declaration
// followed by an assignment statement for '_this'. For instance, if we emitted without an initializer,
// we'd get:
//
// var _this;
// _this = _super.call(...) || this;
//
// instead of
//
// var _this = _super.call(...) || this;
//
// Additionally, if the 'super()' call is the last statement, we should just avoid capturing
// entirely and immediately return the result like so:
//
// return _super.call(...) || this;
//
let firstStatement: Statement;
let superCallExpression: Expression;
const ctorStatements = ctor.body.statements;
if (statementOffset < ctorStatements.length) {
firstStatement = ctorStatements[statementOffset];
if (firstStatement.kind === SyntaxKind.ExpressionStatement && isSuperCallExpression((firstStatement as ExpressionStatement).expression)) {
const superCall = (firstStatement as ExpressionStatement).expression as CallExpression;
superCallExpression = setOriginalNode(
saveStateAndInvoke(superCall, visitImmediateSuperCallInBody),
superCall
);
}
}
// Return the result if we have an immediate super() call on the last statement.
if (superCallExpression && statementOffset === ctorStatements.length - 1) {
statements.push(createReturn(superCallExpression));
return SuperCaptureResult.ReplaceWithReturn;
}
// Perform the capture.
captureThisForNode(statements, ctor, superCallExpression, firstStatement);
// If we're actually replacing the original statement, we need to signal this to the caller.
if (superCallExpression) {
return SuperCaptureResult.ReplaceSuperCapture;
}
return SuperCaptureResult.NoReplacement;
}
function createDefaultSuperCallOrThis() {
const actualThis = createThis();
setEmitFlags(actualThis, EmitFlags.NoSubstitution);
const superCall = createFunctionApply(
createIdentifier("_super"),
actualThis,
createIdentifier("arguments"),
);
return createLogicalOr(superCall, actualThis);
}
/**
@@ -1121,24 +1270,29 @@ namespace ts {
*/
function addCaptureThisForNodeIfNeeded(statements: Statement[], node: Node): void {
if (node.transformFlags & TransformFlags.ContainsCapturedLexicalThis && node.kind !== SyntaxKind.ArrowFunction) {
enableSubstitutionsForCapturedThis();
const captureThisStatement = createVariableStatement(
/*modifiers*/ undefined,
createVariableDeclarationList([
createVariableDeclaration(
"_this",
/*type*/ undefined,
createThis()
)
])
);
setEmitFlags(captureThisStatement, EmitFlags.NoComments | EmitFlags.CustomPrologue);
setSourceMapRange(captureThisStatement, node);
statements.push(captureThisStatement);
captureThisForNode(statements, node, createThis());
}
}
function captureThisForNode(statements: Statement[], node: Node, initializer: Expression | undefined, originalStatement?: Statement): void {
enableSubstitutionsForCapturedThis();
const captureThisStatement = createVariableStatement(
/*modifiers*/ undefined,
createVariableDeclarationList([
createVariableDeclaration(
"_this",
/*type*/ undefined,
initializer
)
]),
originalStatement
);
setEmitFlags(captureThisStatement, EmitFlags.NoComments | EmitFlags.CustomPrologue);
setSourceMapRange(captureThisStatement, node);
statements.push(captureThisStatement);
}
/**
* Adds statements to the class body function for a class to define the members of the
* class.
@@ -2523,11 +2677,23 @@ namespace ts {
*
* @param node a CallExpression.
*/
function visitCallExpression(node: CallExpression): LeftHandSideExpression {
function visitCallExpression(node: CallExpression) {
return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true);
}
function visitImmediateSuperCallInBody(node: CallExpression) {
return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ false);
}
function visitCallExpressionWithPotentialCapturedThisAssignment(node: CallExpression, assignToCapturedThis: boolean): CallExpression | BinaryExpression {
// We are here either because SuperKeyword was used somewhere in the expression, or
// because we contain a SpreadElementExpression.
const { target, thisArg } = createCallBinding(node.expression, hoistVariableDeclaration);
if (node.expression.kind === SyntaxKind.SuperKeyword) {
setEmitFlags(thisArg, EmitFlags.NoSubstitution);
}
let resultingCall: CallExpression | BinaryExpression;
if (node.transformFlags & TransformFlags.ContainsSpreadElementExpression) {
// [source]
// f(...a, b)
@@ -2543,7 +2709,7 @@ namespace ts {
// _super.m.apply(this, a.concat([b]))
// _super.prototype.m.apply(this, a.concat([b]))
return createFunctionApply(
resultingCall = createFunctionApply(
visitNode(target, visitor, isExpression),
visitNode(thisArg, visitor, isExpression),
transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)
@@ -2560,13 +2726,27 @@ namespace ts {
// _super.m.call(this, a)
// _super.prototype.m.call(this, a)
return createFunctionCall(
resultingCall = createFunctionCall(
visitNode(target, visitor, isExpression),
visitNode(thisArg, visitor, isExpression),
visitNodes(node.arguments, visitor, isExpression),
/*location*/ node
);
}
if (node.expression.kind === SyntaxKind.SuperKeyword) {
const actualThis = createThis();
setEmitFlags(actualThis, EmitFlags.NoSubstitution);
const initializer =
createLogicalOr(
resultingCall,
actualThis
);
return assignToCapturedThis
? createAssignment(createIdentifier("_this"), initializer)
: initializer;
}
return resultingCall;
}
/**
+4 -4
View File
@@ -982,11 +982,11 @@ namespace ts {
}
/**
* Given an super call\property node returns a closest node where either
* - super call\property is legal in the node and not legal in the parent node the node.
* Given an super call/property node, returns the closest node where
* - a super call/property access is legal in the node and not legal in the parent node the node.
* i.e. super call is legal in constructor but not legal in the class body.
* - node is arrow function (so caller might need to call getSuperContainer in case it needs to climb higher)
* - super call\property is definitely illegal in the node (but might be legal in some subnode)
* - the container is an arrow function (so caller might need to call getSuperContainer again in case it needs to climb higher)
* - a super call/property is definitely illegal in the container (but might be legal in some subnode)
* i.e. super property access is illegal in function declaration but can be legal in the statement list
*/
export function getSuperContainer(node: Node, stopOnFunctions: boolean): Node {
@@ -38,7 +38,7 @@ var A;
var Point3d = (function (_super) {
__extends(Point3d, _super);
function Point3d() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Point3d;
}(Point));
@@ -41,7 +41,7 @@ var A;
var Point3d = (function (_super) {
__extends(Point3d, _super);
function Point3d() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Point3d;
}(Point));
@@ -22,7 +22,7 @@ var __extends = (this && this.__extends) || function (d, b) {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
@@ -22,7 +22,7 @@ var __extends = (this && this.__extends) || function (d, b) {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
@@ -35,9 +35,10 @@ var B = (function () {
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
this.raw = "edge";
this.ro = "readonly please";
var _this = _super.apply(this, arguments) || this;
_this.raw = "edge";
_this.ro = "readonly please";
return _this;
}
Object.defineProperty(C.prototype, "prop", {
get: function () { return "foo"; },
@@ -57,8 +57,9 @@ var B = (function () {
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
this.ro = "readonly please";
var _this = _super.apply(this, arguments) || this;
_this.ro = "readonly please";
return _this;
}
Object.defineProperty(C.prototype, "concreteWithNoBody", {
get: function () { },
@@ -77,8 +78,9 @@ var WrongTypeProperty = (function () {
var WrongTypePropertyImpl = (function (_super) {
__extends(WrongTypePropertyImpl, _super);
function WrongTypePropertyImpl() {
_super.apply(this, arguments);
this.num = "nope, wrong";
var _this = _super.apply(this, arguments) || this;
_this.num = "nope, wrong";
return _this;
}
return WrongTypePropertyImpl;
}(WrongTypeProperty));
@@ -90,7 +92,7 @@ var WrongTypeAccessor = (function () {
var WrongTypeAccessorImpl = (function (_super) {
__extends(WrongTypeAccessorImpl, _super);
function WrongTypeAccessorImpl() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
Object.defineProperty(WrongTypeAccessorImpl.prototype, "num", {
get: function () { return "nope, wrong"; },
@@ -102,8 +104,9 @@ var WrongTypeAccessorImpl = (function (_super) {
var WrongTypeAccessorImpl2 = (function (_super) {
__extends(WrongTypeAccessorImpl2, _super);
function WrongTypeAccessorImpl2() {
_super.apply(this, arguments);
this.num = "nope, wrong";
var _this = _super.apply(this, arguments) || this;
_this.num = "nope, wrong";
return _this;
}
return WrongTypeAccessorImpl2;
}(WrongTypeAccessor));
@@ -34,8 +34,9 @@ var Point = (function () {
var ColoredPoint = (function (_super) {
__extends(ColoredPoint, _super);
function ColoredPoint(x, y, color) {
_super.call(this, x, y);
this.color = color;
var _this = _super.call(this, x, y) || this;
_this.color = color;
return _this;
}
ColoredPoint.prototype.toString = function () {
return _super.prototype.toString.call(this) + " color=" + this.color;
@@ -38,7 +38,7 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
@@ -46,7 +46,7 @@ var Backbone = require("./aliasUsage1_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return VisualizationModel;
}(Backbone.Model));
@@ -40,7 +40,7 @@ var Backbone = require("./aliasUsageInArray_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return VisualizationModel;
}(Backbone.Model));
@@ -39,7 +39,7 @@ var Backbone = require("./aliasUsageInFunctionExpression_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return VisualizationModel;
}(Backbone.Model));
@@ -43,7 +43,7 @@ var Backbone = require("./aliasUsageInGenericFunction_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return VisualizationModel;
}(Backbone.Model));
@@ -45,7 +45,7 @@ var Backbone = require("./aliasUsageInIndexerOfClass_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return VisualizationModel;
}(Backbone.Model));
@@ -40,7 +40,7 @@ var Backbone = require("./aliasUsageInObjectLiteral_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return VisualizationModel;
}(Backbone.Model));
@@ -43,7 +43,7 @@ var Backbone = require("./aliasUsageInOrExpression_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return VisualizationModel;
}(Backbone.Model));
@@ -43,7 +43,7 @@ var Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return VisualizationModel;
}(Backbone.Model));
@@ -64,8 +64,9 @@ var C = (function () {
var D = (function (_super) {
__extends(D, _super);
function D() {
_super.apply(this, arguments);
this.x = moduleA;
var _this = _super.apply(this, arguments) || this;
_this.x = moduleA;
return _this;
}
return D;
}(C));
@@ -39,7 +39,7 @@ var Backbone = require("./aliasUsageInVarAssignment_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return VisualizationModel;
}(Backbone.Model));
@@ -22,7 +22,7 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
@@ -38,7 +38,7 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
@@ -51,7 +51,7 @@ var Base2 = (function () {
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Base2));
@@ -28,7 +28,7 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
@@ -101,7 +101,7 @@ var C1 = (function () {
var C2 = (function (_super) {
__extends(C2, _super);
function C2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
C2.prototype.C2M1 = function () { return null; };
return C2;
@@ -75,7 +75,7 @@ var C1 = (function () {
var C2 = (function (_super) {
__extends(C2, _super);
function C2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
C2.prototype.C2M1 = function () { return null; };
return C2;
@@ -128,7 +128,7 @@ var EmptyTypes;
var derived = (function (_super) {
__extends(derived, _super);
function derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return derived;
}(base));
@@ -187,7 +187,7 @@ var NonEmptyTypes;
var derived = (function (_super) {
__extends(derived, _super);
function derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return derived;
}(base));
@@ -65,14 +65,14 @@ var Action = (function () {
var ActionA = (function (_super) {
__extends(ActionA, _super);
function ActionA() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return ActionA;
}(Action));
var ActionB = (function (_super) {
__extends(ActionB, _super);
function ActionB() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return ActionB;
}(Action));
+2 -2
View File
@@ -70,7 +70,7 @@ var Base = (function () {
var Derived1 = (function (_super) {
__extends(Derived1, _super);
function Derived1() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived1;
}(Base));
@@ -78,7 +78,7 @@ var Derived1 = (function (_super) {
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Base));
@@ -39,7 +39,7 @@ var List = (function () {
var DerivedList = (function (_super) {
__extends(DerivedList, _super);
function DerivedList() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return DerivedList;
}(List));
@@ -33,14 +33,14 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return C;
}(Array));
@@ -116,8 +116,7 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
var _this = this;
_super.call(this, function () { return _this; });
return _super.call(this, function () { return _this; }) || this;
}
return Derived;
}(Base));
@@ -158,8 +157,7 @@ var M2;
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
var _this = this;
_super.call(this, function () { return _this; });
return _super.call(this, function () { return _this; }) || this;
}
return Derived;
}(Base));
@@ -114,21 +114,21 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
var OtherDerived = (function (_super) {
__extends(OtherDerived, _super);
function OtherDerived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return OtherDerived;
}(Base));
@@ -115,21 +115,21 @@ var Errors;
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
var OtherDerived = (function (_super) {
__extends(OtherDerived, _super);
function OtherDerived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return OtherDerived;
}(Base));
@@ -80,21 +80,21 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
var OtherDerived = (function (_super) {
__extends(OtherDerived, _super);
function OtherDerived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return OtherDerived;
}(Base));
@@ -57,21 +57,21 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
var OtherDerived = (function (_super) {
__extends(OtherDerived, _super);
function OtherDerived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return OtherDerived;
}(Base));
@@ -114,21 +114,21 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
var OtherDerived = (function (_super) {
__extends(OtherDerived, _super);
function OtherDerived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return OtherDerived;
}(Base));
@@ -115,21 +115,21 @@ var Errors;
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
var OtherDerived = (function (_super) {
__extends(OtherDerived, _super);
function OtherDerived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return OtherDerived;
}(Base));
@@ -80,21 +80,21 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
var OtherDerived = (function (_super) {
__extends(OtherDerived, _super);
function OtherDerived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return OtherDerived;
}(Base));
@@ -57,21 +57,21 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
var OtherDerived = (function (_super) {
__extends(OtherDerived, _super);
function OtherDerived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return OtherDerived;
}(Base));
@@ -72,7 +72,7 @@ var Generics;
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
@@ -59,7 +59,7 @@ b = a; // ok
var B2 = (function (_super) {
__extends(B2, _super);
function B2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B2;
}(A));
@@ -108,14 +108,14 @@ var OnlyDerived;
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Base));
@@ -167,14 +167,14 @@ var WithBase;
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Base));
@@ -103,14 +103,14 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
@@ -105,14 +105,14 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
@@ -82,7 +82,7 @@ var Generics;
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
@@ -93,7 +93,7 @@ var Generics;
var B2 = (function (_super) {
__extends(B2, _super);
function B2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B2;
}(A));
@@ -118,8 +118,9 @@ value;
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.call(this);
var _this = _super.call(this) || this;
_super.prototype. = value;
return _this;
}
Derived.prototype.foo = function () { _super.prototype. = value; };
Derived.sfoo = function () { _super. = value; };
@@ -19,7 +19,7 @@ var __extends = (this && this.__extends) || function (d, b) {
var Task = (function (_super) {
__extends(Task, _super);
function Task() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Task;
}(Promise));
@@ -61,7 +61,7 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
// async method with only call/get on 'super' does not require a binding
B.prototype.simple = function () {
@@ -13,7 +13,7 @@ var X;
var MyPromise = (function (_super) {
__extends(MyPromise, _super);
function MyPromise() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return MyPromise;
}(Promise));
+3 -2
View File
@@ -43,8 +43,9 @@ Point.origin = new Point(0, 0);
var Point3D = (function (_super) {
__extends(Point3D, _super);
function Point3D(x, y, z, m) {
_super.call(this, x, y);
this.z = z;
var _this = _super.call(this, x, y) || this;
_this.z = z;
return _this;
}
Point3D.prototype.getDist = function () {
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.m);
@@ -17,7 +17,7 @@ function func() {
_a = function (_super) {
__extends(D, _super);
function D() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return D;
};
+11 -8
View File
@@ -43,14 +43,14 @@ var C = (function () {
var ELoc = (function (_super) {
__extends(ELoc, _super);
function ELoc(x) {
_super.call(this, 0, x);
return _super.call(this, 0, x) || this;
}
return ELoc;
}(C));
var ELocVar = (function (_super) {
__extends(ELocVar, _super);
function ELocVar(x) {
_super.call(this, 0, loc);
return _super.call(this, 0, loc) || this;
}
ELocVar.prototype.m = function () {
var loc = 10;
@@ -60,24 +60,27 @@ var ELocVar = (function (_super) {
var D = (function (_super) {
__extends(D, _super);
function D(z) {
_super.call(this, this.z);
this.z = z;
var _this = _super.call(this, _this.z) || this;
_this.z = z;
return _this;
}
return D;
}(C)); // too few params
var E = (function (_super) {
__extends(E, _super);
function E(z) {
_super.call(this, 0, this.z);
this.z = z;
var _this = _super.call(this, 0, _this.z) || this;
_this.z = z;
return _this;
}
return E;
}(C));
var F = (function (_super) {
__extends(F, _super);
function F(z) {
_super.call(this, "hello", this.z);
this.z = z;
var _this = _super.call(this, "hello", _this.z) || this;
_this.z = z;
return _this;
}
return F;
}(C)); // first param type
@@ -38,7 +38,7 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
@@ -51,7 +51,7 @@ var Class1 = (function () {
var Class2 = (function (_super) {
__extends(Class2, _super);
function Class2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Class2;
}(Class1));
@@ -63,7 +63,7 @@ var Class3 = (function () {
var Class4 = (function (_super) {
__extends(Class4, _super);
function Class4() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Class4;
}(Class3));
@@ -41,7 +41,7 @@ var CBaseBase = (function () {
var CBase = (function (_super) {
__extends(CBase, _super);
function CBase() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return CBase;
}(CBaseBase));
@@ -59,7 +59,7 @@ var Wrapper = (function () {
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
C.prototype.works = function () {
new CBaseBase(this);
+3 -1
View File
@@ -36,8 +36,10 @@ var B = (function () {
var C = (function (_super) {
__extends(C, _super);
function C() {
this.x;
var _this;
_this.x;
any;
return _this;
}
return C;
}(B));
@@ -44,14 +44,14 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Base));
@@ -40,14 +40,14 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Base));
@@ -46,7 +46,7 @@ var E = (function () {
var F = (function (_super) {
__extends(F, _super);
function F() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return F;
}(C));
@@ -59,8 +59,9 @@ var C1 = (function () {
var D1 = (function (_super) {
__extends(D1, _super);
function D1() {
_super.apply(this, arguments);
this.i = "bar";
var _this = _super.apply(this, arguments) || this;
_this.i = "bar";
return _this;
}
return D1;
}(C1));
@@ -84,21 +84,21 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
var OtherDerived = (function (_super) {
__extends(OtherDerived, _super);
function OtherDerived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return OtherDerived;
}(Base));
@@ -131,21 +131,21 @@ var Errors;
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
var OtherDerived = (function (_super) {
__extends(OtherDerived, _super);
function OtherDerived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return OtherDerived;
}(Base));
@@ -64,21 +64,21 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
var OtherDerived = (function (_super) {
__extends(OtherDerived, _super);
function OtherDerived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return OtherDerived;
}(Base));
@@ -64,21 +64,21 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
var OtherDerived = (function (_super) {
__extends(OtherDerived, _super);
function OtherDerived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return OtherDerived;
}(Base));
@@ -67,21 +67,21 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived;
}(Base));
var Derived2 = (function (_super) {
__extends(Derived2, _super);
function Derived2() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Derived2;
}(Derived));
var OtherDerived = (function (_super) {
__extends(OtherDerived, _super);
function OtherDerived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return OtherDerived;
}(Base));
+3 -2
View File
@@ -99,8 +99,9 @@ var C = (function () {
var D = (function (_super) {
__extends(D, _super);
function D() {
_super.call(this, 1, 2);
_super.apply(this, [1, 2].concat(a));
var _this = _super.call(this, 1, 2) || this;
_this = _super.apply(this, [1, 2].concat(a)) || this;
return _this;
}
D.prototype.foo = function () {
_super.prototype.foo.call(this, 1, 2);
@@ -22,8 +22,7 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
var _this = this;
_super.call(this, { test: function () { return _this.someMethod(); } });
return _super.call(this, { test: function () { return _this.someMethod(); } }) || this;
}
B.prototype.someMethod = function () { };
return B;
+2 -2
View File
@@ -59,7 +59,7 @@ var D = (function () {
var E = (function (_super) {
__extends(E, _super);
function E() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return E;
}(A));
@@ -67,7 +67,7 @@ var E = (function (_super) {
var F = (function (_super) {
__extends(F, _super);
function F() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return F;
}(A));
@@ -36,7 +36,7 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
@@ -42,14 +42,14 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return C;
}(B));
@@ -49,14 +49,14 @@ var Foo;
var Bar = (function (_super) {
__extends(Bar, _super);
function Bar() {
_super.call(this);
return _super.call(this) || this;
}
return Bar;
}(Foo.Object));
var Baz = (function (_super) {
__extends(Baz, _super);
function Baz() {
_super.call(this);
return _super.call(this) || this;
}
return Baz;
}(Object));
@@ -24,10 +24,11 @@ var Based = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.call(this);
this;
this.x = 10;
var that = this;
var _this = _super.call(this) || this;
_this;
_this.x = 10;
var that = _this;
return _this;
}
return Derived;
}(Based));
@@ -24,10 +24,12 @@ var Based = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
this.x = 100;
_super.call(this);
this.x = 10;
var that = this;
var _this;
_this.x = 100;
_this = _super.call(this) || this;
_this.x = 10;
var that = _this;
return _this;
}
return Derived;
}(Based));
@@ -29,15 +29,17 @@ var Based = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
var _this;
var innver = (function () {
function innver() {
this.y = true;
}
return innver;
}());
_super.call(this);
this.x = 10;
var that = this;
_this = _super.call(this) || this;
_this.x = 10;
var that = _this;
return _this;
}
return Derived;
}(Based));
@@ -33,7 +33,7 @@ var Based = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
var _this = this;
var _this;
(function () {
_this; // No error
});
@@ -43,10 +43,11 @@ var Derived = (function (_super) {
(function () {
_this; // No error
})();
_super.call(this);
_super.call(this);
this.x = 10;
var that = this;
_this = _super.call(this) || this;
_this = _super.call(this) || this;
_this.x = 10;
var that = _this;
return _this;
}
return Derived;
}(Based));
@@ -25,7 +25,7 @@ var Based = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.call(this, this.x);
return _super.call(this, this.x) || this;
}
return Derived;
}(Based));
@@ -28,9 +28,10 @@ var Base = (function () {
var Super = (function (_super) {
__extends(Super, _super);
function Super() {
var _this = this;
var _this;
(function () { return _this; }); // No Error
_super.call(this);
_this = _super.call(this) || this;
return _this;
}
return Super;
}(Base));
@@ -23,8 +23,7 @@ var Base = (function () {
var Super = (function (_super) {
__extends(Super, _super);
function Super() {
var _this = this;
_super.call(this, (function () { return _this; })); // No error
return _super.call(this, (function () { return _this; })) || this;
}
return Super;
}(Base));
@@ -28,8 +28,10 @@ var Base = (function () {
var Super = (function (_super) {
__extends(Super, _super);
function Super() {
var that = this;
_super.call(this);
var _this;
var that = _this;
_this = _super.call(this) || this;
return _this;
}
return Super;
}(Base));
@@ -32,7 +32,7 @@ var B;
var D = (function (_super) {
__extends(D, _super);
function D() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return D;
}(B.a.C));
@@ -32,7 +32,7 @@ var maker;
var Bar = (function (_super) {
__extends(Bar, _super);
function Bar() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return Bar;
}(Foo));
@@ -28,14 +28,14 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return C;
}(B));
@@ -24,7 +24,7 @@ var foo = (function () {
var bar = (function (_super) {
__extends(bar, _super);
function bar() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
bar.prototype.test = function () {
this.
@@ -31,28 +31,28 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return C;
}(B));
var D = (function (_super) {
__extends(D, _super);
function D() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return D;
}(B));
var E = (function (_super) {
__extends(E, _super);
function E() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
E.prototype.bar = function () { };
return E;
@@ -31,7 +31,7 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
@@ -39,28 +39,28 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return C;
}(A)); // error -- inherits abstract methods
var D = (function (_super) {
__extends(D, _super);
function D() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return D;
}(A)); // error -- inherits abstract methods
var E = (function (_super) {
__extends(E, _super);
function E() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
E.prototype.foo = function () { return this.t; };
return E;
@@ -68,7 +68,7 @@ var E = (function (_super) {
var F = (function (_super) {
__extends(F, _super);
function F() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
F.prototype.bar = function (t) { };
return F;
@@ -76,7 +76,7 @@ var F = (function (_super) {
var G = (function (_super) {
__extends(G, _super);
function G() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
G.prototype.foo = function () { return this.t; };
G.prototype.bar = function (t) { };
@@ -24,7 +24,7 @@ var M;
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
@@ -35,14 +35,14 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return C;
}(A));
@@ -54,42 +54,42 @@ var AA = (function () {
var BB = (function (_super) {
__extends(BB, _super);
function BB() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return BB;
}(AA));
var CC = (function (_super) {
__extends(CC, _super);
function CC() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return CC;
}(AA));
var DD = (function (_super) {
__extends(DD, _super);
function DD() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return DD;
}(BB));
var EE = (function (_super) {
__extends(EE, _super);
function EE() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return EE;
}(BB));
var FF = (function (_super) {
__extends(FF, _super);
function FF() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return FF;
}(CC));
var GG = (function (_super) {
__extends(GG, _super);
function GG() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return GG;
}(CC));
@@ -41,14 +41,14 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return C;
}(B));
@@ -82,21 +82,21 @@ new x; // okay -- undefined behavior at runtime
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return C;
}(B)); // error -- not declared abstract
var D = (function (_super) {
__extends(D, _super);
function D() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return D;
}(B)); // okay
var E = (function (_super) {
__extends(E, _super);
function E() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
E.prototype.bar = function () { return 1; };
return E;
@@ -104,7 +104,7 @@ var E = (function (_super) {
var F = (function (_super) {
__extends(F, _super);
function F() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
F.prototype.bar = function () { return 2; };
return F;
@@ -38,7 +38,7 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
@@ -51,7 +51,7 @@ var AA = (function () {
var BB = (function (_super) {
__extends(BB, _super);
function BB() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
BB.prototype.bar = function () { };
return BB;
@@ -59,14 +59,14 @@ var BB = (function (_super) {
var CC = (function (_super) {
__extends(CC, _super);
function CC() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return CC;
}(BB)); // error
var DD = (function (_super) {
__extends(DD, _super);
function DD() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
DD.prototype.foo = function () { };
return DD;
@@ -42,7 +42,7 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
B.prototype.bar = function () { _super.prototype.foo.call(this); };
B.prototype.baz = function () { return this.foo; };
@@ -51,7 +51,7 @@ var B = (function (_super) {
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
C.prototype.foo = function () { return 2; };
C.prototype.qux = function () { return _super.prototype.foo.call(this) || _super.prototype.foo; }; // 2 errors, foo is abstract
@@ -68,7 +68,7 @@ var AA = (function () {
var BB = (function (_super) {
__extends(BB, _super);
function BB() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return BB;
}(AA));
@@ -31,7 +31,7 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
B.prototype.foo = function () { return 1; };
return B;
@@ -39,7 +39,7 @@ var B = (function (_super) {
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return C;
}(A));
@@ -41,21 +41,21 @@ var A = (function () {
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return B;
}(A));
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return C;
}(A));
var D = (function (_super) {
__extends(D, _super);
function D() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
D.prototype.foo = function () { };
return D;
@@ -63,7 +63,7 @@ var D = (function (_super) {
var E = (function (_super) {
__extends(E, _super);
function E() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
E.prototype.foo = function () { };
return E;
@@ -76,21 +76,21 @@ var AA = (function () {
var BB = (function (_super) {
__extends(BB, _super);
function BB() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return BB;
}(AA));
var CC = (function (_super) {
__extends(CC, _super);
function CC() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return CC;
}(AA));
var DD = (function (_super) {
__extends(DD, _super);
function DD() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
DD.prototype.foo = function () { };
return DD;
@@ -77,8 +77,9 @@ var BaseC = (function () {
var DerivedA = (function (_super) {
__extends(DerivedA, _super);
function DerivedA(x) {
_super.call(this, x);
this.x = x;
var _this = _super.call(this, x) || this;
_this.x = x;
return _this;
}
DerivedA.prototype.createInstance = function () { new DerivedA(5); };
DerivedA.prototype.createBaseInstance = function () { new BaseA(6); };
@@ -88,8 +89,9 @@ var DerivedA = (function (_super) {
var DerivedB = (function (_super) {
__extends(DerivedB, _super);
function DerivedB(x) {
_super.call(this, x);
this.x = x;
var _this = _super.call(this, x) || this;
_this.x = x;
return _this;
}
DerivedB.prototype.createInstance = function () { new DerivedB(7); };
DerivedB.prototype.createBaseInstance = function () { new BaseB(8); }; // ok
@@ -99,8 +101,9 @@ var DerivedB = (function (_super) {
var DerivedC = (function (_super) {
__extends(DerivedC, _super);
function DerivedC(x) {
_super.call(this, x);
this.x = x;
var _this = _super.call(this, x) || this;
_this.x = x;
return _this;
}
DerivedC.prototype.createInstance = function () { new DerivedC(9); };
DerivedC.prototype.createBaseInstance = function () { new BaseC(10); }; // error
@@ -51,7 +51,7 @@ var A = (function () {
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return C;
}(A));
@@ -73,7 +73,7 @@ var D = (function () {
var F = (function (_super) {
__extends(F, _super);
function F() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return F;
}(D));
@@ -25,7 +25,7 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
Derived.make = function () { new Base(); }; // ok
return Derived;
@@ -59,8 +59,9 @@ c3.p; // protected, error
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived(p) {
_super.call(this, p);
this.p; // OK
var _this = _super.call(this, p) || this;
_this.p; // OK
return _this;
}
return Derived;
}(C3));
@@ -59,8 +59,9 @@ c3.p; // protected, error
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived(p) {
_super.call(this, p);
this.p; // OK
var _this = _super.call(this, p) || this;
_this.p; // OK
return _this;
}
return Derived;
}(C3));
@@ -28,9 +28,10 @@ var Base = (function () {
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived(p) {
_super.call(this, p);
this.p = p;
this.p; // OK
var _this = _super.call(this, p) || this;
_this.p = p;
_this.p; // OK
return _this;
}
return Derived;
}(Base));
@@ -35,7 +35,7 @@ var M;
var O = (function (_super) {
__extends(O, _super);
function O() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
return O;
}(M.N));

Some files were not shown because too many files have changed in this diff Show More