microsoft / microsoft/pxt

Check against language keywords before creating sprite kind.

Open
#7,666 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.3k
Forks
641
Avg merge
12h 4m
Merged PRs (30d)
57

Description

image

image

Creating a kind with name of a language keyword breaks the ts code, stopping the project from running.

Should check against keywords and add '_' like that on creating variables?
https://github.com/microsoft/pxt/blob/fb6eaa80001d77892055dbb3839094c60c038aca/pxtblocks/fields/field_kind.ts#L88

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pxtblocks/fields/field_kind.ts around line 88, where the sprite kind name is created. Reproduce the issue with a language keyword as the kind name and inspect the generated TypeScript. Done means keyword names no longer break the generated code while ordinary kind names continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.