- Notifications
You must be signed in to change notification settings - Fork664
feat: move nil check to call sites#658
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@rbuckton Can you take a look at this? |
SaadiSave commentedMay 7, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@SoulPancake Sorry for jumping on here for a slightly tangential issue, but I noticed that nil checks are inconsistent throughout the codebase. For example, https://github.com/microsoft/typescript-go/blob/main/internal%2Fast%2Fast.go#L15-L31 typeVisitorfunc(*Node)boolfuncvisit(vVisitor,node*Node)bool {ifnode!=nil {returnv(node) }returnfalse}funcvisitNodes(vVisitor,nodes []*Node)bool {for_,node:=rangenodes {ifv(node) {returntrue } }returnfalse}
|
@SaadiSave Agreed, I will add the nil check in the loop |
SaadiSave commentedMay 8, 2025
@SoulPancake is there a lint to enforce nil checks? |
Don't think so@SaadiSave |
This PR has gotten out of date as main changed. Could you update it, or close it if you don't plan on working on this anymore? |
I will update it asap@jakebailey |
699cd2d
tofd4cf87
Compare@jakebailey Done, Can you take a look at this? |
Uh oh!
There was an error while loading.Please reload this page.
I feel like most of these are redundant; I would think we'd only want ones that correspond to undefined checks in the original code. |
Uh oh!
There was an error while loading.Please reload this page.
This addresses
// TODO(rbuckton): Move
node != niltest to call sites
@rbuckton Can you please review this
I can undo the stylistic whitespace changes in the internal/ast/utilities.gbut I think they're for the better, LMK what you think