Simplify es2015 visitor, replace function tracking with flags

This commit is contained in:
Ron Buckton
2016-12-07 13:46:04 -08:00
parent 4e9bc69727
commit 25c7caaef9
8 changed files with 598 additions and 402 deletions

View File

@@ -1754,6 +1754,19 @@ namespace ts {
// Utilities
export function restoreEnclosingLabels(node: Statement, enclosingLabeledStatements: LabeledStatement[]) {
if (enclosingLabeledStatements) {
for (const labeledStatement of enclosingLabeledStatements) {
node = updateLabel(
labeledStatement,
labeledStatement.label,
node
);
}
}
return node;
}
export interface CallBinding {
target: LeftHandSideExpression;
thisArg: Expression;

File diff suppressed because it is too large Load Diff

View File

@@ -883,6 +883,18 @@ namespace ts {
return false;
}
export function getAllLabeledStatements(node: LabeledStatement): { statement: Statement; labeledStatements: LabeledStatement[]; } {
switch (node.statement.kind) {
case SyntaxKind.LabeledStatement:
const result = getAllLabeledStatements(<LabeledStatement>node.statement);
if (result) {
result.labeledStatements.push(node);
}
return result;
default:
return { statement: <IterationStatement>node.statement, labeledStatements: [node] };
}
}
export function isFunctionBlock(node: Node) {
return node && node.kind === SyntaxKind.Block && isFunctionLike(node.parent);

View File

@@ -41,9 +41,9 @@ var Q = (function (_super) {
__extends(Q, _super);
// Super is not allowed in constructor args
function Q(z, zz, zzz) {
if (z === void 0) { z = _super.; }
if (zz === void 0) { zz = _super.; }
if (zzz === void 0) { zzz = function () { return _super.; }; }
if (z === void 0) { z = _super.prototype.; }
if (zz === void 0) { zz = _super.prototype.; }
if (zzz === void 0) { zzz = function () { return _super.prototype.; }; }
var _this = _super.call(this) || this;
_this.z = z;
_this.xx = _super.prototype.;

View File

@@ -27,7 +27,7 @@ var B = (function () {
var C = (function (_super) {
__extends(C, _super);
function C(a) {
if (a === void 0) { a = _super.foo.call(_this); }
if (a === void 0) { a = _super.prototype.foo.call(_this); }
var _this;
return _this;
}

View File

@@ -72,14 +72,14 @@ var obj = {
}
},
method: function () {
_super.prototype.method.call(this);
_super.method.call(this);
},
get prop() {
_super.prototype.method.call(this);
_super.method.call(this);
return 10;
},
set prop(value) {
_super.prototype.method.call(this);
_super.method.call(this);
},
p1: function () {
_super.method.call(this);
@@ -110,14 +110,14 @@ var B = (function (_super) {
}
},
method: function () {
_super.prototype.method.call(this);
_super.method.call(this);
},
get prop() {
_super.prototype.method.call(this);
_super.method.call(this);
return 10;
},
set prop(value) {
_super.prototype.method.call(this);
_super.method.call(this);
},
p1: function () {
_super.method.call(this);

View File

@@ -40,7 +40,7 @@ var C1 = (function (_super) {
var C2 = (function (_super) {
__extends(C2, _super);
function C2() {
return _super.call(this, _super.x.call(_this)) || this;
return _super.call(this, _super.prototype.x.call(_this)) || this;
}
return C2;
}(B));

View File

@@ -38,10 +38,10 @@ var ObjectLiteral;
var ThisInObjectLiteral = {
_foo: '1',
get foo() {
return _super.prototype._foo;
return _super._foo;
},
set foo(value) {
_super.prototype._foo = value;
_super._foo = value;
},
test: function () {
return _super._foo;
@@ -62,7 +62,7 @@ var SuperObjectTest = (function (_super) {
SuperObjectTest.prototype.testing = function () {
var test = {
get F() {
return _super.prototype.test.call(this);
return _super.test.call(this);
}
};
};