-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port PR#6860 lexically check calling super before this
Update baselines add baselines Update baseline Port PR #6860 lexically check calling super before this Check using "super" before "this" lexically instead of using the NodeCheckFlags Remove "type-checking" way of checking if super is used before this. Instead check using whether super occurs before this syntactically Refactor the code Dive down to get super call Address PR Address PR about tests Add a flag so we don't repeatedly finding super call rename function Move tests into correct location Address PR: report error on super call instead of entire constructor node remove marge mark
- Loading branch information
Kanchalai Tanglertsampan
committed
Feb 11, 2016
1 parent
20f7b18
commit 90c08c2
Showing
31 changed files
with
747 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
tests/baselines/reference/superCallBeforeThisAccessing1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//// [superCallBeforeThisAccessing1.ts] | ||
declare var Factory: any | ||
|
||
class Base { | ||
constructor(c) { } | ||
} | ||
class D extends Base { | ||
private _t; | ||
constructor() { | ||
super(i); | ||
var s = { | ||
t: this._t | ||
} | ||
var i = Factory.create(s); | ||
} | ||
} | ||
|
||
|
||
//// [superCallBeforeThisAccessing1.js] | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var Base = (function () { | ||
function Base(c) { | ||
} | ||
return Base; | ||
}()); | ||
var D = (function (_super) { | ||
__extends(D, _super); | ||
function D() { | ||
_super.call(this, i); | ||
var s = { | ||
t: this._t | ||
}; | ||
var i = Factory.create(s); | ||
} | ||
return D; | ||
}(Base)); |
38 changes: 38 additions & 0 deletions
38
tests/baselines/reference/superCallBeforeThisAccessing1.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
=== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing1.ts === | ||
declare var Factory: any | ||
>Factory : Symbol(Factory, Decl(superCallBeforeThisAccessing1.ts, 0, 11)) | ||
|
||
class Base { | ||
>Base : Symbol(Base, Decl(superCallBeforeThisAccessing1.ts, 0, 24)) | ||
|
||
constructor(c) { } | ||
>c : Symbol(c, Decl(superCallBeforeThisAccessing1.ts, 3, 16)) | ||
} | ||
class D extends Base { | ||
>D : Symbol(D, Decl(superCallBeforeThisAccessing1.ts, 4, 1)) | ||
>Base : Symbol(Base, Decl(superCallBeforeThisAccessing1.ts, 0, 24)) | ||
|
||
private _t; | ||
>_t : Symbol(_t, Decl(superCallBeforeThisAccessing1.ts, 5, 22)) | ||
|
||
constructor() { | ||
super(i); | ||
>super : Symbol(Base, Decl(superCallBeforeThisAccessing1.ts, 0, 24)) | ||
>i : Symbol(i, Decl(superCallBeforeThisAccessing1.ts, 12, 11)) | ||
|
||
var s = { | ||
>s : Symbol(s, Decl(superCallBeforeThisAccessing1.ts, 9, 11)) | ||
|
||
t: this._t | ||
>t : Symbol(t, Decl(superCallBeforeThisAccessing1.ts, 9, 17)) | ||
>this._t : Symbol(_t, Decl(superCallBeforeThisAccessing1.ts, 5, 22)) | ||
>this : Symbol(D, Decl(superCallBeforeThisAccessing1.ts, 4, 1)) | ||
>_t : Symbol(_t, Decl(superCallBeforeThisAccessing1.ts, 5, 22)) | ||
} | ||
var i = Factory.create(s); | ||
>i : Symbol(i, Decl(superCallBeforeThisAccessing1.ts, 12, 11)) | ||
>Factory : Symbol(Factory, Decl(superCallBeforeThisAccessing1.ts, 0, 11)) | ||
>s : Symbol(s, Decl(superCallBeforeThisAccessing1.ts, 9, 11)) | ||
} | ||
} | ||
|
43 changes: 43 additions & 0 deletions
43
tests/baselines/reference/superCallBeforeThisAccessing1.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
=== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing1.ts === | ||
declare var Factory: any | ||
>Factory : any | ||
|
||
class Base { | ||
>Base : Base | ||
|
||
constructor(c) { } | ||
>c : any | ||
} | ||
class D extends Base { | ||
>D : D | ||
>Base : Base | ||
|
||
private _t; | ||
>_t : any | ||
|
||
constructor() { | ||
super(i); | ||
>super(i) : void | ||
>super : typeof Base | ||
>i : any | ||
|
||
var s = { | ||
>s : { t: any; } | ||
>{ t: this._t } : { t: any; } | ||
|
||
t: this._t | ||
>t : any | ||
>this._t : any | ||
>this : this | ||
>_t : any | ||
} | ||
var i = Factory.create(s); | ||
>i : any | ||
>Factory.create(s) : any | ||
>Factory.create : any | ||
>Factory : any | ||
>create : any | ||
>s : { t: any; } | ||
} | ||
} | ||
|
31 changes: 31 additions & 0 deletions
31
tests/baselines/reference/superCallBeforeThisAccessing2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//// [superCallBeforeThisAccessing2.ts] | ||
class Base { | ||
constructor(c) { } | ||
} | ||
class D extends Base { | ||
private _t; | ||
constructor() { | ||
super(() => { this._t }); // no error. only check when this is directly accessing in constructor | ||
} | ||
} | ||
|
||
|
||
//// [superCallBeforeThisAccessing2.js] | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var Base = (function () { | ||
function Base(c) { | ||
} | ||
return Base; | ||
}()); | ||
var D = (function (_super) { | ||
__extends(D, _super); | ||
function D() { | ||
var _this = this; | ||
_super.call(this, function () { _this._t; }); // no error. only check when this is directly accessing in constructor | ||
} | ||
return D; | ||
}(Base)); |
23 changes: 23 additions & 0 deletions
23
tests/baselines/reference/superCallBeforeThisAccessing2.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
=== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing2.ts === | ||
class Base { | ||
>Base : Symbol(Base, Decl(superCallBeforeThisAccessing2.ts, 0, 0)) | ||
|
||
constructor(c) { } | ||
>c : Symbol(c, Decl(superCallBeforeThisAccessing2.ts, 1, 16)) | ||
} | ||
class D extends Base { | ||
>D : Symbol(D, Decl(superCallBeforeThisAccessing2.ts, 2, 1)) | ||
>Base : Symbol(Base, Decl(superCallBeforeThisAccessing2.ts, 0, 0)) | ||
|
||
private _t; | ||
>_t : Symbol(_t, Decl(superCallBeforeThisAccessing2.ts, 3, 22)) | ||
|
||
constructor() { | ||
super(() => { this._t }); // no error. only check when this is directly accessing in constructor | ||
>super : Symbol(Base, Decl(superCallBeforeThisAccessing2.ts, 0, 0)) | ||
>this._t : Symbol(_t, Decl(superCallBeforeThisAccessing2.ts, 3, 22)) | ||
>this : Symbol(D, Decl(superCallBeforeThisAccessing2.ts, 2, 1)) | ||
>_t : Symbol(_t, Decl(superCallBeforeThisAccessing2.ts, 3, 22)) | ||
} | ||
} | ||
|
25 changes: 25 additions & 0 deletions
25
tests/baselines/reference/superCallBeforeThisAccessing2.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
=== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing2.ts === | ||
class Base { | ||
>Base : Base | ||
|
||
constructor(c) { } | ||
>c : any | ||
} | ||
class D extends Base { | ||
>D : D | ||
>Base : Base | ||
|
||
private _t; | ||
>_t : any | ||
|
||
constructor() { | ||
super(() => { this._t }); // no error. only check when this is directly accessing in constructor | ||
>super(() => { this._t }) : void | ||
>super : typeof Base | ||
>() => { this._t } : () => void | ||
>this._t : any | ||
>this : this | ||
>_t : any | ||
} | ||
} | ||
|
Oops, something went wrong.