sourceinfo

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Overview

Package sourceinfo contains the logic for computing source code info for a file descriptor.

The inputs to the computation are an AST for a file as well as the index of interpreted options for that file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSourceInfo

func GenerateSourceInfo(file *ast.FileNode, opts options.Index) *descriptorpb.SourceCodeInfo

GenerateSourceInfo generates source code info for the given AST. If the given opts is present, it can generate source code info for interpreted options. Otherwise, any options in the AST will get source code info as uninterpreted options.

This includes comments only for locations that represent complete declarations. This is the same behavior as protoc, the reference compiler for Protocol Buffers.

func GenerateSourceInfoWithExtraComments

func GenerateSourceInfoWithExtraComments(file *ast.FileNode, opts options.Index) *descriptorpb.SourceCodeInfo

GenerateSourceInfoWithExtraComments generates source code info for the given AST. If the given opts is present, it can generate source code info for interpreted options. Otherwise, any options in the AST will get source code info as uninterpreted options.

This includes comments for all locations. This is still lossy, but less so as it preserves far more comments from the source file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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