dts

package
v0.0.0-...-f04d09c Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TopLevel  Kind = "TopLevel"
	Module         = "Module"
	Class          = "Class"
	Interface      = "Interface"
	Enum           = "Enum"
	Obj            = "Object"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Assignment

type Assignment struct {
	Identifier
	Value string // just a string
}

is this usefull?

type DTS

type DTS struct {
	// TopLevel object
	Object
	// contains filtered or unexported fields
}

func (*DTS) EndArg

func (d *DTS) EndArg(text string)

func (*DTS) EndBlock

func (d *DTS) EndBlock(msg string)

func (*DTS) EndFunction

func (d *DTS) EndFunction(text string)

func (*DTS) EndVariable

func (d *DTS) EndVariable(text string)

func (*DTS) Extends

func (d *DTS) Extends(text string)

func (*DTS) FSetIdentifier

func (d *DTS) FSetIdentifier(text string)

func (*DTS) FSetType

func (d *DTS) FSetType(text string)

func (*DTS) Implements

func (d *DTS) Implements(text string)

func (*DTS) Init

func (d *DTS) Init(fpath string)

fpath, the file path of the .d.ts file

func (*DTS) Json

func (d *DTS) Json() (string, error)

func (*DTS) NewArg

func (d *DTS) NewArg(text string)

func (*DTS) NewBlock

func (d *DTS) NewBlock(modifiers string, kind Kind)

func (*DTS) NewFunction

func (d *DTS) NewFunction(text string)

func (*DTS) NewVariable

func (d *DTS) NewVariable(text string)

func (*DTS) SetBlockID

func (d *DTS) SetBlockID(name string)

func (*DTS) Show

func (d *DTS) Show(text string)

func (*DTS) VSetIdentifier

func (d *DTS) VSetIdentifier(text string)

func (*DTS) VSetType

func (d *DTS) VSetType(text string)

type Function

type Function struct {
	Identifier
	Args       []*Variable
	ReturnType []string
}

type Identifier

type Identifier struct {
	Name     string
	Modifier []string `json:",omitempty"`
	// text holding the ide
	Text string `json:"-"`
}

type Kind

type Kind string

type Object

type Object struct {
	Identifier
	// module/class/interface/enum/js object/ or top level
	Kind Kind

	// for class/interface/object
	Extents    []string `json:",omitempty"` // ids
	Implements []string `json:",omitempty"` // ids
	// var difinitions
	Vars        map[string]*Variable   `json:",omitempty"`
	Assignments map[string]*Assignment `json:",omitempty"`
	// using slice here, incase of function override
	Funcs []*Function `json:",omitempty"`
	// helpers
	// constructor for class
	Constructor *Function `json:",omitempty"`

	Classes    map[string]*Object `json:",omitempty"`
	Interfaces map[string]*Object `json:",omitempty"`
	Modules    map[string]*Object `json:",omitempty"`
	Enums      map[string]*Object `json:",omitempty"`
	Objects    map[string]*Object `json:",omitempty"`
	// contains filtered or unexported fields
}

type Variable

type Variable struct {
	Identifier
	// use for func type
	IsOptional bool
	// only convert the KNOWN type to go
	Type []string // multipy types, return type
}

KNOWN type: string -> string

number -> float64
object -> js.M
funcion   -> func

class  -> struct
module -> struct
interface -> struct
toplevel  -> convert the same name package
             toplevel object has the base name of the .d.ts file

// var/func overrides -> comment // other types just output as comment

Jump to

Keyboard shortcuts

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