Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix error when constructor default arg refers to own static property …
- Loading branch information
Showing
7 changed files
with
63 additions
and
3 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
6 changes: 6 additions & 0 deletions
6
...l-plugin-transform-es2015-parameters/test/fixtures/parameters/default-iife-4253/actual.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,6 @@ | ||
class Ref { | ||
constructor(id = ++Ref.nextID) { | ||
this.id = id | ||
} | ||
} | ||
Ref.nextID = 0 |
9 changes: 9 additions & 0 deletions
9
...bel-plugin-transform-es2015-parameters/test/fixtures/parameters/default-iife-4253/exec.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,9 @@ | ||
class Ref { | ||
static nextId = 0 | ||
constructor(id = ++Ref.nextId, n = id) { | ||
this.id = n | ||
} | ||
} | ||
|
||
assert.equal(1, new Ref().id) | ||
assert.equal(2, new Ref().id) |
8 changes: 8 additions & 0 deletions
8
...plugin-transform-es2015-parameters/test/fixtures/parameters/default-iife-4253/expected.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,8 @@ | ||
var Ref = function Ref() { | ||
var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ++Ref.nextID; | ||
babelHelpers.classCallCheck(this, Ref); | ||
|
||
this.id = id; | ||
}; | ||
|
||
Ref.nextID = 0; |
11 changes: 11 additions & 0 deletions
11
...l-plugin-transform-es2015-parameters/test/fixtures/parameters/default-iife-self/actual.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,11 @@ | ||
class Ref { | ||
constructor(ref = Ref) { | ||
this.ref = ref | ||
} | ||
} | ||
|
||
class X { | ||
constructor(x = foo) { | ||
this.x = x | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...bel-plugin-transform-es2015-parameters/test/fixtures/parameters/default-iife-self/exec.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,7 @@ | ||
class Ref { | ||
constructor(ref = Ref) { | ||
this.ref = ref | ||
} | ||
} | ||
|
||
assert.equal(Ref, new Ref().ref) |
13 changes: 13 additions & 0 deletions
13
...plugin-transform-es2015-parameters/test/fixtures/parameters/default-iife-self/expected.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,13 @@ | ||
var Ref = function Ref() { | ||
var ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Ref; | ||
babelHelpers.classCallCheck(this, Ref); | ||
|
||
this.ref = ref; | ||
}; | ||
|
||
var X = function X() { | ||
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : foo; | ||
babelHelpers.classCallCheck(this, X); | ||
|
||
this.x = x; | ||
}; |