Age | Commit message (Collapse) | Author | |
---|---|---|---|
2023-05-20 | Clarify why we skip non-local functionsv0.0.1 | Teddy Wing | |
2023-05-20 | Clean up panic debugging from c064b2142aa81488e32be387393c494d98696a55 | Teddy Wing | |
2023-05-20 | Fix panic when go statement calls non-function-literal | Teddy Wing | |
2023-05-20 | Clean up 'function literal in variable' code | Teddy Wing | |
* Remove the test code where I was looking for how to get the function literal from the ident specified in the `go` statement. * Clean up `funcLitFromIdent`. | |||
2023-05-20 | Add support for function literals defined in local variables | Teddy Wing | |
In addition to checking function literals after the `go` statement, also check closures assigned to variables. | |||
2023-05-20 | Ideas for getting a FuncLit from an `*ast.Ident` variable | Teddy Wing | |
2023-05-20 | Find `*ast.FuncLit` in local assignment | Teddy Wing | |
Get the FuncLit from the rhs of the local variable. | |||
2023-05-19 | Inspect `go` statement call function to try to find local closures | Teddy Wing | |
2023-05-19 | Add test for local closure assigned to variable | Teddy Wing | |
Try to catch local closures not run directly from the `go` statement, but assigned to a variable first. | |||
2023-05-18 | README: Add install instructions | Teddy Wing | |
2023-05-18 | Add README | Teddy Wing | |
2023-05-18 | Add package documentation | Teddy Wing | |
2023-05-18 | testdata: Add missing license headers | Teddy Wing | |
2023-05-18 | gocapturedrefrace/main: Add version command line argument | Teddy Wing | |
I don't need to use the `flags` package here for a single boolean option. Previously I had tried with `flags` but it conflicted with the flags defined by `analyzer.Analyzer`. | |||
2023-05-18 | Rename package to "capturedrefrace" | Teddy Wing | |
I decided I don't like the "go" prefix for a Go package name. It doesn't make sense. Rename the module and package accordingly. I do like the "go" prefix in the command line program, so leave it there. | |||
2023-05-18 | Remove version flag TODO | Teddy Wing | |
Can't figure out a way to do this while preserving the default flags of the analyser. | |||
2023-05-18 | Use `passes/inspect` to find `go` statements | Teddy Wing | |
I originally thought that I could save on the two additional `ast.Inspect` calls in this file by using the `passes/inspect` library, but it doesn't replace those calls. It seems to help more when you have multiple analysers to run at once. Not sure how much it helps us here. | |||
2023-05-18 | findLocalVarDeclarations: Remove unused `pass` argument | Teddy Wing | |
I though I might need it when I first wrote the function. | |||
2023-05-18 | Remove shadowing variable TODO | Teddy Wing | |
This is now handled. | |||
2023-05-18 | checkClosure: Update `localAssignments` variable name | Teddy Wing | |
Now that the slice contains both assignment and declaration identifiers, update the variable names to be more representative. | |||
2023-05-18 | findLocalVarDeclarations: Move AssignStmt handling to function | Teddy Wing | |
Match the `varDeclarations` function splitting this into a more self-contained block. Also don't return in the loop to ensure we look at all assignments in `assignStmt`. | |||
2023-05-18 | varDeclaration: Return all identifiers in declaration | Teddy Wing | |
Declarations can include multiple identifiers. Return all of these from the function and rename it accordingly. | |||
2023-05-18 | Find variable declarations in function closure | Teddy Wing | |
Treat these as shadowed variables and ignore them. | |||
2023-05-18 | Add test for shadowing declaration | Teddy Wing | |
This doesn't pass yet. | |||
2023-05-18 | Clean up checkShadowing | Teddy Wing | |
* Add descriptive comments. * Remove old in-progress code. * Change the function name to `findLocalAssignments` which made more sense given what the function now does. | |||
2023-05-18 | Ignore shadowed variables | Teddy Wing | |
In order to ignore shadowed variables, we first build a list of all local assignments in the closure, and ignore any ident in that list. | |||
2023-05-18 | Create a new plan for checking shadowing | Teddy Wing | |
2023-05-18 | Try to ignore shadowed assignments | Teddy Wing | |
Not working yet. Does print the right thing, but since we're also matching `*ast.Ident`s, we must be getting the shadowed declarations as Idents and including them in the reported diagnostics. | |||
2023-05-18 | Find shadowed variable assignments | Teddy Wing | |
We don't want to report shadowed variables. | |||
2023-05-17 | Separate `isVariableTypeSignature` condition | Teddy Wing | |
It doesn't need to be attached to the `funcScope` condition as it's a separate check. Wasn't thinking carefully when I added the check. | |||
2023-05-17 | Add test for shadowing | Teddy Wing | |
2023-05-17 | Ignore captured variables containing functions | Teddy Wing | |
2023-05-17 | function_argument: Add a test for local function variables | Teddy Wing | |
2023-05-17 | Add test for function arguments | Teddy Wing | |
Don't report captured function values: $ go test --- FAIL: Test (1.26s) analysistest.go:459: ./testdata/function_argument.go:5:3: unexpected diagnostic: captured reference callback in goroutine closure | |||
2023-05-17 | Add note for package documentation | Teddy Wing | |
2023-05-17 | Add note for version flag | Teddy Wing | |
2023-05-17 | struct_reference.go: Test multiple diagnostics on one line | Teddy Wing | |
2023-05-17 | Add notes about false positives that should be corrected | Teddy Wing | |
2023-05-16 | Add license (GNU GPLv3+) | Teddy Wing | |
2023-05-16 | checkClosure: Move `funcScope` inside this function | Teddy Wing | |
It's not used in `run()`, so we can move it here. | |||
2023-05-16 | checkClosure: Add function doc comment | Teddy Wing | |
2023-05-16 | checkClosure: Clean up old code | Teddy Wing | |
* Remove old in-progress code now that we have a working implementation. * Add explanatory comments. * Remove `assignmentsInFunc()` which is unused. | |||
2023-05-16 | run: Add a few explanatory comments | Teddy Wing | |
2023-05-16 | run: Clean up old code | Teddy Wing | |
Remove old unused in-progress code. | |||
2023-05-16 | Report reference-type closure arguments | Teddy Wing | |
2023-05-16 | Get arguments of closure with `funcLit.Type.Params.List` | Teddy Wing | |
Easier to use than `goStmt.Call.Args` because we don't have to handle both `*ast.Expr` and `*ast.UnaryExpr`. | |||
2023-05-16 | Try to get the arguments of the closure from `goStmt.Call.Args` | Teddy Wing | |
2023-05-16 | Ignore any identifier that isn't a *types.Var | Teddy Wing | |
Otherwise we can get `*types.TypeName` identifiers, like the variable types in the closure's argument list. We only want to inspect variables. | |||
2023-05-16 | Add notes for next things to add and fix | Teddy Wing | |
These items don't pass our tests. | |||
2023-05-16 | Ignore variables defined in the function closure | Teddy Wing | |
This correctly ignores local variables. |