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

blocks.js/ES6 syntax #2629 #2999

Closed
wants to merge 3 commits into from
Closed

blocks.js/ES6 syntax #2629 #2999

wants to merge 3 commits into from

Conversation

jwalapc
Copy link
Contributor

@jwalapc jwalapc commented Aug 24, 2021

#2629
1)Converted all the function to arrow functions which now is in ES6 syntax.
Replace

...
function foo( ... ) {
...
function bar( ... ) {
...
}
...
}
...

with

...
function foo( ... ) {
...
const bar = ( ... ) => {
...
}
...
}
...

@walterbender please view this.

@jwalapc jwalapc changed the title block.js/ES6 syntax #2629 blocks.js/ES6 syntax #2629 Aug 24, 2021
@walterbender
Copy link
Member

In general, this looks good. A couple of things need addressing:
(1) in many places, you put two spaces after the ==. There should only be one space.
(2) in the blockSclae method, where you changed the scope of blk and stack, you need to remove the declarations on L187 and 188. And I think you missed a few places in that function where you need to then define blk and stack.

@walterbender
Copy link
Member

And please be sure to test, esp. the block scaling code, where you are making somewhat more invasive changes. Please report the results of your tests here.

@jwalapc
Copy link
Contributor Author

jwalapc commented Aug 25, 2021

In general, this looks good. A couple of things need addressing:
(1) in many places, you put two spaces after the ==. There should only be one space.
(2) in the blockSclae method, where you changed the scope of blk and stack, you need to remove the declarations on L187 and 188. And I think you missed a few places in that function where you need to then define blk and stack.

  1. In first point you are saying about the arrow operator right? and can you say me 1 where I gave two spaces?
  2. In 2nd point I should remove the 'let" right ? Because it is globally declared right ?
    @walterbender

@jwalapc
Copy link
Contributor Author

jwalapc commented Aug 25, 2021

And please be sure to test, esp. the block scaling code, where you are making somewhat more invasive changes. Please report the results of your tests here.

And If you dont mind can you elaborate this ? I am actually new to this.

@jwalapc
Copy link
Contributor Author

jwalapc commented Aug 25, 2021

Screenshot from 2021-08-26 00-23-13
Will this work I have removed the declaration in L187 and 188 ?

@walterbender
Copy link
Member

That looks correct.

Regarding testing, start with a "smoke test": does the program still open? Then try invoking some of the functions through the UX: show and hide blocks; resize the blocks; etc.

@jwalapc
Copy link
Contributor Author

jwalapc commented Aug 26, 2021

Completed the required changes and Formatted the entire file properly.
1)Tested the code by running,found zero errors
2)Tested some functions everything is proper
3)Guide me if any more changes needed.
@walterbender If everything is proper please merge it.

@@ -883,7 +882,7 @@ function Blocks(activity) {
// Find the dock position in the connected block.
let foundMatch = false;
let b;
for (b = 0; b < this.blockList[cblk].connections.length; b++) {
for (let b = 0; b < this.blockList[cblk].connections.length; b++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

b is referenced outside of the for loop. We cannot reduce its scope here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done with it please view it @walterbender

@jwalapc
Copy link
Contributor Author

jwalapc commented Aug 28, 2021

@walterbender please view the pr if its correct?

@walterbender
Copy link
Member

In the future, please do not mix things up in your PRs. Your title suggests this is all about conversion to ES6 syntax and yet you incouded some variable scoping changes as well (which is where you introduced numerous errors). These should have been two separate PRs.

@walterbender
Copy link
Member

merged

@jwalapc
Copy link
Contributor Author

jwalapc commented Aug 29, 2021

merged

Thanks @walterbender for helping me so much . Next Pr will be soon and I will Correct my mistakes.

@walterbender
Copy link
Member

walterbender commented Aug 29, 2021 via email

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

Successfully merging this pull request may close these issues.

2 participants