BUG Converting upvar blocks to JavaScript: TypeError: null is not an object (evaluating 'block.getField('VAR').getText')
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 641
- Avg merge
- 12h 4m
- Merged PRs (30d)
- 57
Description
Trying to convert this innocuous, default for each block into JavaScript results in the error
TypeError: null is not an object (evaluating 'block.getField('VAR').getText')
var variable0 = Blockly.JavaScript.variableDB_.getName(
block.getField('VAR').getText(), Blockly.Variables.NAME_TYPE);
What's the fix for this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at generators/javascript/loops.js line 145 and reproduce JavaScript conversion for the default for-each block. Inspect why the block lacks the VAR field before calling getText, then verify the conversion no longer throws and add or update a relevant regression test if one is found nearby.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100