preprocessor

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Preprocess

func Preprocess(fset *token.FileSet, f *ast.File, getDefaultPackageName func(path string) (string, error)) error

Preprocess reduces the AST in ways, which remove information not necessary for binding generation. It does the following:

  • Remove function parameter names.
  • Remove all unneeded function bodies.
  • Remove all unneeded variable declarations.
  • Remove most unneeded imports, including those no longer needed due to previous AST reduction (imports as "." cannot be removed, as there isn't enough semantic context in the package AST).

Passing an unpopulated fset may lead to a nil pointer dereference! getDefaultPackageName should return the default import name of the given package.

Types

This section is empty.

Jump to

Keyboard shortcuts

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