Documentation ¶
Index ¶
- func Construct(module *Module, modules *ModuleLookup)
- func EscapeString(s string) string
- func ExtractTypeVariable(pattern *TypeReference, value *TypeReference) (map[string]*TypeReference, error)
- func Infer(submod *Submodule)
- func IsPointerOrReferenceType(t Type) bool
- func LoadRuntimeModule(mod *Module)
- func Resolve(mod *Module, mods *ModuleLookup)
- func TypeReferenceMangledName(mangleType MangleType, typ *TypeReference, gcon *GenericContext) string
- func TypeReferencesMangledName(mangleType MangleType, typs []*TypeReference, gcon *GenericContext) string
- type ASTStringer
- func (v *ASTStringer) Add(what fmt.Stringer) *ASTStringer
- func (v *ASTStringer) AddAttrs(attrs parser.AttrGroup) *ASTStringer
- func (v *ASTStringer) AddGenericArguments(args []*TypeReference) *ASTStringer
- func (v *ASTStringer) AddString(what string) *ASTStringer
- func (v *ASTStringer) AddStringColored(color string, what string) *ASTStringer
- func (v *ASTStringer) AddType(t Type) *ASTStringer
- func (v *ASTStringer) AddTypeReference(t *TypeReference) *ASTStringer
- func (v *ASTStringer) AddWithColor(color string, what fmt.Stringer) *ASTStringer
- func (v *ASTStringer) AddWithFallback(color string, what fmt.Stringer, fallback string) *ASTStringer
- func (v *ASTStringer) Finish() string
- type ASTVisitor
- func (v *ASTVisitor) EnterScope()
- func (v *ASTVisitor) ExitScope()
- func (v *ASTVisitor) Visit(n Node) Node
- func (v *ASTVisitor) VisitBlock(b *Block) *Block
- func (v *ASTVisitor) VisitBlocks(blocks []*Block) []*Block
- func (v *ASTVisitor) VisitChildren(n Node)
- func (v *ASTVisitor) VisitExpr(e Expr) Expr
- func (v *ASTVisitor) VisitExprs(exprs []Expr) []Expr
- func (v *ASTVisitor) VisitFunction(fn *Function)
- func (v *ASTVisitor) VisitNodes(nodes []Node) []Node
- func (v *ASTVisitor) VisitSubmodule(submodule *Submodule)
- type AccessExpr
- type AnnotatedTyped
- type ArrayAccessExpr
- func (v ArrayAccessExpr) GetType() *TypeReference
- func (v ArrayAccessExpr) Mutable() bool
- func (_ ArrayAccessExpr) NodeName() string
- func (v ArrayAccessExpr) Pos() lexer.Position
- func (v *ArrayAccessExpr) SetPos(pos lexer.Position)
- func (_ ArrayAccessExpr) SetType(t *TypeReference)
- func (v ArrayAccessExpr) String() string
- type ArrayLenExpr
- type ArrayType
- func (v ArrayType) ActualType() Type
- func (v ArrayType) Attrs() parser.AttrGroup
- func (v ArrayType) CanCastTo(t Type) bool
- func (v ArrayType) Equals(t Type) bool
- func (v ArrayType) IsFloatingType() bool
- func (v ArrayType) IsIntegerType() bool
- func (v ArrayType) IsSigned() bool
- func (v ArrayType) IsVoidType() bool
- func (v ArrayType) LevelsOfIndirection() int
- func (v ArrayType) String() string
- func (v ArrayType) TypeName() string
- type AssignStat
- type BinaryExpr
- type BinopAssignStat
- type Block
- type BlockStat
- type BoolLiteral
- type BreakStat
- type CallExpr
- type CallStat
- type CastExpr
- type CompositeLiteral
- type Constraint
- type ConstructableExpr
- type ConstructableNode
- type ConstructableType
- type Constructor
- type ConstructorId
- type ConstructorType
- func (v *ConstructorType) ActualType() Type
- func (v ConstructorType) Attrs() parser.AttrGroup
- func (v ConstructorType) CanCastTo(t Type) bool
- func (v *ConstructorType) Equals(other Type) bool
- func (v ConstructorType) IsFloatingType() bool
- func (v ConstructorType) IsIntegerType() bool
- func (v ConstructorType) IsSigned() bool
- func (v ConstructorType) IsVoidType() bool
- func (v ConstructorType) LevelsOfIndirection() int
- func (v *ConstructorType) String() string
- func (v *ConstructorType) TypeName() string
- type Decl
- type DeferStat
- type Dependency
- type DependencyGraph
- type DependencyNode
- type DerefAccessExpr
- func (v DerefAccessExpr) GetType() *TypeReference
- func (v DerefAccessExpr) Mutable() bool
- func (_ DerefAccessExpr) NodeName() string
- func (v DerefAccessExpr) Pos() lexer.Position
- func (v *DerefAccessExpr) SetPos(pos lexer.Position)
- func (_ DerefAccessExpr) SetType(t *TypeReference)
- func (v DerefAccessExpr) String() string
- type DestructAssignStat
- type DestructBinopAssignStat
- type DestructVarDecl
- type DiscardAccessExpr
- func (v DiscardAccessExpr) GetType() *TypeReference
- func (v DiscardAccessExpr) Mutable() bool
- func (_ DiscardAccessExpr) NodeName() string
- func (v DiscardAccessExpr) Pos() lexer.Position
- func (v *DiscardAccessExpr) SetPos(pos lexer.Position)
- func (_ DiscardAccessExpr) SetType(t *TypeReference)
- func (v DiscardAccessExpr) String() string
- type EnumLiteral
- type EnumPatternExpr
- type EnumType
- func (v EnumType) ActualType() Type
- func (v EnumType) Attrs() parser.AttrGroup
- func (v EnumType) CanCastTo(t Type) bool
- func (v EnumType) Equals(t Type) bool
- func (v EnumType) GetMember(name string) (EnumTypeMember, bool)
- func (v EnumType) IsFloatingType() bool
- func (v EnumType) IsIntegerType() bool
- func (v EnumType) IsSigned() bool
- func (v EnumType) IsVoidType() bool
- func (v EnumType) LevelsOfIndirection() int
- func (v EnumType) MemberIndex(name string) int
- func (v EnumType) String() string
- func (v EnumType) TypeName() string
- type EnumTypeMember
- type Expr
- type Function
- type FunctionAccessExpr
- func (v FunctionAccessExpr) GetType() *TypeReference
- func (_ FunctionAccessExpr) NodeName() string
- func (v FunctionAccessExpr) Pos() lexer.Position
- func (v *FunctionAccessExpr) SetPos(pos lexer.Position)
- func (v *FunctionAccessExpr) SetType(t *TypeReference)
- func (v FunctionAccessExpr) String() string
- type FunctionDecl
- type FunctionType
- func (v FunctionType) ActualType() Type
- func (v FunctionType) Attrs() parser.AttrGroup
- func (v FunctionType) CanCastTo(t Type) bool
- func (v FunctionType) Equals(t Type) bool
- func (v FunctionType) IsFloatingType() bool
- func (v FunctionType) IsIntegerType() bool
- func (v FunctionType) IsSigned() bool
- func (v FunctionType) IsVoidType() bool
- func (v FunctionType) LevelsOfIndirection() int
- func (v FunctionType) String() string
- func (v FunctionType) TypeName() string
- type GenericContext
- type GenericSigil
- type Ident
- type IdentType
- type IfStat
- type Inferrer
- func (v *Inferrer) AddConstraint(c *Constraint)
- func (v *Inferrer) AddEqualsConstraint(a, b int)
- func (v *Inferrer) AddIsConstraint(id int, typref *TypeReference)
- func (v *Inferrer) AddSimpleIsConstraint(id int, typref *TypeReference)
- func (v *Inferrer) EnterScope()
- func (v *Inferrer) ExitScope()
- func (v *Inferrer) Finalize()
- func (v *Inferrer) Function() *Function
- func (v *Inferrer) GetDiscardingId() int
- func (v *Inferrer) HandleExpr(expr Expr) int
- func (v *Inferrer) HandleTyped(pos lexer.Position, typed Typed) int
- func (v *Inferrer) PostVisit(node *Node)
- func (v *Inferrer) Solve() []*Constraint
- func (v *Inferrer) SolveStep(stackIn []*Constraint, subsIn []*Constraint, addSubs bool, element *Constraint) (stack []*Constraint, substitutions []*Constraint)
- func (v *Inferrer) Visit(node *Node) bool
- type InterfaceType
- func (v InterfaceType) ActualType() Type
- func (v InterfaceType) Attrs() parser.AttrGroup
- func (v InterfaceType) CanCastTo(t Type) bool
- func (v InterfaceType) Equals(t Type) bool
- func (v InterfaceType) GetFunction(name string) *Function
- func (v InterfaceType) IsFloatingType() bool
- func (v InterfaceType) IsIntegerType() bool
- func (v InterfaceType) IsSigned() bool
- func (v InterfaceType) IsVoidType() bool
- func (v InterfaceType) LevelsOfIndirection() int
- func (v InterfaceType) MatchesMethods(methods []*Function) bool
- func (v InterfaceType) MatchesType(t Type) bool
- func (v InterfaceType) String() string
- func (v InterfaceType) TypeName() string
- type LambdaExpr
- type Locatable
- type LoopStat
- type LoopStatType
- type MangleType
- type MatchStat
- type Module
- type ModuleLookup
- type ModuleName
- type NamedType
- func (v *NamedType) ActualType() Type
- func (v *NamedType) Attrs() parser.AttrGroup
- func (v *NamedType) CanCastTo(t Type) bool
- func (v *NamedType) Equals(t Type) bool
- func (v *NamedType) GetMethod(name string) *Function
- func (v *NamedType) GetStaticMethod(name string) *Function
- func (v *NamedType) IsFloatingType() bool
- func (v *NamedType) IsIntegerType() bool
- func (v *NamedType) IsSigned() bool
- func (v *NamedType) IsVoidType() bool
- func (v *NamedType) LevelsOfIndirection() int
- func (v *NamedType) String() string
- func (v *NamedType) TypeName() string
- type NextStat
- type Node
- type NodeSet
- type NumericLiteral
- func (v NumericLiteral) AsFloat() float64
- func (v NumericLiteral) AsInt() uint64
- func (v NumericLiteral) GetType() *TypeReference
- func (_ NumericLiteral) NodeName() string
- func (v NumericLiteral) Pos() lexer.Position
- func (v *NumericLiteral) SetPos(pos lexer.Position)
- func (v *NumericLiteral) SetType(t *TypeReference)
- func (v NumericLiteral) String() string
- type PointerToExpr
- type PointerType
- func (v PointerType) ActualType() Type
- func (v PointerType) Attrs() parser.AttrGroup
- func (v PointerType) CanCastTo(t Type) bool
- func (v PointerType) Equals(t Type) bool
- func (v PointerType) IsFloatingType() bool
- func (v PointerType) IsIntegerType() bool
- func (v PointerType) IsSigned() bool
- func (v PointerType) IsVoidType() bool
- func (v PointerType) LevelsOfIndirection() int
- func (v PointerType) TypeName() string
- type PrimitiveType
- func (v PrimitiveType) ActualType() Type
- func (v PrimitiveType) Attrs() parser.AttrGroup
- func (v PrimitiveType) CanCastTo(t Type) bool
- func (v PrimitiveType) Equals(t Type) bool
- func (v PrimitiveType) IsFloatingType() bool
- func (v PrimitiveType) IsIntegerType() bool
- func (v PrimitiveType) IsSigned() bool
- func (v PrimitiveType) IsVoidType() bool
- func (v PrimitiveType) LevelsOfIndirection() int
- func (i PrimitiveType) String() string
- func (v PrimitiveType) TypeName() string
- type PublicHandler
- type ReferenceToExpr
- type ReferenceType
- func (v ReferenceType) ActualType() Type
- func (v ReferenceType) Attrs() parser.AttrGroup
- func (v ReferenceType) CanCastTo(t Type) bool
- func (v ReferenceType) Equals(t Type) bool
- func (v ReferenceType) IsFloatingType() bool
- func (v ReferenceType) IsIntegerType() bool
- func (v ReferenceType) IsSigned() bool
- func (v ReferenceType) IsVoidType() bool
- func (v ReferenceType) LevelsOfIndirection() int
- func (v ReferenceType) TypeName() string
- type Resolver
- func (v *Resolver) EnterScope()
- func (v *Resolver) ExitScope()
- func (v *Resolver) PostVisit(node *Node)
- func (v *Resolver) ResolveDescent()
- func (v *Resolver) ResolveNode(node *Node)
- func (v *Resolver) ResolveTopLevelDecls()
- func (v *Resolver) ResolveType(src Locatable, t Type) Type
- func (v *Resolver) ResolveTypeReference(src Locatable, t *TypeReference) *TypeReference
- func (v *Resolver) ResolveTypeReferences(src Locatable, ts []*TypeReference) []*TypeReference
- func (v *Resolver) ResolveTypes(src Locatable, ts []Type) []Type
- func (v *Resolver) ResolveUsedModules()
- func (v *Resolver) Visit(n *Node) bool
- type ReturnStat
- type RuneLiteral
- type Scope
- func (v *Scope) Dump(depth int)
- func (v *Scope) GetIdent(name UnresolvedName) *Ident
- func (v *Scope) InsertFunction(t *Function, public bool) *Ident
- func (v *Scope) InsertIdent(value interface{}, name string, typ IdentType, public bool) *Ident
- func (v *Scope) InsertType(t Type, public bool) *Ident
- func (v *Scope) InsertVariable(t *Variable, public bool) *Ident
- func (v *Scope) UseModule(t *Module)
- func (v *Scope) UseModuleAs(t *Module, name string)
- type Side
- type SideType
- type SizeofExpr
- type Stat
- type StringLiteral
- type StructAccessExpr
- func (v StructAccessExpr) GetType() *TypeReference
- func (v StructAccessExpr) Mutable() bool
- func (_ StructAccessExpr) NodeName() string
- func (v StructAccessExpr) Pos() lexer.Position
- func (v *StructAccessExpr) SetPos(pos lexer.Position)
- func (_ StructAccessExpr) SetType(t *TypeReference)
- func (v StructAccessExpr) String() string
- type StructMember
- type StructType
- func (v StructType) ActualType() Type
- func (v StructType) Attrs() parser.AttrGroup
- func (v StructType) CanCastTo(t Type) bool
- func (v StructType) Equals(t Type) bool
- func (v StructType) GetMember(name string) *StructMember
- func (v StructType) IsFloatingType() bool
- func (v StructType) IsIntegerType() bool
- func (v StructType) IsSigned() bool
- func (v StructType) IsVoidType() bool
- func (v StructType) LevelsOfIndirection() int
- func (v StructType) MemberIndex(name string) int
- func (v StructType) String() string
- func (v StructType) TypeName() string
- type Submodule
- type SubstitutionType
- func (v *SubstitutionType) ActualType() Type
- func (v *SubstitutionType) Attrs() parser.AttrGroup
- func (v *SubstitutionType) CanCastTo(t Type) bool
- func (v *SubstitutionType) Equals(t Type) bool
- func (v *SubstitutionType) IsFloatingType() bool
- func (v *SubstitutionType) IsIntegerType() bool
- func (v *SubstitutionType) IsSigned() bool
- func (v *SubstitutionType) IsVoidType() bool
- func (v *SubstitutionType) LevelsOfIndirection() int
- func (v *SubstitutionType) String() string
- func (v *SubstitutionType) TypeName() string
- type TupleLiteral
- type TupleType
- func (v TupleType) ActualType() Type
- func (v TupleType) Attrs() parser.AttrGroup
- func (v TupleType) CanCastTo(t Type) bool
- func (v TupleType) Equals(t Type) bool
- func (v TupleType) IsFloatingType() bool
- func (v TupleType) IsIntegerType() bool
- func (v TupleType) IsSigned() bool
- func (v TupleType) IsVoidType() bool
- func (v TupleType) LevelsOfIndirection() int
- func (v TupleType) String() string
- func (v TupleType) TypeName() string
- type Type
- type TypeDecl
- type TypeReference
- type TypeVariable
- func (v TypeVariable) ActualType() Type
- func (v TypeVariable) Attrs() parser.AttrGroup
- func (v TypeVariable) CanCastTo(t Type) bool
- func (v TypeVariable) Equals(other Type) bool
- func (v TypeVariable) IsFloatingType() bool
- func (v TypeVariable) IsIntegerType() bool
- func (v TypeVariable) IsSigned() bool
- func (v TypeVariable) IsVoidType() bool
- func (v TypeVariable) LevelsOfIndirection() int
- func (v TypeVariable) String() string
- func (v TypeVariable) TypeName() string
- type Typed
- type UnaryExpr
- type UnresolvedName
- type UnresolvedType
- func (v UnresolvedType) ActualType() Type
- func (v UnresolvedType) Attrs() parser.AttrGroup
- func (v UnresolvedType) CanCastTo(t Type) bool
- func (v UnresolvedType) Equals(t Type) bool
- func (v UnresolvedType) IsFloatingType() bool
- func (v UnresolvedType) IsIntegerType() bool
- func (v UnresolvedType) IsSigned() bool
- func (v UnresolvedType) IsVoidType() bool
- func (v UnresolvedType) LevelsOfIndirection() int
- func (v UnresolvedType) String() string
- func (v UnresolvedType) TypeName() string
- type UseDirective
- type Variable
- type VariableAccessExpr
- func (v VariableAccessExpr) GetType() *TypeReference
- func (v VariableAccessExpr) Mutable() bool
- func (_ VariableAccessExpr) NodeName() string
- func (v VariableAccessExpr) Pos() lexer.Position
- func (v *VariableAccessExpr) SetPos(pos lexer.Position)
- func (_ VariableAccessExpr) SetType(t *TypeReference)
- func (v VariableAccessExpr) String() string
- type VariableDecl
- type Visitor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Construct ¶
func Construct(module *Module, modules *ModuleLookup)
func EscapeString ¶
escape for debug output only things that can't be displayed need to be escaped
func ExtractTypeVariable ¶
func ExtractTypeVariable(pattern *TypeReference, value *TypeReference) (map[string]*TypeReference, error)
ExtractTypeVariable takes a pattern type containing one or more substitution types together with a value type, and generates a map from the substitution types to the the corresponding parts of the value type. An example would be: pattern: Pointer($T)
value: Pointer(int) return: {T: int}
func LoadRuntimeModule ¶
func LoadRuntimeModule(mod *Module)
func Resolve ¶
func Resolve(mod *Module, mods *ModuleLookup)
func TypeReferenceMangledName ¶
func TypeReferenceMangledName(mangleType MangleType, typ *TypeReference, gcon *GenericContext) string
easier than making a method for all types
func TypeReferencesMangledName ¶
func TypeReferencesMangledName(mangleType MangleType, typs []*TypeReference, gcon *GenericContext) string
Types ¶
type ASTStringer ¶
type ASTStringer struct {
// contains filtered or unexported fields
}
String representation util
func NewASTStringer ¶
func NewASTStringer(name string) *ASTStringer
func (*ASTStringer) Add ¶
func (v *ASTStringer) Add(what fmt.Stringer) *ASTStringer
func (*ASTStringer) AddAttrs ¶
func (v *ASTStringer) AddAttrs(attrs parser.AttrGroup) *ASTStringer
func (*ASTStringer) AddGenericArguments ¶
func (v *ASTStringer) AddGenericArguments(args []*TypeReference) *ASTStringer
func (*ASTStringer) AddString ¶
func (v *ASTStringer) AddString(what string) *ASTStringer
func (*ASTStringer) AddStringColored ¶
func (v *ASTStringer) AddStringColored(color string, what string) *ASTStringer
func (*ASTStringer) AddType ¶
func (v *ASTStringer) AddType(t Type) *ASTStringer
func (*ASTStringer) AddTypeReference ¶
func (v *ASTStringer) AddTypeReference(t *TypeReference) *ASTStringer
func (*ASTStringer) AddWithColor ¶
func (v *ASTStringer) AddWithColor(color string, what fmt.Stringer) *ASTStringer
func (*ASTStringer) AddWithFallback ¶
func (v *ASTStringer) AddWithFallback(color string, what fmt.Stringer, fallback string) *ASTStringer
func (*ASTStringer) Finish ¶
func (v *ASTStringer) Finish() string
type ASTVisitor ¶
type ASTVisitor struct {
Visitor Visitor
}
func NewASTVisitor ¶
func NewASTVisitor(visitor Visitor) *ASTVisitor
func (*ASTVisitor) EnterScope ¶
func (v *ASTVisitor) EnterScope()
func (*ASTVisitor) ExitScope ¶
func (v *ASTVisitor) ExitScope()
func (*ASTVisitor) Visit ¶
func (v *ASTVisitor) Visit(n Node) Node
func (*ASTVisitor) VisitBlock ¶
func (v *ASTVisitor) VisitBlock(b *Block) *Block
func (*ASTVisitor) VisitBlocks ¶
func (v *ASTVisitor) VisitBlocks(blocks []*Block) []*Block
func (*ASTVisitor) VisitChildren ¶
func (v *ASTVisitor) VisitChildren(n Node)
func (*ASTVisitor) VisitExpr ¶
func (v *ASTVisitor) VisitExpr(e Expr) Expr
func (*ASTVisitor) VisitExprs ¶
func (v *ASTVisitor) VisitExprs(exprs []Expr) []Expr
func (*ASTVisitor) VisitFunction ¶
func (v *ASTVisitor) VisitFunction(fn *Function)
func (*ASTVisitor) VisitNodes ¶
func (v *ASTVisitor) VisitNodes(nodes []Node) []Node
func (*ASTVisitor) VisitSubmodule ¶
func (v *ASTVisitor) VisitSubmodule(submodule *Submodule)
type AccessExpr ¶
type ArrayAccessExpr ¶
type ArrayAccessExpr struct { Array AccessExpr Subscript Expr // contains filtered or unexported fields }
func (ArrayAccessExpr) GetType ¶
func (v ArrayAccessExpr) GetType() *TypeReference
func (ArrayAccessExpr) Mutable ¶
func (v ArrayAccessExpr) Mutable() bool
func (ArrayAccessExpr) NodeName ¶
func (_ ArrayAccessExpr) NodeName() string
func (ArrayAccessExpr) String ¶
func (v ArrayAccessExpr) String() string
type ArrayLenExpr ¶
func (ArrayLenExpr) GetType ¶
func (v ArrayLenExpr) GetType() *TypeReference
func (ArrayLenExpr) NodeName ¶
func (_ ArrayLenExpr) NodeName() string
func (ArrayLenExpr) SetType ¶
func (_ ArrayLenExpr) SetType(t *TypeReference)
func (ArrayLenExpr) String ¶
func (v ArrayLenExpr) String() string
type ArrayType ¶
type ArrayType struct { MemberType *TypeReference IsFixedLength bool Length int // TODO change to uint64 // contains filtered or unexported fields }
func ArrayOf ¶
func ArrayOf(t *TypeReference, isFixedLength bool, length int) ArrayType
IMPORTANT: Using this function is no longer important, just make sure to use .Equals() to compare two types.
func (ArrayType) ActualType ¶
func (ArrayType) IsFloatingType ¶
func (ArrayType) IsIntegerType ¶
func (ArrayType) IsVoidType ¶
func (ArrayType) LevelsOfIndirection ¶
type AssignStat ¶
type AssignStat struct { Access AccessExpr Assignment Expr // contains filtered or unexported fields }
func (AssignStat) NodeName ¶
func (_ AssignStat) NodeName() string
func (AssignStat) String ¶
func (v AssignStat) String() string
type BinaryExpr ¶
type BinaryExpr struct {
Lhand, Rhand Expr
Op parser.BinOpType
Type *TypeReference
// contains filtered or unexported fields
}
func (BinaryExpr) GetType ¶
func (v BinaryExpr) GetType() *TypeReference
func (BinaryExpr) NodeName ¶
func (_ BinaryExpr) NodeName() string
func (BinaryExpr) String ¶
func (v BinaryExpr) String() string
type BinopAssignStat ¶
type BinopAssignStat struct { Access AccessExpr Operator parser.BinOpType Assignment Expr // contains filtered or unexported fields }
func (BinopAssignStat) NodeName ¶
func (_ BinopAssignStat) NodeName() string
func (BinopAssignStat) String ¶
func (v BinopAssignStat) String() string
type Block ¶
type BoolLiteral ¶
type BoolLiteral struct { Value bool // contains filtered or unexported fields }
func (BoolLiteral) GetType ¶
func (v BoolLiteral) GetType() *TypeReference
func (BoolLiteral) NodeName ¶
func (_ BoolLiteral) NodeName() string
func (BoolLiteral) SetType ¶
func (_ BoolLiteral) SetType(t *TypeReference)
func (BoolLiteral) String ¶
func (v BoolLiteral) String() string
type CallExpr ¶
type CallExpr struct { Function Expr Arguments []Expr ReceiverAccess Expr // nil if not method or if static // contains filtered or unexported fields }
func (CallExpr) GetType ¶
func (v CallExpr) GetType() *TypeReference
func (CallExpr) SetType ¶
func (_ CallExpr) SetType(t *TypeReference)
type CastExpr ¶
type CastExpr struct { Expr Expr Type *TypeReference // contains filtered or unexported fields }
func (CastExpr) GetType ¶
func (v CastExpr) GetType() *TypeReference
func (CastExpr) SetType ¶
func (_ CastExpr) SetType(t *TypeReference)
type CompositeLiteral ¶
type CompositeLiteral struct { Type *TypeReference Fields []string // len(Fields) == len(Values). empty fields represented as "" Values []Expr // contains filtered or unexported fields }
func (CompositeLiteral) GetType ¶
func (v CompositeLiteral) GetType() *TypeReference
func (CompositeLiteral) NodeName ¶
func (_ CompositeLiteral) NodeName() string
func (*CompositeLiteral) SetType ¶
func (v *CompositeLiteral) SetType(t *TypeReference)
ArrayLiteral
func (CompositeLiteral) String ¶
func (v CompositeLiteral) String() string
type Constraint ¶
type Constraint struct {
Left, Right Side
}
Constraint represents a single constraint to be solved. It consists of two "sides", each representing a type or a type variable.
func ConstraintFromTypes ¶
func ConstraintFromTypes(left, right *TypeReference) *Constraint
func (*Constraint) String ¶
func (v *Constraint) String() string
func (*Constraint) Subs ¶
func (v *Constraint) Subs(id int, side Side) *Constraint
type ConstructableExpr ¶
type ConstructableExpr interface {
// contains filtered or unexported methods
}
type ConstructableNode ¶
type ConstructableNode interface {
// contains filtered or unexported methods
}
type ConstructableType ¶
type ConstructableType interface {
// contains filtered or unexported methods
}
type Constructor ¶
type Constructor struct {
// contains filtered or unexported fields
}
type ConstructorId ¶
type ConstructorId int
const ( ConstructorInvalid ConstructorId = iota ConstructorStructMember ConstructorDeref ConstructorArrayIndex )
type ConstructorType ¶
type ConstructorType struct { Id ConstructorId Args []*TypeReference // Some constructors need additional data Data interface{} // contains filtered or unexported fields }
ConstructorType is an abstraction that in principle could represent any type that is built from other types. As we can use the actual types for most of these, this type is only used to represent the type of a struct member or, until removal, the type of tuple member by index.
func (*ConstructorType) ActualType ¶
func (v *ConstructorType) ActualType() Type
func (*ConstructorType) Equals ¶
func (v *ConstructorType) Equals(other Type) bool
func (ConstructorType) IsFloatingType ¶
func (v ConstructorType) IsFloatingType() bool
func (ConstructorType) IsIntegerType ¶
func (v ConstructorType) IsIntegerType() bool
func (ConstructorType) IsVoidType ¶
func (v ConstructorType) IsVoidType() bool
func (ConstructorType) LevelsOfIndirection ¶
func (v ConstructorType) LevelsOfIndirection() int
func (*ConstructorType) String ¶
func (v *ConstructorType) String() string
func (*ConstructorType) TypeName ¶
func (v *ConstructorType) TypeName() string
type Dependency ¶
type Dependency struct{ Src, Dst *DependencyNode }
type DependencyGraph ¶
type DependencyGraph struct { Nodes NodeSet NodeIndices map[string]int EdgesFrom map[string][]Dependency // contains filtered or unexported fields }
func NewDependencyGraph ¶
func NewDependencyGraph() *DependencyGraph
func (*DependencyGraph) AddDependency ¶
func (v *DependencyGraph) AddDependency(source, dependency *ModuleName)
func (*DependencyGraph) DetectCycles ¶
func (d *DependencyGraph) DetectCycles() []string
type DependencyNode ¶
type DependencyNode struct { Module *ModuleName // contains filtered or unexported fields }
type DerefAccessExpr ¶
type DerefAccessExpr struct { Expr Expr // contains filtered or unexported fields }
func (DerefAccessExpr) GetType ¶
func (v DerefAccessExpr) GetType() *TypeReference
func (DerefAccessExpr) Mutable ¶
func (v DerefAccessExpr) Mutable() bool
func (DerefAccessExpr) NodeName ¶
func (_ DerefAccessExpr) NodeName() string
func (DerefAccessExpr) SetType ¶
func (_ DerefAccessExpr) SetType(t *TypeReference)
func (DerefAccessExpr) String ¶
func (v DerefAccessExpr) String() string
type DestructAssignStat ¶
type DestructAssignStat struct { Accesses []AccessExpr Assignment Expr // contains filtered or unexported fields }
func (DestructAssignStat) NodeName ¶
func (_ DestructAssignStat) NodeName() string
func (DestructAssignStat) String ¶
func (v DestructAssignStat) String() string
type DestructBinopAssignStat ¶
type DestructBinopAssignStat struct { Accesses []AccessExpr Operator parser.BinOpType Assignment Expr // contains filtered or unexported fields }
func (DestructBinopAssignStat) NodeName ¶
func (_ DestructBinopAssignStat) NodeName() string
func (DestructBinopAssignStat) String ¶
func (v DestructBinopAssignStat) String() string
type DestructVarDecl ¶
type DestructVarDecl struct { PublicHandler Variables []*Variable ShouldDiscard []bool Assignment Expr // contains filtered or unexported fields }
DestructVarDecl
func (DestructVarDecl) DocComments ¶
func (v DestructVarDecl) DocComments() []*parser.DocComment
func (DestructVarDecl) NodeName ¶
func (_ DestructVarDecl) NodeName() string
func (DestructVarDecl) String ¶
func (v DestructVarDecl) String() string
type DiscardAccessExpr ¶
type DiscardAccessExpr struct {
// contains filtered or unexported fields
}
func (DiscardAccessExpr) GetType ¶
func (v DiscardAccessExpr) GetType() *TypeReference
func (DiscardAccessExpr) Mutable ¶
func (v DiscardAccessExpr) Mutable() bool
func (DiscardAccessExpr) NodeName ¶
func (_ DiscardAccessExpr) NodeName() string
func (DiscardAccessExpr) SetType ¶
func (_ DiscardAccessExpr) SetType(t *TypeReference)
func (DiscardAccessExpr) String ¶
func (v DiscardAccessExpr) String() string
type EnumLiteral ¶
type EnumLiteral struct { Type *TypeReference Member string TupleLiteral *TupleLiteral CompositeLiteral *CompositeLiteral // contains filtered or unexported fields }
func (EnumLiteral) GetType ¶
func (v EnumLiteral) GetType() *TypeReference
func (EnumLiteral) NodeName ¶
func (_ EnumLiteral) NodeName() string
func (*EnumLiteral) SetType ¶
func (v *EnumLiteral) SetType(t *TypeReference)
func (EnumLiteral) String ¶
func (v EnumLiteral) String() string
type EnumPatternExpr ¶
type EnumPatternExpr struct { MemberName UnresolvedName Variables []*Variable EnumType *TypeReference // contains filtered or unexported fields }
func (EnumPatternExpr) GetType ¶
func (v EnumPatternExpr) GetType() *TypeReference
func (EnumPatternExpr) NodeName ¶
func (_ EnumPatternExpr) NodeName() string
func (*EnumPatternExpr) SetType ¶
func (v *EnumPatternExpr) SetType(t *TypeReference)
func (EnumPatternExpr) String ¶
func (v EnumPatternExpr) String() string
type EnumType ¶
type EnumType struct { Simple bool GenericParameters GenericSigil Members []EnumTypeMember // contains filtered or unexported fields }
EnumType
func (EnumType) ActualType ¶
func (EnumType) IsFloatingType ¶
func (EnumType) IsIntegerType ¶
func (EnumType) IsVoidType ¶
func (EnumType) LevelsOfIndirection ¶
func (EnumType) MemberIndex ¶
type EnumTypeMember ¶
type Function ¶
type Function struct { Name string Type FunctionType Parameters []*VariableDecl Body *Block Accesses []*FunctionAccessExpr ParentModule *Module Receiver *VariableDecl // non-nil if non-static method StaticReceiverType Type // non-nil if static Anonymous bool }
Note that for static methods, “
func (Function) MangledName ¶
func (v Function) MangledName(typ MangleType, gcon *GenericContext) string
type FunctionAccessExpr ¶
type FunctionAccessExpr struct { Function *Function ReceiverAccess Expr // should be same as on the callexpr GenericArguments []*TypeReference ExtraGenericContext *GenericContext // used when we're calling on a substitution type wth generic interface constraints ParentFunction *Function // the function this access expression is located in // contains filtered or unexported fields }
FunctionAccessExpr
func (FunctionAccessExpr) GetType ¶
func (v FunctionAccessExpr) GetType() *TypeReference
func (FunctionAccessExpr) NodeName ¶
func (_ FunctionAccessExpr) NodeName() string
func (*FunctionAccessExpr) SetType ¶
func (v *FunctionAccessExpr) SetType(t *TypeReference)
func (FunctionAccessExpr) String ¶
func (v FunctionAccessExpr) String() string
type FunctionDecl ¶
type FunctionDecl struct { PublicHandler Function *Function Prototype bool // contains filtered or unexported fields }
func (FunctionDecl) DocComments ¶
func (v FunctionDecl) DocComments() []*parser.DocComment
func (FunctionDecl) NodeName ¶
func (_ FunctionDecl) NodeName() string
func (FunctionDecl) String ¶
func (v FunctionDecl) String() string
type FunctionType ¶
type FunctionType struct { GenericParameters GenericSigil Parameters []*TypeReference Return *TypeReference IsVariadic bool Receiver *TypeReference // non-nil if non-static method // contains filtered or unexported fields }
FunctionType
func (FunctionType) ActualType ¶
func (v FunctionType) ActualType() Type
func (FunctionType) Attrs ¶
func (v FunctionType) Attrs() parser.AttrGroup
func (FunctionType) CanCastTo ¶
func (v FunctionType) CanCastTo(t Type) bool
func (FunctionType) Equals ¶
func (v FunctionType) Equals(t Type) bool
func (FunctionType) IsFloatingType ¶
func (v FunctionType) IsFloatingType() bool
func (FunctionType) IsIntegerType ¶
func (v FunctionType) IsIntegerType() bool
func (FunctionType) IsSigned ¶
func (v FunctionType) IsSigned() bool
func (FunctionType) IsVoidType ¶
func (v FunctionType) IsVoidType() bool
func (FunctionType) LevelsOfIndirection ¶
func (v FunctionType) LevelsOfIndirection() int
func (FunctionType) String ¶
func (v FunctionType) String() string
func (FunctionType) TypeName ¶
func (v FunctionType) TypeName() string
type GenericContext ¶
type GenericContext struct { Outer *GenericContext // contains filtered or unexported fields }
GenericInstance Substition GenericContext to real type mappings override parameters to self mappings.
func NewGenericContext ¶
func NewGenericContext(parameters GenericSigil, arguments []*TypeReference) *GenericContext
func NewGenericContextFromTypeReference ¶
func NewGenericContextFromTypeReference(typref *TypeReference) *GenericContext
func (*GenericContext) Get ¶
func (v *GenericContext) Get(t *TypeReference) *TypeReference
If the key is a substitution type and is not found in this generic instance, Get() checks GenericContext.Outer if not nil.
func (*GenericContext) GetSubstitutionType ¶
func (v *GenericContext) GetSubstitutionType(t *SubstitutionType) *TypeReference
Like Get, but only gets value where key is substitution type. Returns nil if no value for key.
func (*GenericContext) Replace ¶
func (v *GenericContext) Replace(t *TypeReference) *TypeReference
Replace goes through the *TypeReference and returns a new one with all the SubstitutionTypes that are mapped in this GenericContext.
type GenericSigil ¶
type GenericSigil []*SubstitutionType
func (GenericSigil) String ¶
func (v GenericSigil) String() string
type IfStat ¶
type Inferrer ¶
type Inferrer struct { Submodule *Submodule Functions []*Function Typeds map[int]*AnnotatedTyped TypedLookup map[Typed]*AnnotatedTyped SimpleConstraints []*Constraint Constraints []*Constraint IdCount int }
func (*Inferrer) AddConstraint ¶
func (v *Inferrer) AddConstraint(c *Constraint)
func (*Inferrer) AddEqualsConstraint ¶
AddEqualsConstraint creates a constraint that indicates that the two given ids are equal to one-another and add it to the list of constraints.
func (*Inferrer) AddIsConstraint ¶
func (v *Inferrer) AddIsConstraint(id int, typref *TypeReference)
AddIsConstraint creates a constraing that indicates that the given id is of the given type and add it to the list of constraints.
func (*Inferrer) AddSimpleIsConstraint ¶
func (v *Inferrer) AddSimpleIsConstraint(id int, typref *TypeReference)
AddSimpleIsConstraint creates and adds a constraint to the inferrer, where the type given is guaranteed not to contain a type variable.
func (*Inferrer) EnterScope ¶
func (v *Inferrer) EnterScope()
func (*Inferrer) Finalize ¶
func (v *Inferrer) Finalize()
Finalize runs the actual unification, sets default types in cases where these are needed, and sets the inferred types on the expressions.
func (*Inferrer) GetDiscardingId ¶
func (*Inferrer) HandleExpr ¶
func (*Inferrer) Solve ¶
func (v *Inferrer) Solve() []*Constraint
Solve solves the constraints using the unification algorithm.
func (*Inferrer) SolveStep ¶
func (v *Inferrer) SolveStep(stackIn []*Constraint, subsIn []*Constraint, addSubs bool, element *Constraint) (stack []*Constraint, substitutions []*Constraint)
type InterfaceType ¶
type InterfaceType struct { Functions []*Function GenericParameters GenericSigil // contains filtered or unexported fields }
func (InterfaceType) ActualType ¶
func (v InterfaceType) ActualType() Type
func (InterfaceType) Attrs ¶
func (v InterfaceType) Attrs() parser.AttrGroup
func (InterfaceType) CanCastTo ¶
func (v InterfaceType) CanCastTo(t Type) bool
func (InterfaceType) Equals ¶
func (v InterfaceType) Equals(t Type) bool
func (InterfaceType) GetFunction ¶
func (v InterfaceType) GetFunction(name string) *Function
func (InterfaceType) IsFloatingType ¶
func (v InterfaceType) IsFloatingType() bool
func (InterfaceType) IsIntegerType ¶
func (v InterfaceType) IsIntegerType() bool
func (InterfaceType) IsSigned ¶
func (v InterfaceType) IsSigned() bool
func (InterfaceType) IsVoidType ¶
func (v InterfaceType) IsVoidType() bool
func (InterfaceType) LevelsOfIndirection ¶
func (v InterfaceType) LevelsOfIndirection() int
func (InterfaceType) MatchesMethods ¶
func (v InterfaceType) MatchesMethods(methods []*Function) bool
func (InterfaceType) MatchesType ¶
func (v InterfaceType) MatchesType(t Type) bool
func (InterfaceType) String ¶
func (v InterfaceType) String() string
func (InterfaceType) TypeName ¶
func (v InterfaceType) TypeName() string
type LambdaExpr ¶
type LambdaExpr struct { Function *Function // contains filtered or unexported fields }
func (LambdaExpr) GetType ¶
func (v LambdaExpr) GetType() *TypeReference
func (LambdaExpr) NodeName ¶
func (v LambdaExpr) NodeName() string
func (LambdaExpr) SetType ¶
func (_ LambdaExpr) SetType(t *TypeReference)
func (LambdaExpr) String ¶
func (v LambdaExpr) String() string
type LoopStat ¶
type LoopStat struct { LoopType LoopStatType Body *Block // LOOP_TYPE_CONDITIONAL Condition Expr // contains filtered or unexported fields }
type LoopStatType ¶
type LoopStatType int
const ( LOOP_TYPE_UNSET LoopStatType = iota LOOP_TYPE_INFINITE LOOP_TYPE_CONDITIONAL )
type MangleType ¶
type MangleType int
In case we support multiple name mangling schemes
const (
MANGLE_ARK_UNSTABLE MangleType = iota
)
type MatchStat ¶
type Module ¶
type Module struct { Name *ModuleName ModScope *Scope Dirpath string Trees []*parser.ParseTree Parts map[string]*Submodule LinkedLibraries []string // contains filtered or unexported fields }
func (Module) MangledName ¶
func (v Module) MangledName(typ MangleType) string
type ModuleLookup ¶
type ModuleLookup struct { Name string Module *Module Children map[string]*ModuleLookup }
func NewModuleLookup ¶
func NewModuleLookup(name string) *ModuleLookup
func (*ModuleLookup) Create ¶
func (v *ModuleLookup) Create(name *ModuleName) *ModuleLookup
func (*ModuleLookup) Dump ¶
func (v *ModuleLookup) Dump(i int)
func (*ModuleLookup) Get ¶
func (v *ModuleLookup) Get(name *ModuleName) (*ModuleLookup, error)
type ModuleName ¶
type ModuleName struct {
Parts []string
}
func JoinModuleName ¶
func JoinModuleName(modName *ModuleName, part string) *ModuleName
func ModuleNameFromUnresolvedName ¶
func ModuleNameFromUnresolvedName(unresName UnresolvedName) *ModuleName
func NewModuleName ¶
func NewModuleName(node *parser.NameNode) *ModuleName
func (*ModuleName) Last ¶
func (v *ModuleName) Last() string
func (*ModuleName) String ¶
func (v *ModuleName) String() string
func (*ModuleName) ToPath ¶
func (v *ModuleName) ToPath() string
type NamedType ¶
type NamedType struct { Name string Type Type ParentModule *Module Methods []*Function StaticMethods []*Function }
func (*NamedType) ActualType ¶
func (*NamedType) GetStaticMethod ¶
func (*NamedType) IsFloatingType ¶
func (*NamedType) IsIntegerType ¶
func (*NamedType) IsVoidType ¶
func (*NamedType) LevelsOfIndirection ¶
type NodeSet ¶
type NodeSet []*DependencyNode
type NumericLiteral ¶
type NumericLiteral struct { IntValue *big.Int FloatValue float64 IsFloat bool Type *TypeReference // contains filtered or unexported fields }
NumericLiteral
func (NumericLiteral) AsFloat ¶
func (v NumericLiteral) AsFloat() float64
func (NumericLiteral) AsInt ¶
func (v NumericLiteral) AsInt() uint64
func (NumericLiteral) GetType ¶
func (v NumericLiteral) GetType() *TypeReference
func (NumericLiteral) NodeName ¶
func (_ NumericLiteral) NodeName() string
func (NumericLiteral) String ¶
func (v NumericLiteral) String() string
type PointerToExpr ¶
func (PointerToExpr) GetType ¶
func (v PointerToExpr) GetType() *TypeReference
func (PointerToExpr) NodeName ¶
func (_ PointerToExpr) NodeName() string
func (PointerToExpr) SetType ¶
func (_ PointerToExpr) SetType(t *TypeReference)
func (PointerToExpr) String ¶
func (v PointerToExpr) String() string
type PointerType ¶
type PointerType struct { Addressee *TypeReference IsMutable bool }
func PointerTo ¶
func PointerTo(t *TypeReference, mutable bool) PointerType
IMPORTANT: Using this function is no longer important, just make sure to use .Equals() to compare two types.
func (PointerType) ActualType ¶
func (v PointerType) ActualType() Type
func (PointerType) Attrs ¶
func (v PointerType) Attrs() parser.AttrGroup
func (PointerType) CanCastTo ¶
func (v PointerType) CanCastTo(t Type) bool
func (PointerType) Equals ¶
func (v PointerType) Equals(t Type) bool
func (PointerType) IsFloatingType ¶
func (v PointerType) IsFloatingType() bool
func (PointerType) IsIntegerType ¶
func (v PointerType) IsIntegerType() bool
func (PointerType) IsSigned ¶
func (v PointerType) IsSigned() bool
func (PointerType) IsVoidType ¶
func (v PointerType) IsVoidType() bool
func (PointerType) LevelsOfIndirection ¶
func (v PointerType) LevelsOfIndirection() int
func (PointerType) TypeName ¶
func (v PointerType) TypeName() string
type PrimitiveType ¶
type PrimitiveType int
const ( PRIMITIVE_s8 PrimitiveType = iota PRIMITIVE_s16 PRIMITIVE_s32 PRIMITIVE_s64 PRIMITIVE_s128 PRIMITIVE_u8 PRIMITIVE_u16 PRIMITIVE_u32 PRIMITIVE_u64 PRIMITIVE_u128 PRIMITIVE_f32 PRIMITIVE_f64 PRIMITIVE_f128 PRIMITIVE_int PRIMITIVE_uint PRIMITIVE_uintptr PRIMITIVE_bool PRIMITIVE_void )
func (PrimitiveType) ActualType ¶
func (v PrimitiveType) ActualType() Type
func (PrimitiveType) Attrs ¶
func (v PrimitiveType) Attrs() parser.AttrGroup
func (PrimitiveType) CanCastTo ¶
func (v PrimitiveType) CanCastTo(t Type) bool
func (PrimitiveType) Equals ¶
func (v PrimitiveType) Equals(t Type) bool
func (PrimitiveType) IsFloatingType ¶
func (v PrimitiveType) IsFloatingType() bool
func (PrimitiveType) IsIntegerType ¶
func (v PrimitiveType) IsIntegerType() bool
func (PrimitiveType) IsSigned ¶
func (v PrimitiveType) IsSigned() bool
func (PrimitiveType) IsVoidType ¶
func (v PrimitiveType) IsVoidType() bool
func (PrimitiveType) LevelsOfIndirection ¶
func (v PrimitiveType) LevelsOfIndirection() int
func (PrimitiveType) String ¶
func (i PrimitiveType) String() string
func (PrimitiveType) TypeName ¶
func (v PrimitiveType) TypeName() string
type PublicHandler ¶
type PublicHandler struct {
// contains filtered or unexported fields
}
func (PublicHandler) IsPublic ¶
func (v PublicHandler) IsPublic() bool
func (*PublicHandler) SetPublic ¶
func (v *PublicHandler) SetPublic(b bool)
type ReferenceToExpr ¶
type ReferenceToExpr struct { IsMutable bool Access Expr // contains filtered or unexported fields }
func (ReferenceToExpr) GetType ¶
func (v ReferenceToExpr) GetType() *TypeReference
func (ReferenceToExpr) NodeName ¶
func (_ ReferenceToExpr) NodeName() string
func (ReferenceToExpr) SetType ¶
func (_ ReferenceToExpr) SetType(t *TypeReference)
func (ReferenceToExpr) String ¶
func (v ReferenceToExpr) String() string
type ReferenceType ¶
type ReferenceType struct { Referrer *TypeReference // TODO rename to Element IsMutable bool }
func ReferenceTo ¶
func ReferenceTo(t *TypeReference, mutable bool) ReferenceType
func (ReferenceType) ActualType ¶
func (v ReferenceType) ActualType() Type
func (ReferenceType) Attrs ¶
func (v ReferenceType) Attrs() parser.AttrGroup
func (ReferenceType) CanCastTo ¶
func (v ReferenceType) CanCastTo(t Type) bool
func (ReferenceType) Equals ¶
func (v ReferenceType) Equals(t Type) bool
func (ReferenceType) IsFloatingType ¶
func (v ReferenceType) IsFloatingType() bool
func (ReferenceType) IsIntegerType ¶
func (v ReferenceType) IsIntegerType() bool
func (ReferenceType) IsSigned ¶
func (v ReferenceType) IsSigned() bool
func (ReferenceType) IsVoidType ¶
func (v ReferenceType) IsVoidType() bool
func (ReferenceType) LevelsOfIndirection ¶
func (v ReferenceType) LevelsOfIndirection() int
func (ReferenceType) TypeName ¶
func (v ReferenceType) TypeName() string
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func (*Resolver) EnterScope ¶
func (v *Resolver) EnterScope()
func (*Resolver) ResolveDescent ¶
func (v *Resolver) ResolveDescent()
func (*Resolver) ResolveNode ¶
func (*Resolver) ResolveTopLevelDecls ¶
func (v *Resolver) ResolveTopLevelDecls()
func (*Resolver) ResolveTypeReference ¶
func (v *Resolver) ResolveTypeReference(src Locatable, t *TypeReference) *TypeReference
func (*Resolver) ResolveTypeReferences ¶
func (v *Resolver) ResolveTypeReferences(src Locatable, ts []*TypeReference) []*TypeReference
func (*Resolver) ResolveUsedModules ¶
func (v *Resolver) ResolveUsedModules()
type ReturnStat ¶
type ReturnStat struct { Value Expr // contains filtered or unexported fields }
func (ReturnStat) NodeName ¶
func (_ ReturnStat) NodeName() string
func (ReturnStat) String ¶
func (v ReturnStat) String() string
type RuneLiteral ¶
type RuneLiteral struct { Value rune // contains filtered or unexported fields }
func (RuneLiteral) GetType ¶
func (v RuneLiteral) GetType() *TypeReference
func (RuneLiteral) NodeName ¶
func (_ RuneLiteral) NodeName() string
func (RuneLiteral) SetType ¶
func (_ RuneLiteral) SetType(t *TypeReference)
func (RuneLiteral) String ¶
func (v RuneLiteral) String() string
type Scope ¶
type Scope struct { Outer *Scope Idents map[string]*Ident Module *Module // module this scope belongs to, nil if builtin Function *Function // function this scope is inside, nil if global/builtin/etc UsedModules map[string]*Module }
func NewGlobalScope ¶
func (*Scope) GetIdent ¶
func (v *Scope) GetIdent(name UnresolvedName) *Ident
func (*Scope) InsertIdent ¶
func (*Scope) UseModuleAs ¶
type Side ¶
type Side struct { SideType SideType Id int Type *TypeReference }
Side represents a single side of a constraint. It represents either a type (TypeSide) or a type variable (IdentSide)
func SideFromType ¶
func SideFromType(t *TypeReference) Side
SideFromType creates a new Side from the given type. If the given type is a TypeVariable an IdentSide will be created, otherwise a TypeSide will be created.
type SizeofExpr ¶
type SizeofExpr struct { Expr Expr Type *TypeReference // contains filtered or unexported fields }
func (SizeofExpr) GetType ¶
func (v SizeofExpr) GetType() *TypeReference
func (SizeofExpr) NodeName ¶
func (_ SizeofExpr) NodeName() string
func (SizeofExpr) SetType ¶
func (_ SizeofExpr) SetType(t *TypeReference)
func (SizeofExpr) String ¶
func (v SizeofExpr) String() string
type StringLiteral ¶
type StringLiteral struct { Value string IsCString bool Type *TypeReference // contains filtered or unexported fields }
func (StringLiteral) GetType ¶
func (v StringLiteral) GetType() *TypeReference
func (StringLiteral) NodeName ¶
func (_ StringLiteral) NodeName() string
func (StringLiteral) String ¶
func (v StringLiteral) String() string
type StructAccessExpr ¶
type StructAccessExpr struct { Struct AccessExpr Member string GenericArguments []*TypeReference // TODO check no gen args if variable, not function // Needed for when we convert an struct access to function access ParentFunction *Function // contains filtered or unexported fields }
StructAccessExpr
func (StructAccessExpr) GetType ¶
func (v StructAccessExpr) GetType() *TypeReference
func (StructAccessExpr) Mutable ¶
func (v StructAccessExpr) Mutable() bool
func (StructAccessExpr) NodeName ¶
func (_ StructAccessExpr) NodeName() string
func (StructAccessExpr) SetType ¶
func (_ StructAccessExpr) SetType(t *TypeReference)
func (StructAccessExpr) String ¶
func (v StructAccessExpr) String() string
type StructMember ¶
type StructMember struct { Name string Public bool Type *TypeReference // contains filtered or unexported fields }
type StructType ¶
type StructType struct { Module *Module Members []*StructMember GenericParameters GenericSigil // contains filtered or unexported fields }
func (StructType) ActualType ¶
func (v StructType) ActualType() Type
func (StructType) Attrs ¶
func (v StructType) Attrs() parser.AttrGroup
func (StructType) CanCastTo ¶
func (v StructType) CanCastTo(t Type) bool
func (StructType) Equals ¶
func (v StructType) Equals(t Type) bool
func (StructType) GetMember ¶
func (v StructType) GetMember(name string) *StructMember
func (StructType) IsFloatingType ¶
func (v StructType) IsFloatingType() bool
func (StructType) IsIntegerType ¶
func (v StructType) IsIntegerType() bool
func (StructType) IsSigned ¶
func (v StructType) IsSigned() bool
func (StructType) IsVoidType ¶
func (v StructType) IsVoidType() bool
func (StructType) LevelsOfIndirection ¶
func (v StructType) LevelsOfIndirection() int
func (StructType) MemberIndex ¶
func (v StructType) MemberIndex(name string) int
func (StructType) String ¶
func (v StructType) String() string
func (StructType) TypeName ¶
func (v StructType) TypeName() string
type Submodule ¶
type Submodule struct { Parent *Module UseScope *Scope File *lexer.Sourcefile Nodes []Node // contains filtered or unexported fields }
type SubstitutionType ¶
type SubstitutionType struct { Name string Constraints []*TypeReference // should be all interface type references // contains filtered or unexported fields }
SubstitutionType
func NewSubstitutionType ¶
func NewSubstitutionType(name string, constraints []*TypeReference) *SubstitutionType
func (*SubstitutionType) ActualType ¶
func (v *SubstitutionType) ActualType() Type
func (*SubstitutionType) Attrs ¶
func (v *SubstitutionType) Attrs() parser.AttrGroup
func (*SubstitutionType) CanCastTo ¶
func (v *SubstitutionType) CanCastTo(t Type) bool
func (*SubstitutionType) Equals ¶
func (v *SubstitutionType) Equals(t Type) bool
func (*SubstitutionType) IsFloatingType ¶
func (v *SubstitutionType) IsFloatingType() bool
func (*SubstitutionType) IsIntegerType ¶
func (v *SubstitutionType) IsIntegerType() bool
func (*SubstitutionType) IsSigned ¶
func (v *SubstitutionType) IsSigned() bool
func (*SubstitutionType) IsVoidType ¶
func (v *SubstitutionType) IsVoidType() bool
func (*SubstitutionType) LevelsOfIndirection ¶
func (v *SubstitutionType) LevelsOfIndirection() int
func (*SubstitutionType) String ¶
func (v *SubstitutionType) String() string
func (*SubstitutionType) TypeName ¶
func (v *SubstitutionType) TypeName() string
type TupleLiteral ¶
type TupleLiteral struct { Members []Expr Type *TypeReference ParentEnumLiteral *EnumLiteral // only non-nil if this part of an enum literal // contains filtered or unexported fields }
func (TupleLiteral) GetType ¶
func (v TupleLiteral) GetType() *TypeReference
func (TupleLiteral) NodeName ¶
func (_ TupleLiteral) NodeName() string
func (TupleLiteral) String ¶
func (v TupleLiteral) String() string
type TupleType ¶
type TupleType struct {
Members []*TypeReference
}
func (TupleType) ActualType ¶
func (TupleType) IsFloatingType ¶
func (TupleType) IsIntegerType ¶
func (TupleType) IsVoidType ¶
func (TupleType) LevelsOfIndirection ¶
type Type ¶
type Type interface { TypeName() string LevelsOfIndirection() int // number of pointers you have to go through to get to the actual type IsIntegerType() bool // true for all int types IsFloatingType() bool // true for all floating-point types IsSigned() bool // true for all signed integer types CanCastTo(Type) bool // true if the receiver can be typecast to the parameter Attrs() parser.AttrGroup // fetches the attributes associated with the type Equals(Type) bool // compares whether two types are equal ActualType() Type // returns the actual type disregarding named types IsVoidType() bool }
func TypeWithoutPointers ¶
type TypeDecl ¶
type TypeDecl struct { PublicHandler NamedType *NamedType // contains filtered or unexported fields }
func (TypeDecl) DocComments ¶
func (v TypeDecl) DocComments() []*parser.DocComment
type TypeReference ¶
type TypeReference struct { BaseType Type GenericArguments []*TypeReference }
TODO fix up all the incorrect &TypeReference{...}
func AddChildren ¶
func AddChildren(typ *TypeReference, dest []*TypeReference) []*TypeReference
AddChildren adds the children of a type to the passed list
func NewTypeReference ¶
func NewTypeReference(typ Type, gargs []*TypeReference) *TypeReference
func SubsType ¶
func SubsType(typ *TypeReference, id int, what *TypeReference) *TypeReference
SubsType descends through a type and replaces all occurences of the given type variable by `what`
func TypeReferenceWithoutPointers ¶
func TypeReferenceWithoutPointers(t *TypeReference) *TypeReference
func (*TypeReference) ActualTypesEqual ¶
func (v *TypeReference) ActualTypesEqual(t *TypeReference) bool
func (*TypeReference) CanCastTo ¶
func (v *TypeReference) CanCastTo(t *TypeReference) bool
func (*TypeReference) Equals ¶
func (v *TypeReference) Equals(t *TypeReference) bool
func (TypeReference) String ¶
func (v TypeReference) String() string
type TypeVariable ¶
type TypeVariable struct { Id int // contains filtered or unexported fields }
TypeVariable is a type that abstracts the notion of a type variable such that we can use our existing types as part of constraints.
func (TypeVariable) ActualType ¶
func (v TypeVariable) ActualType() Type
func (TypeVariable) Equals ¶
func (v TypeVariable) Equals(other Type) bool
func (TypeVariable) IsFloatingType ¶
func (v TypeVariable) IsFloatingType() bool
func (TypeVariable) IsIntegerType ¶
func (v TypeVariable) IsIntegerType() bool
func (TypeVariable) IsVoidType ¶
func (v TypeVariable) IsVoidType() bool
func (TypeVariable) LevelsOfIndirection ¶
func (v TypeVariable) LevelsOfIndirection() int
func (TypeVariable) String ¶
func (v TypeVariable) String() string
func (TypeVariable) TypeName ¶
func (v TypeVariable) TypeName() string
type Typed ¶
type Typed interface { GetType() *TypeReference SetType(*TypeReference) }
type UnaryExpr ¶
type UnaryExpr struct { Expr Expr Op parser.UnOpType Type *TypeReference // contains filtered or unexported fields }
func (UnaryExpr) GetType ¶
func (v UnaryExpr) GetType() *TypeReference
type UnresolvedName ¶
func (UnresolvedName) Split ¶
func (v UnresolvedName) Split() (UnresolvedName, string)
func (UnresolvedName) String ¶
func (v UnresolvedName) String() string
type UnresolvedType ¶
type UnresolvedType struct { Name UnresolvedName // contains filtered or unexported fields }
UnresolvedType
func (UnresolvedType) ActualType ¶
func (v UnresolvedType) ActualType() Type
func (UnresolvedType) Equals ¶
func (v UnresolvedType) Equals(t Type) bool
func (UnresolvedType) IsFloatingType ¶
func (v UnresolvedType) IsFloatingType() bool
func (UnresolvedType) IsIntegerType ¶
func (v UnresolvedType) IsIntegerType() bool
func (UnresolvedType) IsVoidType ¶
func (v UnresolvedType) IsVoidType() bool
func (UnresolvedType) LevelsOfIndirection ¶
func (v UnresolvedType) LevelsOfIndirection() int
func (UnresolvedType) String ¶
func (v UnresolvedType) String() string
func (UnresolvedType) TypeName ¶
func (v UnresolvedType) TypeName() string
type UseDirective ¶
type UseDirective struct { ModuleName UnresolvedName // contains filtered or unexported fields }
func (UseDirective) NodeName ¶
func (_ UseDirective) NodeName() string
func (UseDirective) String ¶
func (v UseDirective) String() string
type Variable ¶
type Variable struct { Type *TypeReference Name string Mutable bool Attrs parser.AttrGroup ParentStruct StructType ParentModule *Module // Is the variable not from an variable decl IsImplicit bool }
func (Variable) GetType ¶
func (v Variable) GetType() *TypeReference
func (Variable) MangledName ¶
func (v Variable) MangledName(typ MangleType) string
type VariableAccessExpr ¶
type VariableAccessExpr struct { Name UnresolvedName Variable *Variable GenericArguments []*TypeReference // TODO check no gen args if variable, not function // contains filtered or unexported fields }
VariableAccessExpr
func (VariableAccessExpr) GetType ¶
func (v VariableAccessExpr) GetType() *TypeReference
func (VariableAccessExpr) Mutable ¶
func (v VariableAccessExpr) Mutable() bool
func (VariableAccessExpr) NodeName ¶
func (_ VariableAccessExpr) NodeName() string
func (VariableAccessExpr) SetType ¶
func (_ VariableAccessExpr) SetType(t *TypeReference)
func (VariableAccessExpr) String ¶
func (v VariableAccessExpr) String() string
type VariableDecl ¶
type VariableDecl struct { PublicHandler Variable *Variable Assignment Expr // contains filtered or unexported fields }
func (VariableDecl) DocComments ¶
func (v VariableDecl) DocComments() []*parser.DocComment
func (VariableDecl) NodeName ¶
func (_ VariableDecl) NodeName() string
func (VariableDecl) String ¶
func (v VariableDecl) String() string