Repository navigation
Fix support for JS destructuring in acorn optimizer pass - #20635
Conversation
7c1bb63 to
666dc41
Compare
666dc41 to
8f0faf1
Compare
|
Looks good, but just one more nit: looks like this handling (unsurprisingly, I suppose, since they're very similar) overlaps quite a bit with VariableDeclarator handling a little further below. Is it possible to merge them / reuse functionality? |
Perhaps, but since this code is not really my area of expertise I don't (currently) feel very confident doing such refactorings. |
|
Sure. It seems like it would be fairly easy extraction into a single function, but it's fair if you want to leave that for later. |
|
I did take quick look, but VariableDeclarator handler looks like it doesn't recursively call itself... perhaps it should do, but I'm unsure enough about this code I'd rather leave refactoring like that to later.. or someone who has a better grasp of it. |
Yeah I probably should've said it's very similar to what this function did before this PR. As in, both just walked over a flat list, except VariableDeclarator already supported ObjectPattern/ArrayPattern and this one didn't. Now this one supports those patterns as well as recursive handling, but VariableDeclarator doesn't do recursive walk yet. Leaving for later sounds good, just wanted to describe how / why I arrived at suggestion to merge them for consistent behaviour. |
Fixes: #20631