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

[Spritelab] Add color to reserved words #39014

Merged
merged 1 commit into from
Feb 12, 2021
Merged

[Spritelab] Add color to reserved words #39014

merged 1 commit into from
Feb 12, 2021

Conversation

ajpal
Copy link
Contributor

@ajpal ajpal commented Feb 11, 2021

Quick fix to prevent clobbering color which is a built-in p5.play function
Before
image
image

After
image

Links

Testing story

Reviewer Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@ajpal ajpal requested a review from a team February 11, 2021 21:45
@@ -8,6 +8,7 @@ module.exports.SpritelabReservedWords = [
'CENTER',
'World',
'background',
'color',
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm not sure i understand how this list woks (mostly focused on this "p5 globals" section) -- are these all keywords that exist in p5[.play] that we want to take control of?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are built-in functions in p5.play that we want to not overwrite. This list is then passed into Blockly as reserved words, so that if a student makes a variable named color, it generates code like var color2 = ... instead of var color = ...

Copy link
Contributor

Choose a reason for hiding this comment

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

ahhh, i had it backwards -- thank you!

@ajpal ajpal merged commit 0dde145 into staging Feb 12, 2021
@ajpal ajpal deleted the feb11-color-reserved branch February 12, 2021 18:32
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.

None yet

2 participants