Documentation ¶
Overview ¶
contains types converted from AST
Index ¶
- Constants
- Variables
- func IsString(t TypeRef) bool
- func IsVoid(t TypeRef) bool
- type AnyType
- type BasicInfo
- type Callback
- func (t *Callback) AllSourceReferences() []*Ref
- func (t *Callback) Basic() BasicInfo
- func (t *Callback) ChangeType(typeConv TypeConvert)
- func (t *Callback) DefaultParam() (info *TypeInfo, inner TypeRef)
- func (t *Callback) InUse() bool
- func (t *Callback) NeedRelease() bool
- func (t *Callback) Param(nullable, option, variadic bool) (info *TypeInfo, inner TypeRef)
- func (t *Callback) SetBasic(basic BasicInfo)
- func (t *Callback) SetInUse(value bool)
- func (t *Callback) SourceReference() *Ref
- func (t *Callback) TemplateCopy(targetInfo BasicInfo) *Callback
- func (t *Callback) TypeID() TypeID
- type Convert
- type DictMember
- type Dictionary
- func (t *Dictionary) AllSourceReferences() []*Ref
- func (t *Dictionary) Basic() BasicInfo
- func (t *Dictionary) DefaultParam() (info *TypeInfo, inner TypeRef)
- func (t *Dictionary) InUse() bool
- func (t *Dictionary) NeedRelease() bool
- func (t *Dictionary) Param(nullable, option, variadic bool) (info *TypeInfo, inner TypeRef)
- func (t *Dictionary) SetBasic(basic BasicInfo)
- func (t *Dictionary) SetInUse(value bool)
- func (t *Dictionary) SourceReference() *Ref
- func (t *Dictionary) TypeID() TypeID
- type Enum
- func (t *Enum) AllSourceReferences() []*Ref
- func (t *Enum) Basic() BasicInfo
- func (t *Enum) DefaultParam() (info *TypeInfo, inner TypeRef)
- func (t *Enum) InUse() bool
- func (t *Enum) NeedRelease() bool
- func (t *Enum) Param(nullable, option, variadic bool) (info *TypeInfo, inner TypeRef)
- func (t *Enum) SetBasic(basic BasicInfo)
- func (t *Enum) SetInUse(value bool)
- func (t *Enum) SourceReference() *Ref
- func (t *Enum) TypeID() TypeID
- type EnumValue
- type GetRef
- type IfConst
- type IfMethod
- type IfVar
- type Interface
- func (t *Interface) AllSourceReferences() []*Ref
- func (t *Interface) Basic() BasicInfo
- func (t *Interface) ChangeType(typeConv TypeConvert)
- func (t *Interface) DefaultParam() (info *TypeInfo, inner TypeRef)
- func (t *Interface) InUse() bool
- func (t *Interface) MergeList() []MergeLink
- func (t *Interface) NeedRelease() bool
- func (t *Interface) Param(nullable, option, variadic bool) (info *TypeInfo, inner TypeRef)
- func (t *Interface) SetBasic(value BasicInfo)
- func (t *Interface) SetInUse(value bool)
- func (t *Interface) SourceReference() *Ref
- func (t *Interface) TemplateCopy(targetInfo BasicInfo) *Interface
- func (t *Interface) TypeID() TypeID
- type MergeLink
- type MethodName
- type Parameter
- type ParametrizedType
- type PrimitiveType
- type RawJSType
- type Ref
- type SequenceType
- type Setup
- type SpecializationType
- type Type
- type TypeConvert
- type TypeID
- type TypeInfo
- type TypeRef
- type TypedArrayType
- type UnionType
- type UserMsgFn
Constants ¶
View Source
const BuiltInPackage = "<built-in>"
Variables ¶
View Source
var (
ErrStop = errors.New("too many errors")
)
View Source
var TransformBasic = func(t TypeRef, basic BasicInfo) BasicInfo {
return basic
}
TransformBasic is used to make modification to BasicInfo structure when it's returned from all types. Main usage is to change package name references when query for a type.
Functions ¶
Types ¶
type AnyType ¶
type AnyType struct {
// contains filtered or unexported fields
}
func (*AnyType) DefaultParam ¶
func (*AnyType) NeedRelease ¶
func (t *AnyType) NeedRelease() bool
type BasicInfo ¶
type BasicInfo struct { // Idl name Idl string // Package name Package string // Def is short for definition of a type, e.g. Foo Def string // Internal name for used with methods and need to write some code Internal string // Template define a template name prefix/suffix Template string }
TypeName contains usage information about a type
type Callback ¶
type Callback struct { Return TypeRef Parameters []*Parameter // contains filtered or unexported fields }
func (*Callback) AllSourceReferences ¶
func (t *Callback) AllSourceReferences() []*Ref
func (*Callback) ChangeType ¶
func (t *Callback) ChangeType(typeConv TypeConvert)
func (*Callback) DefaultParam ¶
func (*Callback) NeedRelease ¶
func (t *Callback) NeedRelease() bool
func (*Callback) SourceReference ¶
func (t *Callback) SourceReference() *Ref
func (*Callback) TemplateCopy ¶
type Convert ¶
type Convert struct { Types map[string]Type All []Type Enums []*Enum Callbacks []*Callback Dictionary []*Dictionary Interface []*Interface Merge map[string]MergeLink Unions []*UnionType HaveError bool // contains filtered or unexported fields }
func NewConvert ¶
func NewConvert() *Convert
func (*Convert) Evaluate ¶
Evaluate is doing verification on input IDL according to WebIDL specification. It also expand types, like removing typedef etc.
type DictMember ¶
func (*DictMember) GetType ¶
func (t *DictMember) GetType() TypeRef
func (*DictMember) Name ¶
func (t *DictMember) Name() *MethodName
func (*DictMember) SetName ¶
func (t *DictMember) SetName(value *MethodName)
func (*DictMember) SetType ¶
func (t *DictMember) SetType(value TypeRef) string
func (*DictMember) SourceReference ¶
func (t *DictMember) SourceReference() *Ref
type Dictionary ¶
type Dictionary struct { Inherits *Dictionary Members []*DictMember // contains filtered or unexported fields }
func (*Dictionary) AllSourceReferences ¶
func (t *Dictionary) AllSourceReferences() []*Ref
func (*Dictionary) Basic ¶
func (t *Dictionary) Basic() BasicInfo
func (*Dictionary) DefaultParam ¶
func (t *Dictionary) DefaultParam() (info *TypeInfo, inner TypeRef)
func (*Dictionary) NeedRelease ¶
func (t *Dictionary) NeedRelease() bool
func (*Dictionary) Param ¶
func (t *Dictionary) Param(nullable, option, variadic bool) (info *TypeInfo, inner TypeRef)
func (*Dictionary) SetBasic ¶
func (t *Dictionary) SetBasic(basic BasicInfo)
func (*Dictionary) SourceReference ¶
func (t *Dictionary) SourceReference() *Ref
func (*Dictionary) TypeID ¶
func (t *Dictionary) TypeID() TypeID
type Enum ¶
type Enum struct { Values []EnumValue // target language prefix and suffix for enum values Prefix, Suffix string // contains filtered or unexported fields }
Enum type
func (*Enum) AllSourceReferences ¶
func (t *Enum) AllSourceReferences() []*Ref
func (*Enum) DefaultParam ¶
func (*Enum) NeedRelease ¶
func (t *Enum) NeedRelease() bool
func (*Enum) SourceReference ¶
func (t *Enum) SourceReference() *Ref
type EnumValue ¶
type EnumValue struct {
MethodName
}
EnumValue is a single enum value
func (*EnumValue) Name ¶
func (t *EnumValue) Name() *MethodName
type IfConst ¶
func (*IfConst) Name ¶
func (t *IfConst) Name() *MethodName
func (*IfConst) SetName ¶
func (t *IfConst) SetName(value *MethodName)
func (*IfConst) SourceReference ¶
func (t *IfConst) SourceReference() *Ref
type IfMethod ¶
type IfMethod struct { Return TypeRef Static bool Params []*Parameter // Specialization indicate if this is a getter, setter or deleter Specialization SpecializationType // contains filtered or unexported fields }
func (*IfMethod) Name ¶
func (t *IfMethod) Name() *MethodName
func (*IfMethod) SetName ¶
func (t *IfMethod) SetName(value *MethodName)
func (*IfMethod) SourceReference ¶
func (t *IfMethod) SourceReference() *Ref
type IfVar ¶
type IfVar struct { Type TypeRef Static bool Readonly bool Stringifier bool Source string // part of event handling ShortName string EventName string PrimaryEv bool // contains filtered or unexported fields }
func (*IfVar) Name ¶
func (t *IfVar) Name() *MethodName
func (*IfVar) SetName ¶
func (t *IfVar) SetName(value *MethodName)
func (*IfVar) SourceReference ¶
func (t *IfVar) SourceReference() *Ref
type Interface ¶
type Interface struct { Inherits *Interface // Global indicate that this "interface" is actually the // global scope of javascript Global bool // Callback specify that this is an interface that the // developer should implement. Callback bool // FunctionCB indicate that an extra function implementation // shall be added in final output FunctionCB bool // variable naming prefix and suffix for const variables ConstPrefix, ConstSuffix string Constructor *IfMethod Consts []*IfConst Vars []*IfVar StaticVars []*IfVar Method []*IfMethod StaticMethod []*IfMethod Specialization []*IfMethod Events []*IfVar // SpecProperty is used by transform step to assign names // for getters, setters and deleters SpecProperty map[SpecializationType]string // contains filtered or unexported fields }
func (*Interface) AllSourceReferences ¶
func (t *Interface) AllSourceReferences() []*Ref
func (*Interface) ChangeType ¶
func (t *Interface) ChangeType(typeConv TypeConvert)
func (*Interface) DefaultParam ¶
func (*Interface) NeedRelease ¶
func (t *Interface) NeedRelease() bool
func (*Interface) SourceReference ¶
func (t *Interface) SourceReference() *Ref
func (*Interface) TemplateCopy ¶
type MethodName ¶
type ParametrizedType ¶
type ParametrizedType struct { *Ref ParamName string Elems []TypeRef Type TypeRef // contains filtered or unexported fields }
ParametrizedType is e.g. "Promise<any>"
func (*ParametrizedType) Basic ¶
func (t *ParametrizedType) Basic() BasicInfo
func (*ParametrizedType) DefaultParam ¶
func (t *ParametrizedType) DefaultParam() (info *TypeInfo, inner TypeRef)
func (*ParametrizedType) NeedRelease ¶
func (t *ParametrizedType) NeedRelease() bool
type PrimitiveType ¶
type PrimitiveType struct { Idl string Lang string JsMethod string Cast bool // contains filtered or unexported fields }
func (*PrimitiveType) Basic ¶
func (t *PrimitiveType) Basic() BasicInfo
func (*PrimitiveType) DefaultParam ¶
func (t *PrimitiveType) DefaultParam() (info *TypeInfo, inner TypeRef)
func (*PrimitiveType) NeedRelease ¶
func (t *PrimitiveType) NeedRelease() bool
type RawJSType ¶
type RawJSType struct {
IdlType string
}
RawJSType used when no conversion should take place and the raw underlying js.Value should be returned or inserted instead
func NewRawJSType ¶
func (*RawJSType) DefaultParam ¶
func (*RawJSType) NeedRelease ¶
type SequenceType ¶
type SequenceType struct { Elem TypeRef // contains filtered or unexported fields }
func (*SequenceType) Basic ¶
func (t *SequenceType) Basic() BasicInfo
func (*SequenceType) DefaultParam ¶
func (t *SequenceType) DefaultParam() (info *TypeInfo, inner TypeRef)
func (*SequenceType) NeedRelease ¶
func (t *SequenceType) NeedRelease() bool
type SpecializationType ¶
type SpecializationType int
const ( // Nothing assigned SpecNone SpecializationType = iota // getter with integer index SpecIndexGetter SpecIndexSetter SpecKeyGetter SpecKeySetter SpecKeyDeleter )
func (SpecializationType) String ¶
func (i SpecializationType) String() string
type TypeConvert ¶
type TypeInfo ¶
type TypeInfo struct { BasicInfo // GoTagText is a name syntax correct version of BasicInfo.Def GoTagText string // Input is method parameter type Input string // VarIn used in variable definition in Input cases VarIn string // VarInInner is the inner type of a variadic/sequence in Input cases VarInInner string // Output define type out from a method Output string // VarOut used in variable definition in Output cases VarOut string // VarOut is the intter type of variadic/sequence in Output cases VarOutInner string // Pointer is true if InOut is a pointer type Pointer bool // NeedRelease define if the type need a release handle NeedRelease bool // Nullable indicate that a null/nil value is a possibility Nullable bool // Optional input value Option bool // Variadic is variable number of input values Variadic bool }
TypeName contains usage information about a type
type TypeRef ¶
type TypeRef interface { // Basic type infomation Basic() BasicInfo // Param type information Param(nullable, option, vardic bool) (info *TypeInfo, inner TypeRef) // DefaultParam return how this parameter should be processed by default DefaultParam() (info *TypeInfo, inner TypeRef) // the type is doing some allocation that needs manual release. NeedRelease() bool // contains filtered or unexported methods }
func ChangeTemplateName ¶
type TypedArrayType ¶
type TypedArrayType struct { Elem *PrimitiveType // contains filtered or unexported fields }
func (*TypedArrayType) Basic ¶
func (t *TypedArrayType) Basic() BasicInfo
func (*TypedArrayType) DefaultParam ¶
func (t *TypedArrayType) DefaultParam() (info *TypeInfo, inner TypeRef)
func (*TypedArrayType) NeedRelease ¶
func (t *TypedArrayType) NeedRelease() bool
type UnionType ¶
type UnionType struct { Types []TypeRef // contains filtered or unexported fields }
func (*UnionType) DefaultParam ¶
func (*UnionType) NeedRelease ¶
Click to show internal directories.
Click to hide internal directories.