freeCodeCamp / freeCodeCamp/curriculum-helpers
[Feature Request]: AST Explorer needs to reach inside nested scopes
- Dominant language
- TypeScript
- Stars
- 28
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the feature request
Right now I don't see a way of accessing camper code inside of `if` statements and `for`/`while` loops. Since the explorer could only find things in scope, it won't actually find anything.
### To Reproduce
Use the following code.
```js
function myCoolFunction()
{
for(int x = 0;x < 10;x++)
{
var myNestedVariable = "Hello";
}
return;
}
```
Right now the explorer does not have seem to have any way of retrieving `myNestedVariable`.
### Expected behavior
I should be able to go inside a while loop. Maybe getting a `loop` statement or `if` statement and then proceeding to get the body.
### Screenshots
_No response_
### Desktop OS
_No response_
### Desktop Browser
_No response_
### Desktop Browser Version
_No response_
### Mobile Device
_No response_
### Mobile OS
_No response_
### Mobile Browser
_No response_
### Mobile Browser Version
_No response_
### Additional context
_No response_
Contributor guide
Research direction
Start at the AST Explorer entry point and reproduce the supplied nested-scope example. Trace how scope lookup handles function bodies versus if, for, and while bodies; done means nested variables can be reached through those statements, with coverage for the reported example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100