Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in deconstruction minification #397

Closed
Reinmar opened this issue Feb 1, 2017 · 2 comments
Closed

Bug in deconstruction minification #397

Reinmar opened this issue Feb 1, 2017 · 2 comments

Comments

@Reinmar
Copy link

Reinmar commented Feb 1, 2017

I've been testing how Babili works with CKEditor 5 and I encountered a bug with swapped variable names.

I tried to debug it and the smallest possible scenario is minifying this function: https://github.com/ckeditor/ckeditor5-utils/blob/d3702f4d396849ab3e67358ef74fb670133b4e89/src/dom/position.js#L78-L113

If you pass it through Babili (see on REPL) the name property in the return value is set to bestPosition from line 93.

We had this:

[ name, bestPosition ] =
getBestPosition( positions, targetRect, elementRect, limiterRect, viewportRect ) 

// ...

return { left, top, name };

And we get this:

[i,j]=getBestPosition(c,h,g,m,n)

// ...

return{left:k,top:l,name:j}
@Reinmar
Copy link
Author

Reinmar commented Feb 1, 2017

Fun fact, if you swap order of variable definitions to:

	let name;
	let bestPosition;

everything is ok.

@boopathi
Copy link
Member

boopathi commented Feb 1, 2017

Related #326, #369. #390 fixes it and is already merged to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants