Reviewers: gri,

Hello gri@golang.org (cc: golang-dev@googlegroups.com),

I'd like you to review this change to

exp/ssa: various features to facilitate source analysis tools.

NewBuilder now accepts a new extensible Client struct
specifying Builder options. (Naming suggestions?)

Client embeds a types.Context, permitting Builder clients to
control type-checking options such as word width.

Builder.{idents,constants.types} fields extracted into (new
type) TypeInfo. TypeInfo is embedded by Package. The smaller
per-package maps can be retained/discarded with finer
granularity (see below).

The builder options now include RetainAST, a predicate for
whether to retain or discard the type-checked ASTs
(Package.Files, now exposed) and type info (Package.TypeInfo)
for each package after it is built.

The results of type checking are now available to tools atop
exp/ssa via these exposed functions:
Builder.isType -> TypeInfo.IsType(Expr)
Builder.obj -> TypeInfo.ObjectOf(Ident)
Builder.exprType -> TypeInfo.TypeOf(Expr)
Builder.constants[x] -> TypeInfo.ValueOf(Expr)
Builder.isPackageRef -> TypeInfo.isPackageRef(Expr)
(Those methods never really belonged happily on Builder.)

- Added StaticCallee method
- Added Description method
- Embedding in Call/Go/Defer is no longer anonymous, to avoid
promotion of inappropriate methods such as Description.
- Added explicit Operands methods to Call/Go/Defer.

ssa.Member now has a Posn() method. We use (new type)
Constant, not Literal, for package-level constants with a name
and position.

Added source position info to Make{Slice,Map,Chan}, Alloc, Global.

Add missing noparens() when handling calls to built-ins.

Refactor to avoid "// Subtle" code in compLit(Struct).

Added CreatePackageFromArgs utility to handle command-line
processing for ssadump and forthcoming tools.

Please review this at https://codereview.appspot.com/8734045/

Affected files:
M ssa/builder.go
M ssa/emit.go
M ssa/func.go
M ssa/importer.go
M ssa/interp/interp.go
M ssa/interp/interp_test.go
M ssa/interp/ops.go
M ssa/print.go
M ssa/promote.go
M ssa/ssa.go
M ssa/ssadump.go
A ssa/typeinfo.go


You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
postedApr 23, '13 at 4:44p
activeApr 23, '13 at 4:44p

1 user in discussion

Adonovan: 1 post



site design / logo © 2022 Grokbase