1
0
mirror of https://github.com/golang/go synced 2024-10-01 12:28:37 -06:00
go/oracle/TODO

84 lines
2.1 KiB
Plaintext
Raw Normal View History

go.tools/oracle: improvements to command set and performance. Command set: - what: an extremely fast query that parses a single file and returns the AST stack, package name and the set of query modes that apply to the current selection. Intended for GUI tools that need to grey out UI elements. - definition: shows the definition of an identifier. - pointsto: the PTA features of 'describe' have been split out into their own command. - describe: with PTA stripped out, the cost is now bounded by type checking. Performance: - The importer.Config.TypeCheckFuncBodies predicate supports setting the 'IgnoreFuncBodies' typechecker flag on a per-package basis. This means we can load dependencies from source more quickly if we only need exported types. (We avoid gcimport data because it may be absent or stale.) This also means we can run type-based queries on packages that aren't part of the pointer analysis scope. (Yay.) - Modes that require only type analysis of the query package run a "what" query first, and restrict their analysis scope to just that package and its dependencies (sans func bodies), making them much faster. - We call newOracle not oracle.New in Query, so that the 'needs' bitset isn't ignored (oops!). This makes the non-PTA queries faster. Also: - removed vestigial timers junk. - pos.go: existing position utilties split out into own file. Added parsePosFlag utility. - numerous cosmetic tweaks. + very basic tests. To do in follow-ups: - sophisticated editor integration of "what". - better tests. - refactoring of control flow as described in comment. - changes to "implements", "describe" commands. - update design doc + user manual. R=crawshaw, dominik.honnef CC=golang-dev, gri https://golang.org/cl/40630043
2013-12-13 08:04:55 -07:00
ORACLE TODO
===========
General
=======
Save unsaved editor buffers into an archive and provide that to the
tools, which should act as if they were saved.
Include complete pos/end information Serial output.
But beware that sometimes a single token (e.g. +) is more helpful
than the pos/end of the containing expression (e.g. x \n + \n y).
Specific queries
================
callers, callees
Use a type-based (e.g. RTA) callgraph when a callers/callees query is
outside the analysis scope.
implements
Make it require that the selection is a type, and show only the
implements relation as it applies to that type.
definition, referrers
definition: Make it work with qualified identifiers (SelectorExpr) too.
references: Make it work on things that are implicit idents, like
import specs, perhaps?
what
Report def/ref info if available.
Editors could use it to highlight all idents of the same local var.
More tests.
pointsto
When invoked on a function Ident, we get an error.
When invoked on a named return parameter, we get an error.
describe
When invoked on a var, we want to see the type and its methods.
Split "show type" and "describe syntax" into separate commands?
peers
Permit querying from a makechan, for...range, or reflective op.
go.tools/oracle: improvements to command set and performance. Command set: - what: an extremely fast query that parses a single file and returns the AST stack, package name and the set of query modes that apply to the current selection. Intended for GUI tools that need to grey out UI elements. - definition: shows the definition of an identifier. - pointsto: the PTA features of 'describe' have been split out into their own command. - describe: with PTA stripped out, the cost is now bounded by type checking. Performance: - The importer.Config.TypeCheckFuncBodies predicate supports setting the 'IgnoreFuncBodies' typechecker flag on a per-package basis. This means we can load dependencies from source more quickly if we only need exported types. (We avoid gcimport data because it may be absent or stale.) This also means we can run type-based queries on packages that aren't part of the pointer analysis scope. (Yay.) - Modes that require only type analysis of the query package run a "what" query first, and restrict their analysis scope to just that package and its dependencies (sans func bodies), making them much faster. - We call newOracle not oracle.New in Query, so that the 'needs' bitset isn't ignored (oops!). This makes the non-PTA queries faster. Also: - removed vestigial timers junk. - pos.go: existing position utilties split out into own file. Added parsePosFlag utility. - numerous cosmetic tweaks. + very basic tests. To do in follow-ups: - sophisticated editor integration of "what". - better tests. - refactoring of control flow as described in comment. - changes to "implements", "describe" commands. - update design doc + user manual. R=crawshaw, dominik.honnef CC=golang-dev, gri https://golang.org/cl/40630043
2013-12-13 08:04:55 -07:00
Report aliasing reflect.{Send,Recv,Close} and close() operations.
New queries
"updaters": show all statements that may update the selected lvalue
(local, global, field, etc).
"creators": show all places where an object of type T is created
(&T{}, var t T, new(T), new(struct{array [3]T}), etc.
(Useful for datatypes whose zero value is not safe)
Editor-specific
===============
Add support for "what" to .el; clean up.
Emacs: use JSON to get the raw information from the oracle. Don't
open an editor buffer for simpler queries, just jump to the result
and/or display it in the modeline.
Emacs: go-root-and-paths depends on the current buffer, so be sure to
call it from within the source file, not the *go-oracle* buffer:
the user may have switched workspaces and the oracle should run in
the new one.