Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* When simplifying object shapes due to unknown assignments, make sure the same assignment is not added repeatedly * Reintroduce UNDEFINED_ASSIGNMENT which behaves like UNKNOWN_ASSIGNMENT but does not simplify object shapes. This solves a problem with assignments to exports. This might change again in the future. * Improve object shape efficiency by assigning associated variables instead of AST nodes to object shapes if possible and prevent assignment of variables to themselves.
- Loading branch information
1 parent
6d0e492
commit bc928fc
Showing
11 changed files
with
54 additions
and
13 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
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
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
3 changes: 3 additions & 0 deletions
3
test/function/samples/recursive-parameter-assignments/_config.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,3 @@ | ||
module.exports = { | ||
description: 'Avoid maximum call stack error with recursive parameter assignments (#1710).' | ||
}; |
16 changes: 16 additions & 0 deletions
16
test/function/samples/recursive-parameter-assignments/main.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,16 @@ | ||
class Test { | ||
constructor ( name, opts ) { | ||
opts = opts || {}; | ||
|
||
if ( name && typeof name === 'object' ) { | ||
opts = name; | ||
name = opts.name; | ||
delete opts.name; | ||
} | ||
|
||
this.name = name; | ||
this.opts = opts; | ||
} | ||
} | ||
|
||
new Test( 'a', {} ); |