rewriter

package
v0.0.0-...-f660648 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RewriteStructArguments

func RewriteStructArguments(n ast.Node) (ast.Node, bool)

RewriteStructArguments handles a case like this

```go func before(a struct { b, c, d int })

func after(a *struct { b, c, d int }) ```

Types

type FileRewriter

type FileRewriter struct {
	Original *ast.File

	Wrapper *ast.File
	// contains filtered or unexported fields
}

FileRewriter is the context of rewriting process

func (*FileRewriter) RewriteReturnVars

func (config *FileRewriter) RewriteReturnVars() func(n ast.Node) (ast.Node, bool)

RewriteReturnVars handles a case like this

```go func before(a struct { b, c, d int }) (r int)

func after(a struct { b, c, d int }, r *int) ```

func (*FileRewriter) RewriteforTranspiler

func (fr *FileRewriter) RewriteforTranspiler() ast.Node

RewriteforTranspiler outputs an ast.File that fits into transpiler

type Rewriter

type Rewriter struct {
	Fset  *token.FileSet
	Files map[string]*FileRewriter
}

Rewriter provides a shared context for all rewriting

func NewRewritter

func NewRewritter(fset *token.FileSet) *Rewriter

NewRewritter creates a new Rewriter object if `fset` is `nil`, then create a new one

func (*Rewriter) NewFileRewritter

func (r *Rewriter) NewFileRewritter(inputfile string) *FileRewriter

NewFileRewritter creates a FileRewriter for specific file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL