object

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

type Call struct {
	Src       string    `json:"src"`
	Caller    string    `json:"caller"`
	Arguments []string  `json:"arguments"`
	Span      core.Span `json:"span"`
}

Call NON-PRECISE

func aFunc() {
	a.b(c, d)
}

aFunc  == Src
a.b    == caller
[c, d] == arguments

func (*Call) GetDesc

func (c *Call) GetDesc() string

func (*Call) GetIndexName

func (c *Call) GetIndexName() string

func (*Call) GetSpan

func (c *Call) GetSpan() *core.Span

type Clazz

type Clazz struct {
	Name   string `json:"name"`
	Module string `json:"module"`
	// this span will include header and content
	Span core.Span `json:"span"`

	// which contains language-specific contents
	Extras interface{} `json:"extras"`

	// ptr to origin Unit
	Unit *core.Unit `json:"-"`

	// language
	Lang core.LangType `json:"lang"`
}

func NewClazz

func NewClazz() *Clazz

func (*Clazz) GetDesc

func (c *Clazz) GetDesc() string

func (*Clazz) GetIndexName

func (c *Clazz) GetIndexName() string

func (*Clazz) GetSignature

func (c *Clazz) GetSignature() ClazzSignature

func (*Clazz) GetSpan

func (c *Clazz) GetSpan() *core.Span

func (*Clazz) ToJson

func (c *Clazz) ToJson() ([]byte, error)

type ClazzSignature

type ClazzSignature = string

type FuncSignature

type FuncSignature = string

type Function

type Function struct {
	Name       string       `json:"name"`
	Receiver   string       `json:"receiver"`
	Parameters []*ValueUnit `json:"parameters"`
	Returns    []*ValueUnit `json:"returns"`
	// this span will include header and content
	Span core.Span `json:"span"`
	// which includes only body
	BodySpan core.Span `json:"bodySpan"`

	// which contains language-specific contents
	Extras interface{} `json:"extras"`

	// ptr to origin Unit
	Unit *core.Unit `json:"-"`

	// language
	Lang core.LangType `json:"lang"`
}

func Map2Func

func Map2Func(exported map[string]any) (*Function, error)

Map2Func reverse ToMap

func NewFunction

func NewFunction() *Function

func (*Function) GetDesc

func (f *Function) GetDesc() string

func (*Function) GetIndexName

func (f *Function) GetIndexName() string

func (*Function) GetSignature

func (f *Function) GetSignature() FuncSignature

func (*Function) GetSpan

func (f *Function) GetSpan() *core.Span

func (*Function) GetUnit

func (f *Function) GetUnit() *core.Unit

type Symbol

type Symbol struct {
	Symbol    string    `json:"symbol"`
	Kind      string    `json:"kind"`
	Span      core.Span `json:"span"`
	FieldName string    `json:"fieldName"`

	// ptr to origin Unit
	Unit *core.Unit `json:"-"`
}

Symbol Units are named identifiers driven by the ASTs

https://github.com/github/semantic/blob/main/docs/examples.md#symbols https://github.com/github/semantic/blob/main/proto/semantic.proto

message Unit {
  string symbol = 1;
  string kind = 2;
  Span span = 4;
  NodeType node_type = 6;
  SyntaxType syntax_type = 7;
}

enum NodeType {
  ROOT_SCOPE = 0;
  JUMP_TO_SCOPE = 1;
  EXPORTED_SCOPE = 2;
  DEFINITION = 3;
  REFERENCE = 4;
}

enum SyntaxType {
  FUNCTION = 0;
  METHOD = 1;
  CLASS = 2;
  MODULE = 3;
  CALL = 4;
  TYPE = 5;
  INTERFACE = 6;
  IMPLEMENTATION = 7;
}

func (*Symbol) GetDesc

func (s *Symbol) GetDesc() string

func (*Symbol) GetIndexName

func (s *Symbol) GetIndexName() string

func (*Symbol) GetSpan

func (s *Symbol) GetSpan() *core.Span

func (*Symbol) GetUnit

func (s *Symbol) GetUnit() *core.Unit

type ValueUnit

type ValueUnit struct {
	Type string `json:"type"`
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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