entity

package
v0.0.0-...-6e409f7 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2014 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VisitEntities

func VisitEntities(v IEntityVisitor, entities []core.IEntity) interface{}

func VisitEntity

func VisitEntity(v IEntityVisitor, entity core.IEntity) interface{}

Types

type Constant

type Constant struct {
	ClassName string
	Name      string
	TypeNode  core.ITypeNode
	Value     core.IExprNode
	// contains filtered or unexported fields
}

func AsConstant

func AsConstant(x core.IEntity) *Constant

func NewConstant

func NewConstant(t core.ITypeNode, name string, value core.IExprNode) *Constant

func NewConstants

func NewConstants(xs ...*Constant) []*Constant

func (*Constant) GetAddress

func (self *Constant) GetAddress() core.IOperand

func (*Constant) GetMemref

func (self *Constant) GetMemref() core.IMemoryReference

func (*Constant) GetName

func (self *Constant) GetName() string

func (*Constant) GetNumRefered

func (self *Constant) GetNumRefered() int

func (*Constant) GetType

func (self *Constant) GetType() core.IType

func (*Constant) GetTypeNode

func (self *Constant) GetTypeNode() core.ITypeNode

func (*Constant) GetTypeRef

func (self *Constant) GetTypeRef() core.ITypeRef

func (*Constant) GetValue

func (self *Constant) GetValue() core.IExprNode

func (*Constant) IsConstant

func (self *Constant) IsConstant() bool

func (*Constant) IsDefined

func (self *Constant) IsDefined() bool

func (*Constant) IsParameter

func (self *Constant) IsParameter() bool

func (*Constant) IsPrivate

func (self *Constant) IsPrivate() bool

func (*Constant) IsRefered

func (self *Constant) IsRefered() bool

func (*Constant) IsVariable

func (self *Constant) IsVariable() bool

func (*Constant) Refered

func (self *Constant) Refered()

func (*Constant) SetAddress

func (self *Constant) SetAddress(address core.IOperand)

func (*Constant) SetMemref

func (self *Constant) SetMemref(memref core.IMemoryReference)

func (*Constant) SetValue

func (self *Constant) SetValue(val core.IExprNode)

func (*Constant) String

func (self *Constant) String() string

func (*Constant) SymbolString

func (self *Constant) SymbolString() string

type ConstantEntry

type ConstantEntry struct {
	// contains filtered or unexported fields
}

func NewConstantEntry

func NewConstantEntry(value string) *ConstantEntry

func (*ConstantEntry) GetAddress

func (self *ConstantEntry) GetAddress() core.IOperand

func (*ConstantEntry) GetMemref

func (self *ConstantEntry) GetMemref() core.IMemoryReference

func (*ConstantEntry) GetSymbol

func (self *ConstantEntry) GetSymbol() core.ISymbol

func (*ConstantEntry) GetValue

func (self *ConstantEntry) GetValue() string

func (*ConstantEntry) SetAddress

func (self *ConstantEntry) SetAddress(address core.IOperand)

func (*ConstantEntry) SetMemref

func (self *ConstantEntry) SetMemref(memref core.IMemoryReference)

func (*ConstantEntry) SetSymbol

func (self *ConstantEntry) SetSymbol(symbol core.ISymbol)

type ConstantTable

type ConstantTable struct {
	// contains filtered or unexported fields
}

func NewConstantTable

func NewConstantTable() *ConstantTable

func (*ConstantTable) GetEntries

func (self *ConstantTable) GetEntries() []*ConstantEntry

func (*ConstantTable) Intern

func (self *ConstantTable) Intern(s string) *ConstantEntry

func (*ConstantTable) IsEmpty

func (self *ConstantTable) IsEmpty() bool

type DefinedFunction

type DefinedFunction struct {
	ClassName string
	Private   bool
	TypeNode  core.ITypeNode
	Name      string
	Params    *Params
	Body      core.IStmtNode
	IR        []core.IStmt
	// contains filtered or unexported fields
}

func AsDefinedFunction

func AsDefinedFunction(x core.IEntity) *DefinedFunction

func NewDefinedFunction

func NewDefinedFunction(priv bool, t core.ITypeNode, name string, params *Params, body core.IStmtNode) *DefinedFunction

func NewDefinedFunctions

func NewDefinedFunctions(xs ...*DefinedFunction) []*DefinedFunction

func (*DefinedFunction) GetAddress

func (self *DefinedFunction) GetAddress() core.IOperand

func (*DefinedFunction) GetBody

func (self *DefinedFunction) GetBody() core.IStmtNode

func (*DefinedFunction) GetCallingSymbol

func (self *DefinedFunction) GetCallingSymbol() core.ISymbol

func (*DefinedFunction) GetIR

func (self *DefinedFunction) GetIR() []core.IStmt

func (*DefinedFunction) GetLocalVariables

func (self *DefinedFunction) GetLocalVariables() []*DefinedVariable

func (*DefinedFunction) GetMemref

func (self *DefinedFunction) GetMemref() core.IMemoryReference

func (*DefinedFunction) GetName

func (self *DefinedFunction) GetName() string

func (*DefinedFunction) GetNumRefered

func (self *DefinedFunction) GetNumRefered() int

func (*DefinedFunction) GetParameters

func (self *DefinedFunction) GetParameters() []*Parameter

func (*DefinedFunction) GetParams

func (self *DefinedFunction) GetParams() *Params

func (*DefinedFunction) GetReturnType

func (self *DefinedFunction) GetReturnType() core.IType

func (*DefinedFunction) GetScope

func (self *DefinedFunction) GetScope() *LocalScope

func (*DefinedFunction) GetType

func (self *DefinedFunction) GetType() core.IType

func (*DefinedFunction) GetTypeNode

func (self *DefinedFunction) GetTypeNode() core.ITypeNode

func (*DefinedFunction) GetTypeRef

func (self *DefinedFunction) GetTypeRef() core.ITypeRef

func (*DefinedFunction) GetValue

func (self *DefinedFunction) GetValue() core.IExprNode

func (*DefinedFunction) IsConstant

func (self *DefinedFunction) IsConstant() bool

func (*DefinedFunction) IsDefined

func (self *DefinedFunction) IsDefined() bool

func (*DefinedFunction) IsParameter

func (self *DefinedFunction) IsParameter() bool

func (*DefinedFunction) IsPrivate

func (self *DefinedFunction) IsPrivate() bool

func (*DefinedFunction) IsRefered

func (self *DefinedFunction) IsRefered() bool

func (*DefinedFunction) IsVariable

func (self *DefinedFunction) IsVariable() bool

func (*DefinedFunction) IsVoid

func (self *DefinedFunction) IsVoid() bool

func (*DefinedFunction) ListParameters

func (self *DefinedFunction) ListParameters() []*DefinedVariable

func (*DefinedFunction) LocalVariableScope

func (self *DefinedFunction) LocalVariableScope() *LocalScope

func (*DefinedFunction) Refered

func (self *DefinedFunction) Refered()

func (*DefinedFunction) SetAddress

func (self *DefinedFunction) SetAddress(address core.IOperand)

func (*DefinedFunction) SetBody

func (self *DefinedFunction) SetBody(body core.IStmtNode)

func (*DefinedFunction) SetCallingSymbol

func (self *DefinedFunction) SetCallingSymbol(sym core.ISymbol)

func (*DefinedFunction) SetIR

func (self *DefinedFunction) SetIR(stmts []core.IStmt)

func (*DefinedFunction) SetMemref

func (self *DefinedFunction) SetMemref(memref core.IMemoryReference)

func (*DefinedFunction) SetScope

func (self *DefinedFunction) SetScope(scope *LocalScope)

func (*DefinedFunction) String

func (self *DefinedFunction) String() string

func (*DefinedFunction) SymbolString

func (self *DefinedFunction) SymbolString() string

type DefinedVariable

type DefinedVariable struct {
	ClassName   string
	Private     bool
	Name        string
	TypeNode    core.ITypeNode
	Initializer core.IExprNode
	IR          core.IExpr
	// contains filtered or unexported fields
}

func AsDefinedVariable

func AsDefinedVariable(x core.IEntity) *DefinedVariable

func AsDefinedVariables

func AsDefinedVariables(xs []core.IEntity) []*DefinedVariable

func NewDefinedVariable

func NewDefinedVariable(isPrivate bool, t core.ITypeNode, name string, init core.IExprNode) *DefinedVariable

func NewDefinedVariables

func NewDefinedVariables(xs ...*DefinedVariable) []*DefinedVariable

func (*DefinedVariable) GetAddress

func (self *DefinedVariable) GetAddress() core.IOperand

func (*DefinedVariable) GetIR

func (self *DefinedVariable) GetIR() core.IExpr

func (*DefinedVariable) GetInitializer

func (self *DefinedVariable) GetInitializer() core.IExprNode

func (*DefinedVariable) GetMemref

func (self *DefinedVariable) GetMemref() core.IMemoryReference

func (*DefinedVariable) GetName

func (self *DefinedVariable) GetName() string

func (*DefinedVariable) GetNumRefered

func (self *DefinedVariable) GetNumRefered() int

func (*DefinedVariable) GetType

func (self *DefinedVariable) GetType() core.IType

func (*DefinedVariable) GetTypeNode

func (self *DefinedVariable) GetTypeNode() core.ITypeNode

func (*DefinedVariable) GetTypeRef

func (self *DefinedVariable) GetTypeRef() core.ITypeRef

func (*DefinedVariable) GetValue

func (self *DefinedVariable) GetValue() core.IExprNode

func (*DefinedVariable) HasInitializer

func (self *DefinedVariable) HasInitializer() bool

func (*DefinedVariable) IsConstant

func (self *DefinedVariable) IsConstant() bool

func (*DefinedVariable) IsDefined

func (self *DefinedVariable) IsDefined() bool

func (*DefinedVariable) IsParameter

func (self *DefinedVariable) IsParameter() bool

func (*DefinedVariable) IsPrivate

func (self *DefinedVariable) IsPrivate() bool

func (*DefinedVariable) IsRefered

func (self *DefinedVariable) IsRefered() bool

func (*DefinedVariable) IsVariable

func (self *DefinedVariable) IsVariable() bool

func (*DefinedVariable) Refered

func (self *DefinedVariable) Refered()

func (*DefinedVariable) SetAddress

func (self *DefinedVariable) SetAddress(address core.IOperand)

func (*DefinedVariable) SetIR

func (self *DefinedVariable) SetIR(expr core.IExpr)

func (*DefinedVariable) SetInitializer

func (self *DefinedVariable) SetInitializer(init core.IExprNode)

func (*DefinedVariable) SetMemref

func (self *DefinedVariable) SetMemref(memref core.IMemoryReference)

func (*DefinedVariable) SetSequence

func (self *DefinedVariable) SetSequence(seq int)

func (*DefinedVariable) String

func (self *DefinedVariable) String() string

func (*DefinedVariable) SymbolString

func (self *DefinedVariable) SymbolString() string

type IEntityVisitor

type IEntityVisitor interface {
	VisitEntity(core.IEntity) interface{}
}

type LocalScope

type LocalScope struct {
	Parent    core.IScope
	Children  []*LocalScope
	Variables map[string]*DefinedVariable
}

func NewLocalScope

func NewLocalScope(parent core.IScope) *LocalScope

func (*LocalScope) AddChild

func (self *LocalScope) AddChild(scope core.IScope)

func (*LocalScope) AllLocalVariables

func (self *LocalScope) AllLocalVariables() []*DefinedVariable

*

  • Returns all local variables in this scope.
  • The result DOES includes all nested local variables.
  • while it does NOT include static local variables.

func (*LocalScope) AllocateTmp

func (self *LocalScope) AllocateTmp(typeNode core.ITypeNode) *DefinedVariable

func (*LocalScope) CheckReferences

func (self *LocalScope) CheckReferences(errorHandler *core.ErrorHandler)

func (*LocalScope) DefineVariable

func (self *LocalScope) DefineVariable(v *DefinedVariable) error

func (*LocalScope) GetByName

func (self *LocalScope) GetByName(name string) core.IEntity

func (*LocalScope) GetChildren

func (self *LocalScope) GetChildren() []*LocalScope

func (*LocalScope) GetLocalVariables

func (self *LocalScope) GetLocalVariables() []*DefinedVariable

*

  • Returns local variables defined in this scope.
  • Does not includes children&s local variables.
  • Does NOT include static local variables.

func (*LocalScope) GetParent

func (self *LocalScope) GetParent() core.IScope

func (*LocalScope) GetStaticLocalVariables

func (self *LocalScope) GetStaticLocalVariables() []*DefinedVariable

func (*LocalScope) GetToplevel

func (self *LocalScope) GetToplevel() core.IScope

func (*LocalScope) IsDefinedLocally

func (self *LocalScope) IsDefinedLocally(name string) bool

func (*LocalScope) IsToplevel

func (self *LocalScope) IsToplevel() bool

type Parameter

type Parameter struct {
	*DefinedVariable
}

func AsParameter

func AsParameter(x core.IEntity) *Parameter

func NewParameter

func NewParameter(t core.ITypeNode, name string) *Parameter

func NewParameters

func NewParameters(xs ...*Parameter) []*Parameter

func (*Parameter) GetAddress

func (self *Parameter) GetAddress() core.IOperand

func (*Parameter) GetInitializer

func (self *Parameter) GetInitializer() core.IExprNode

func (*Parameter) GetMemref

func (self *Parameter) GetMemref() core.IMemoryReference

func (*Parameter) GetName

func (self *Parameter) GetName() string

func (*Parameter) GetNumRefered

func (self *Parameter) GetNumRefered() int

func (*Parameter) GetType

func (self *Parameter) GetType() core.IType

func (*Parameter) GetTypeNode

func (self *Parameter) GetTypeNode() core.ITypeNode

func (*Parameter) GetTypeRef

func (self *Parameter) GetTypeRef() core.ITypeRef

func (*Parameter) GetValue

func (self *Parameter) GetValue() core.IExprNode

func (*Parameter) HasInitializer

func (self *Parameter) HasInitializer() bool

func (*Parameter) IsConstant

func (self *Parameter) IsConstant() bool

func (*Parameter) IsDefined

func (self *Parameter) IsDefined() bool

func (*Parameter) IsParameter

func (self *Parameter) IsParameter() bool

func (*Parameter) IsPrivate

func (self *Parameter) IsPrivate() bool

func (*Parameter) IsRefered

func (self *Parameter) IsRefered() bool

func (*Parameter) IsVariable

func (self *Parameter) IsVariable() bool

func (*Parameter) Refered

func (self *Parameter) Refered()

func (*Parameter) SetAddress

func (self *Parameter) SetAddress(address core.IOperand)

func (*Parameter) SetInitializer

func (self *Parameter) SetInitializer(e core.IExprNode)

func (*Parameter) SetMemref

func (self *Parameter) SetMemref(memref core.IMemoryReference)

func (*Parameter) String

func (self *Parameter) String() string

func (*Parameter) SymbolString

func (self *Parameter) SymbolString() string

type Params

type Params struct {
	ClassName  string
	Location   core.Location
	ParamDescs []*Parameter
	Vararg     bool
}

func AsParams

func AsParams(x core.IEntity) *Params

func NewParams

func NewParams(loc core.Location, paramDescs []*Parameter, vararg bool) *Params

func (*Params) GetAddress

func (self *Params) GetAddress() core.IOperand

func (*Params) GetLocation

func (self *Params) GetLocation() core.Location

func (*Params) GetMemref

func (self *Params) GetMemref() core.IMemoryReference

func (*Params) GetName

func (self *Params) GetName() string

func (*Params) GetNumRefered

func (self *Params) GetNumRefered() int

func (*Params) GetParamDescs

func (self *Params) GetParamDescs() []*Parameter

func (*Params) GetType

func (self *Params) GetType() core.IType

func (*Params) GetTypeNode

func (self *Params) GetTypeNode() core.ITypeNode

func (*Params) GetTypeRef

func (self *Params) GetTypeRef() core.ITypeRef

func (*Params) GetValue

func (self *Params) GetValue() core.IExprNode

func (*Params) IsConstant

func (self *Params) IsConstant() bool

func (*Params) IsDefined

func (self *Params) IsDefined() bool

func (*Params) IsParameter

func (self *Params) IsParameter() bool

func (*Params) IsPrivate

func (self *Params) IsPrivate() bool

func (*Params) IsRefered

func (self *Params) IsRefered() bool

func (*Params) IsVararg

func (self *Params) IsVararg() bool

func (*Params) IsVariable

func (self *Params) IsVariable() bool

func (*Params) Refered

func (self *Params) Refered()

func (*Params) SetAddress

func (self *Params) SetAddress(address core.IOperand)

func (*Params) SetMemref

func (self *Params) SetMemref(memref core.IMemoryReference)

func (*Params) String

func (self *Params) String() string

func (*Params) SymbolString

func (self *Params) SymbolString() string

type ToplevelScope

type ToplevelScope struct {
	Children             []*LocalScope
	Entities             map[string]core.IEntity
	StaticLocalVariables []*DefinedVariable
}

func NewToplevelScope

func NewToplevelScope() *ToplevelScope

func (*ToplevelScope) AddChild

func (self *ToplevelScope) AddChild(scope core.IScope)

func (*ToplevelScope) AllGlobalVariables

func (self *ToplevelScope) AllGlobalVariables() []core.IVariable

func (*ToplevelScope) CheckReferences

func (self *ToplevelScope) CheckReferences(errorHandler *core.ErrorHandler)

func (*ToplevelScope) DeclareEntity

func (self *ToplevelScope) DeclareEntity(entity core.IEntity)

func (*ToplevelScope) DefineEntity

func (self *ToplevelScope) DefineEntity(entity core.IEntity)

func (*ToplevelScope) GetByName

func (self *ToplevelScope) GetByName(name string) core.IEntity

func (*ToplevelScope) GetDefinedGlobalScopeVariables

func (self *ToplevelScope) GetDefinedGlobalScopeVariables() []*DefinedVariable

func (*ToplevelScope) GetParent

func (self *ToplevelScope) GetParent() core.IScope

func (*ToplevelScope) GetStaticLocalVariables

func (self *ToplevelScope) GetStaticLocalVariables() []*DefinedVariable

func (*ToplevelScope) GetToplevel

func (self *ToplevelScope) GetToplevel() core.IScope

func (*ToplevelScope) IsToplevel

func (self *ToplevelScope) IsToplevel() bool

type UndefinedFunction

type UndefinedFunction struct {
	ClassName string
	TypeNode  core.ITypeNode
	Name      string
	Params    *Params
	// contains filtered or unexported fields
}

func AsUndefinedFunction

func AsUndefinedFunction(x core.IEntity) *UndefinedFunction

func NewUndefinedFunction

func NewUndefinedFunction(t core.ITypeNode, name string, params *Params) *UndefinedFunction

func NewUndefinedFunctions

func NewUndefinedFunctions(xs ...*UndefinedFunction) []*UndefinedFunction

func (*UndefinedFunction) GetAddress

func (self *UndefinedFunction) GetAddress() core.IOperand

func (*UndefinedFunction) GetCallingSymbol

func (self *UndefinedFunction) GetCallingSymbol() core.ISymbol

func (*UndefinedFunction) GetMemref

func (self *UndefinedFunction) GetMemref() core.IMemoryReference

func (*UndefinedFunction) GetName

func (self *UndefinedFunction) GetName() string

func (*UndefinedFunction) GetNumRefered

func (self *UndefinedFunction) GetNumRefered() int

func (*UndefinedFunction) GetParameters

func (self *UndefinedFunction) GetParameters() []*Parameter

func (*UndefinedFunction) GetParams

func (self *UndefinedFunction) GetParams() *Params

func (*UndefinedFunction) GetReturnType

func (self *UndefinedFunction) GetReturnType() core.IType

func (*UndefinedFunction) GetType

func (self *UndefinedFunction) GetType() core.IType

func (*UndefinedFunction) GetTypeNode

func (self *UndefinedFunction) GetTypeNode() core.ITypeNode

func (*UndefinedFunction) GetTypeRef

func (self *UndefinedFunction) GetTypeRef() core.ITypeRef

func (*UndefinedFunction) GetValue

func (self *UndefinedFunction) GetValue() core.IExprNode

func (*UndefinedFunction) IsConstant

func (self *UndefinedFunction) IsConstant() bool

func (*UndefinedFunction) IsDefined

func (self *UndefinedFunction) IsDefined() bool

func (*UndefinedFunction) IsParameter

func (self *UndefinedFunction) IsParameter() bool

func (*UndefinedFunction) IsPrivate

func (self *UndefinedFunction) IsPrivate() bool

func (*UndefinedFunction) IsRefered

func (self *UndefinedFunction) IsRefered() bool

func (*UndefinedFunction) IsVariable

func (self *UndefinedFunction) IsVariable() bool

func (*UndefinedFunction) IsVoid

func (self *UndefinedFunction) IsVoid() bool

func (*UndefinedFunction) Refered

func (self *UndefinedFunction) Refered()

func (*UndefinedFunction) SetAddress

func (self *UndefinedFunction) SetAddress(address core.IOperand)

func (*UndefinedFunction) SetCallingSymbol

func (self *UndefinedFunction) SetCallingSymbol(sym core.ISymbol)

func (*UndefinedFunction) SetMemref

func (self *UndefinedFunction) SetMemref(memref core.IMemoryReference)

func (*UndefinedFunction) String

func (self *UndefinedFunction) String() string

func (*UndefinedFunction) SymbolString

func (self *UndefinedFunction) SymbolString() string

type UndefinedVariable

type UndefinedVariable struct {
	ClassName string
	Name      string
	TypeNode  core.ITypeNode
	// contains filtered or unexported fields
}

func AsUndefinedVariable

func AsUndefinedVariable(x core.IEntity) *UndefinedVariable

func NewUndefinedVariable

func NewUndefinedVariable(t core.ITypeNode, name string) *UndefinedVariable

func NewUndefinedVariables

func NewUndefinedVariables(xs ...*UndefinedVariable) []*UndefinedVariable

func (*UndefinedVariable) GetAddress

func (self *UndefinedVariable) GetAddress() core.IOperand

func (*UndefinedVariable) GetMemref

func (self *UndefinedVariable) GetMemref() core.IMemoryReference

func (*UndefinedVariable) GetName

func (self *UndefinedVariable) GetName() string

func (*UndefinedVariable) GetNumRefered

func (self *UndefinedVariable) GetNumRefered() int

func (*UndefinedVariable) GetType

func (self *UndefinedVariable) GetType() core.IType

func (*UndefinedVariable) GetTypeNode

func (self *UndefinedVariable) GetTypeNode() core.ITypeNode

func (*UndefinedVariable) GetTypeRef

func (self *UndefinedVariable) GetTypeRef() core.ITypeRef

func (*UndefinedVariable) GetValue

func (self *UndefinedVariable) GetValue() core.IExprNode

func (*UndefinedVariable) IsConstant

func (self *UndefinedVariable) IsConstant() bool

func (*UndefinedVariable) IsDefined

func (self *UndefinedVariable) IsDefined() bool

func (*UndefinedVariable) IsParameter

func (self *UndefinedVariable) IsParameter() bool

func (*UndefinedVariable) IsPrivate

func (self *UndefinedVariable) IsPrivate() bool

func (*UndefinedVariable) IsRefered

func (self *UndefinedVariable) IsRefered() bool

func (*UndefinedVariable) IsVariable

func (self *UndefinedVariable) IsVariable() bool

func (*UndefinedVariable) Refered

func (self *UndefinedVariable) Refered()

func (*UndefinedVariable) SetAddress

func (self *UndefinedVariable) SetAddress(address core.IOperand)

func (*UndefinedVariable) SetMemref

func (self *UndefinedVariable) SetMemref(memref core.IMemoryReference)

func (*UndefinedVariable) String

func (self *UndefinedVariable) String() string

func (*UndefinedVariable) SymbolString

func (self *UndefinedVariable) SymbolString() string

Jump to

Keyboard shortcuts

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