MCPcopy
hub / github.com/gopherjs/gopherjs / Decl

Struct Decl

compiler/decls.go:30–82  ·  view source on GitHub ↗

Decl represents a package-level symbol (e.g. a function, variable or type). It contains code generated by the compiler for this specific symbol, which is grouped by the execution stage it belongs to in the JavaScript runtime. When adding new fields to this struct, make sure the field is exported s

Source from the content-addressed store, hash-verified

28// When adding new fields to this struct, make sure the field is exported
29// so that it Gob serializes correctly for the archive cache.
30type Decl struct {
31 // The package- or receiver-type-qualified name of function or method obj.
32 // See go/types.Func.FullName().
33 FullName string
34 // A logical equivalent of a symbol name in an object file in the traditional
35 // Go compiler/linker toolchain. Used by GopherJS to support go:linkname
36 // directives. Must be set for decls that are supported by go:linkname
37 // implementation.
38 LinkingName symbol.Name
39 // A list of package-level JavaScript variable names this symbol needs to declare.
40 Vars []string
41 // A JS expression by which the object represented by this decl may be
42 // referenced within the package context. Empty if the decl represents no such
43 // object.
44 RefExpr string
45 // NamedRecvType is method named recv declare.
46 NamedRecvType string
47 // JavaScript code that declares a local variable for an imported package.
48 ImportCode []byte
49 // JavaScript code that declares basic information about a named type symbol.
50 // It configures basic information about the type and its identity.
51 TypeDeclCode []byte
52 // JavaScript code that assigns exposed named types to the package.
53 ExportTypeCode []byte
54 // JavaScript code that declares basic information about an anonymous type.
55 // It configures basic information about the type.
56 // This is added to the finish setup phase to have access to all packages.
57 AnonTypeDeclCode []byte
58 // JavaScript code that declares basic information about a function or
59 // method symbol. This contains the function's or method's compiled body.
60 // This is added to the finish setup phase to have access to all packages.
61 FuncDeclCode []byte
62 // JavaScript code that assigns exposed functions to the package.
63 // This is added to the finish setup phase to have access to all packages.
64 ExportFuncCode []byte
65 // JavaScript code that initializes reflection metadata about a type's method list.
66 // This is added to the finish setup phase to have access to all packages.
67 MethodListCode []byte
68 // JavaScript code that initializes the rest of reflection metadata about a type
69 // (e.g. struct fields, array type sizes, element types, etc.).
70 // This is added to the finish setup phase to have access to all packages.
71 TypeInitCode []byte
72 // JavaScript code that needs to be executed during the package init phase to
73 // set the symbol up (e.g. initialize package-level variable value).
74 InitCode []byte
75 // DCEInfo stores the information for dead-code elimination.
76 DCEInfo dce.Info
77 // Set to true if a function performs a blocking operation (I/O or
78 // synchronization). The compiler will have to generate function code such
79 // that it can be resumed after a blocking operation completes without
80 // blocking the main thread in the meantime.
81 Blocking bool
82}
83
84// minify returns a copy of Decl with unnecessary whitespace removed from the
85// JS code.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected