Skip to content

Conversation

@apple502j
Copy link
Contributor

Thanks @adroitwhiz and @fsih for some advice! (This is basically re-work of #2330)

Resolves

Resolves scratchfoundation/scratch-gui#4392

Proposed Changes

Adds a new function, updateSensingOfReference, similiar to existing updateAssetName. This checks for every block that

  1. has opcode sensing_of
  2. has old name in PROPERTY
  3. has the same OBJECT
  4. doesn't have blocks inserted to OBJECT
    and changes the property.

Reason for Changes

Variable blocks will change their variable name by itself, but sensing_of does not. This will make sensing_of blocks referencing the variable return 0 when they are renamed.

Test Coverage

Added type test and 4 tests:

  1. updateSensingOfReference normal behavior
  2. updateSensingOfReference block inserted
  3. updateSensingOfReference different variable
  4. updateSensingOfReference different target

Copy link
Contributor

@cwillisf cwillisf left a comment

Choose a reason for hiding this comment

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

These changes look good! In the future, it would help us out if you could just update the existing PR instead of making a new one when changes are requested. Thanks!

@cwillisf cwillisf self-assigned this May 22, 2020
@cwillisf cwillisf merged commit 1d9da09 into scratchfoundation:develop May 22, 2020
@apple502j
Copy link
Contributor Author

@cwillisf I tried to do that (and TIL force-push won't work well with closed PR!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Renaming a variable doesn't update existing "(var) of (sprite)" sensing blocks

2 participants