Skip to content

std/jule/sema ​

Index ​

Variables
fn AnalyzePackage(mut files: []&ast::AST, mut importer: Importer, flags: int): (&Package, []log::Log)
fn AnalyzeFile(mut f: &ast::AST, mut importer: Importer, flags: int): (&SymTab, []log::Log)
trait Importer
trait Lookup
trait Kind
struct Enum
    fn String(*self): string
    fn Equal(&self, other: &Type): bool
    fn FindItem(mut *self, name: string): &Var
struct TypeEnumItem
struct TypeEnum
    fn String(*self): string
    fn Equal(&self, other: &Type): bool
struct Value
    fn IsNil(*self): bool
    fn IsVoid(*self): bool
    fn IsConst(*self): bool
    fn GoodOperand(*self, mut other: &Value): bool
type Flag
struct ReturnType
struct Param
    fn IsSelf(*self): bool
    fn IsSmartptr(*self): bool
    fn IsRefptr(*self): bool
struct Func
    fn IsVoid(*self): bool
    fn IsMethod(*self): bool
    fn IsEntryPoint(*self): bool
    fn IsInit(*self): bool
    fn IsAnon(*self): bool
    fn AnyVar(*self): bool
struct ParamIns
    fn String(*self): string
struct FuncIns
    fn String(*self): string
    fn Equal(&self, other: &Type): bool
    fn EqualFunc(&self, f: &FuncIns, responsive: bool): bool
    fn Types(mut *self): []&Type
    fn IsBuiltin(*self): bool
    fn IsAnon(*self): bool
    fn Same(*self, f: &FuncIns): bool
    fn GetKindString(*self, name: bool): string
struct ImportInfo
    fn SelectPackage(mut *self, fn(&ImportInfo): bool): &ImportInfo
    fn FindVar(mut *self, name: string, _: bool): &Var
    fn FindTypeAlias(mut *self, name: string, _: bool): &TypeAlias
    fn FindStruct(mut *self, name: string, _: bool): &Struct
    fn FindFunc(mut *self, name: string, _: bool): &Func
    fn FindTrait(mut *self, name: string): &Trait
    fn FindEnum(mut *self, name: string): &Enum
    fn FindTypeEnum(mut *self, name: string): &TypeEnum
struct OperandExpr
struct BinaryExpr
struct UnaryExpr
struct StructArgExpr
struct StructLitExpr
struct AllocStructLitExpr
struct CastingExpr
struct TypeAssertionExpr
struct FuncCallExpr
struct SliceExpr
struct IndexingExpr
struct AnonFuncExpr
struct KeyValueExpr
struct MapExpr
struct SlicingExpr
struct TraitSubIdentExpr
struct StructSubIdentExpr
struct StructStaticIdentExpr
struct ArrayExpr
struct TupleExpr
struct BuiltinPrintCallExpr
struct BuiltinPrintlnCallExpr
struct BuiltinNewCallExpr
struct BuiltinPanicCallExpr
struct ChanRecv
struct ChanSend
struct BuiltinCloseCallExpr
struct BuiltinMakeCallExpr
struct BuiltinAppendCallExpr
struct BuiltinLenCallExpr
struct BuiltinCapCallExpr
struct BuiltinDeleteCallExpr
struct BuiltinCopyCallExpr
struct BuiltinRealCallExpr
struct BuiltinImagCallExpr
struct BuiltinCmplxCallExpr
struct BuiltinFutureCallExpr
struct BuiltinReadyCallExpr
struct BuiltinClearCallExpr
struct SizeofExpr
struct AlignofExpr
struct RuneExpr
struct BackendEmitExpr
struct AddrcallExpr
struct Package
    fn SelectPackage(mut *self, fn(&ImportInfo): bool): &ImportInfo
    fn FindVar(mut *self, name: string, _extern: bool): &Var
    fn FindTypeAlias(mut *self, name: string, _extern: bool): &TypeAlias
    fn FindStruct(mut *self, name: string, _extern: bool): &Struct
    fn FindFunc(mut *self, name: string, _extern: bool): &Func
    fn FindTrait(mut *self, name: string): &Trait
    fn FindEnum(mut *self, name: string): &Enum
    fn FindTypeEnum(mut *self, name: string): &TypeEnum
struct FuncPattern
    fn Main(f: &Func): bool
    fn Init(f: &Func): bool
    fn String(f: &Func): bool
    fn ReadyParam(mut p: &ParamIns): bool
type ScopeTrait
struct Scope
struct Use
struct If
struct Else
struct Conditional
struct InfIter
struct WhileIter
    fn IsWhileNext(*self): bool
struct RangeIter
struct Continue
struct Break
struct Throw
struct Label
type Direction
struct Goto
struct Postfix
struct Assign
struct MultiAssign
struct Match
    fn IsGenericTypeMatch(*self): bool
struct Select
struct Case
struct Fall
struct Return
struct Field
struct Struct
    fn FindMethod(mut *self, name: string, _static: bool): &Func
    fn FindField(mut *self, name: string): &Field
    fn IsImplements(*self, t: &Trait): bool
    fn HasRefAccessible(*self): bool
struct FieldIns
struct StructIns
    fn String(*self): string
    fn Equal(&self, other: &Type): bool
    fn Same(*self, s: &StructIns): bool
    fn FindMethod(mut *self, name: string, _static: bool): &Func
    fn FindField(mut *self, name: string): &FieldIns
struct ReferenceStack
    fn Len(*self): int
    fn At(mut *self, i: int): any
    fn Push(mut *self, mut ref: any)
    fn Exist[T](*self, t: T): bool
struct Pass
struct SymTab
    fn SelectPackage(mut *self, selector: fn(&ImportInfo): bool): &ImportInfo
    fn FindVar(mut *self, name: string, _extern: bool): &Var
    fn FindTypeAlias(mut *self, name: string, _extern: bool): &TypeAlias
    fn FindStruct(mut *self, name: string, _extern: bool): &Struct
    fn FindFunc(mut *self, name: string, _extern: bool): &Func
    fn FindTrait(mut *self, name: string): &Trait
    fn FindEnum(mut *self, name: string): &Enum
    fn FindTypeEnum(mut *self, name: string): &TypeEnum
struct Trait
    fn String(*self): string
    fn Equal(&self, other: &Type): bool
    fn FindMethod(mut *self, name: string): &Func
struct ConstraintMask
    fn String(*self): string
struct InsGeneric
struct TypeAlias
struct Type
    fn String(*self): string
    fn Equal(&self, other: &Type): bool
    fn Extern(*self): bool
    fn IsNil(*self): bool
    fn Void(*self): bool
    fn ActualKind(mut *self): Kind
    fn ActualEqual(&self, other: &Type): bool
    fn Comparable(*self): bool
    fn Mutable(*self): bool
    fn Ordered(*self): bool
    fn NilCompatible(*self): bool
    fn GC(*self): bool
    fn Variadicable(*self): bool
    fn Prim(mut *self): &Prim
    fn Chan(mut *self): &Chan
    fn Sptr(mut *self): &Sptr
    fn Ptr(mut *self): &Ptr
    fn Enum(mut *self): &Enum
    fn TypeEnum(mut *self): &TypeEnum
    fn Array(mut *self): &Array
    fn Slice(mut *self): &Slice
    fn Func(mut *self): &FuncIns
    fn Struct(mut *self): &StructIns
    fn SoftStruct(mut *self): &StructIns
    fn Trait(mut *self): &Trait
    fn Map(mut *self): &Map
    fn Tuple(mut *self): &Tuple
struct Prim
    fn String(*self): string
    fn Equal(&self, other: &Type): bool
    fn IsConstraint(*self): bool
    fn IsI8(*self): bool
    fn IsI16(*self): bool
    fn IsI32(*self): bool
    fn IsI64(*self): bool
    fn IsU8(*self): bool
    fn IsU16(*self): bool
    fn IsU32(*self): bool
    fn IsU64(*self): bool
    fn IsF32(*self): bool
    fn IsF64(*self): bool
    fn IsCmplx64(*self): bool
    fn IsCmplx128(*self): bool
    fn IsInt(*self): bool
    fn IsUint(*self): bool
    fn IsUintptr(*self): bool
    fn IsBool(*self): bool
    fn IsString(*self): bool
    fn IsAny(*self): bool
struct Chan
    fn String(*self): string
    fn Equal(&self, other: &Type): bool
struct Sptr
    fn String(*self): string
    fn Equal(&self, other: &Type): bool
struct Slice
    fn String(*self): string
    fn Equal(&self, other: &Type): bool
struct Tuple
    fn String(*self): string
    fn Equal(&self, other: &Type): bool
struct Map
    fn String(*self): string
    fn Equal(&self, other: &Type): bool
struct Array
    fn String(*self): string
    fn Equal(&self, other: &Type): bool
struct Ptr
    fn String(*self): string
    fn Equal(&self, other: &Type): bool
    fn IsUnsafe(*self): bool
struct Var
    fn IsInitialized(*self): bool
    fn IsTypeInferred(*self): bool
    fn IsEnumField(*self): bool
enum FuncOwner: type
enum Expr: type
enum Stmt: type
enum CaseOwner: type
enum RetState

Variables ​

jule
const (
	Default   = 1 << iota // Default semantic analysis of Jule.
	Shadowing             // Default + enable shadowing.
)

Flags for semantic analysis.


jule
const (
	F_USED = 1 << iota
	F_VARIADIC
	F_GENERIC
	F_MUTABLE
	F_COMPARABLE
	F_HAS_DEFER
	F_ANON
	F_AS_ANON
	F_CALLED_SPAWN
	F_IOTA
	F_CONST
	F_TYPE
	F_FUTURE
	F_READY

	// Internal sema flags.
	// This flags may be passed without documentation.
	F_CHECKED
	F_RELOADED
	F_ONELINER
)

Flags for Flag.


jule
const (
	// Scope is deferred.
	ST_DEFER: ScopeTrait = 1 << iota

	// Scope is unsafe.
	ST_UNSAFE

	// Scope is an infinite scope.
	// This passed when scope owner is exactly and infinite iteration,
	// or while-next iteration with no condition.
	ST_INFINITE

	// Scope is an error handling scope.
	ST_ERROR_HANDLER
)

Scope traits.


jule
const (
	UP: Direction = iota
	DOWN
)

Directions.

AnalyzePackage ​

jule
fn AnalyzePackage(mut files: []&ast::AST, mut importer: Importer, flags: int): (&Package, []log::Log)

Builds symbol table of package's ASTs. Returns nil if files is nil. Returns nil if pwd is empty. Returns nil if pstd is empty. Accepts current working directory is pwd.

Parameters:

files:    abstract syntax trees of files
importer: importer that used for use declarations

Dependent Parameters:

working-directory: uses working directory path provided by build
std-path:          uses standard library path provided by build

Constraints:

  • importer's main package path should be set.
  • importer's module must be point to the package's module, if exist.

Risks:

You can pass nil to importer, but panics if importer is nil and
semantic analyzer used nil importer.

AnalyzeFile ​

jule
fn AnalyzeFile(mut f: &ast::AST, mut importer: Importer, flags: int): (&SymTab, []log::Log)

Same as [AnalyzePackage], but it takes a singe file.

Importer ​

jule
trait Importer {
	// Returns FileSet by ID.
	// Returns nil if ID is not matched with any FileSet.
	fn GetFileSet(mut *self, id: int): &token::FileSet

	// Reports whether the build tag is defined.
	fn HasTag(mut *self, tag: string): bool

	// Set current module.
	// Set to nil if module is not exist.
	fn SetMod(mut *self, mut mod: &mod::Mod)

	// Returns current module.
	// Returns nil if module is not exist.
	fn GetMod(mut *self): &mod::Mod

	// Returns module by ID.
	fn ModByID(mut *self, id: mod::ID): &mod::Mod

	// Registers the current module.
	// Sets the module identity to a valid ID and
	// then registers it as a used module.
	//
	// If the current module is nil, then it does nothing.
	// If the current module is already registered, then it does nothing.
	fn RegisterMod(mut *self)

	// Sets path as the main package path.
	fn SetMainPackagePath(mut *self, path: string)

	// Returns the main package path, specified with [SetMainPackagePath].
	// The default value is empty string.
	fn GetMainPackagePath(mut *self): string

	// Returns &ImportInfo by path.
	// This function accepted as returns already imported and checked package.
	// If returns not-nil value, will be used instead of ImportPackage
	// if possible and package content is not checked by Sema.
	fn GetImport(mut *self, path: string): &ImportInfo

	// Path is the directory path of package to import.
	// Should return abstract syntax tree of package files.
	// Logs accepts as error.
	// Updates module to package's module if exist when updateMod is true.
	// But the module and package will not be registered.
	// Package and module can be registered with [Imported].
	// For only module, it can be registered with [RegisterMod].
	//
	// The module identity will be invalid ID.
	// The [Imported] or [RegisterMod] will assign a valid ID when registered.
	fn ImportPackage(mut *self, path: string, updateMod: bool): ([]&ast::AST, []log::Log)

	// Invoke after the package is imported.
	// Registers package as an imported and used package.
	// If the current module is not registered, sets module identitity and
	// register it as used modules.
	fn Imported(mut *self, mut &ImportInfo)

	// Returns all imported packages.
	// The return value may be mutable reference to the internal buffer.
	// Packages should be ordered by FIFO; starting with the first deepest
	// imported package, and ending with the last imported package.
	fn AllPackages(mut *self): []&ImportInfo

	// Returns File by path.
	// This function accepted as returns already included file.
	// If returns not-nil value, will be used instead of IncludeFile if possible.
	fn GetFile(mut *self, path: string): resource::File

	// Includes the file by path, returns nil if failed.
	fn IncludeFile(mut *self, path: string): resource::File

	// Invoked after the file is included.
	fn IncludedFile(mut *self, mut file: resource::File)
}

Package importer for the semantic analysis. Used by semantic analysis to import use declarations. The default importer implementation is highly recommended. 3rd-party importer implementations may cause unpredictable issues.

Lookup ​

jule
trait Lookup {
	// Select imported package.
	// Returns nil if did not found any match.
	fn SelectPackage(mut *self, selector: fn(&ImportInfo): bool): &ImportInfo

	// Find variable by identifier and external state.
	// Returns nil if did not found any match.
	fn FindVar(mut *self, name: string, _extern: bool): &Var

	// Find type alias by identifier and external state.
	// Returns nil if did not found any match.
	fn FindTypeAlias(mut *self, name: string, _extern: bool): &TypeAlias

	// Find structure by identifier and external state.
	// Returns nil if did not found any match.
	fn FindStruct(mut *self, name: string, _extern: bool): &Struct

	// Find function by identifier and external state.
	// Returns nil if did not found any match.
	fn FindFunc(mut *self, name: string, _extern: bool): &Func

	// Find trait by identifier.
	// Returns nil if did not found any match.
	fn FindTrait(mut *self, name: string): &Trait

	// Find enum by identifier.
	// Returns nil if did not found any match.
	fn FindEnum(mut *self, name: string): &Enum

	// Find type enum by identifier.
	// Returns nil if did not found any match.
	fn FindTypeEnum(mut *self, name: string): &TypeEnum
}

Generic behavior of lookupable types. Typically it is a scope like global scope, function scope or etc.

Kind ​

jule
trait Kind {
	fn String(*self): string
	fn Equal(&self, other: &Type): bool
}

Kind of type declaration.

Enum ​

jule
struct Enum {
	AST: &ast::Enum

	FullName: string // See developer reference (16).
	Type:     &Type
	Items:    []&Var // See developer reference (14).

	// NOTE: contains filtered hidden or unexported fields
}

Enum.

Implemented Traits ​

  • Kind

String ​

jule
fn String(*self): string

Implement: Kind Returns Enum's identifier.

Equal ​

jule
fn Equal(&self, other: &Type): bool

Reports whether types are same.

FindItem ​

jule
fn FindItem(mut *self, name: string): &Var

Returns item by identifier. Returns nil if not exist any item in this identifier.

TypeEnumItem ​

jule
struct TypeEnumItem {
	AST:  &ast::TypeEnumItem
	Type: &Type
}

TypeEnum item.

TypeEnum ​

jule
struct TypeEnum {
	AST:      &ast::TypeEnum
	FullName: string // See developer reference (16).
	Items:    []&TypeEnumItem

	// NOTE: contains filtered hidden or unexported fields
}

TypeEnum.

Implemented Traits ​

  • Kind

String ​

jule
fn String(*self): string

Implement: Kind Returns TypeEnum's identifier.

Equal ​

jule
fn Equal(&self, other: &Type): bool

Reports whether types are same.

Value ​

jule
struct Value {
	Type:      &Type
	Mutable:   bool
	Reference: bool
	Lvalue:    bool
	IsRune:    bool
	Model:     Expr

	// True if kind is declaration such as:
	//	- &Enum
	//	- &Struct
	//	- int type
	//	- bool type
	// If this is true, Model might be nil or something.
	// Use the Type field to handle declaration type.
	Decl: bool

	// Constant expression data.
	Constant: &constant::Const
	// NOTE: contains filtered hidden or unexported fields
}

Value.

IsNil ​

jule
fn IsNil(*self): bool

Reports whether Value is nil literal.

IsVoid ​

jule
fn IsVoid(*self): bool

Reports whether Value is void.

IsConst ​

jule
fn IsConst(*self): bool

Reports whether Value is constant expression.

GoodOperand ​

jule
fn GoodOperand(*self, mut other: &Value): bool

See developer reference (9.2). Reports left and right operand is good order. If reports false, left and right operand should be swapped. Accepts itself as left operand.

Flag ​

jule
type Flag: uint

A commonf flagset for sema. May contain internal flags of semantic analysis.

ReturnType ​

jule
struct ReturnType {
	AST:  &ast::ReturnType
	Type: &Type
}

Return type.

Param ​

jule
struct Param {
	AST:  &ast::Param
	Type: &Type
}

Parameter.

IsSelf ​

jule
fn IsSelf(*self): bool

Reports whether parameter is self (receiver) parameter.

IsSmartptr ​

jule
fn IsSmartptr(*self): bool

Reports whether self (receiver) parameter is smart pointer.

IsRefptr ​

jule
fn IsRefptr(*self): bool

Reports whether self (receiver) parameter is reference pointer.

Func ​

jule
struct Func {
	AST: &ast::Func

	Result: &ReturnType
	Params: []&Param
	Owner:  FuncOwner

	// Function instances for each unique type combination of function call.
	// Nil if function is never used.
	Instances: []&FuncIns

	// Possible flags are:
	//	F_HAS_DEFER: if function has at least one deferred scope.
	//	F_FUTURE: if function is a #future
	//	F_READY: if function is a #ready
	Flags: Flag
	// NOTE: contains filtered hidden or unexported fields
}

Function.

IsVoid ​

jule
fn IsVoid(*self): bool

Reports whether return type is void.

IsMethod ​

jule
fn IsMethod(*self): bool

Reports whether function is method.

IsEntryPoint ​

jule
fn IsEntryPoint(*self): bool

Reports whether function is entry point.

IsInit ​

jule
fn IsInit(*self): bool

Reports whether function is initializer function.

IsAnon ​

jule
fn IsAnon(*self): bool

Reports whether function is anonymous function.

AnyVar ​

jule
fn AnyVar(*self): bool

Reports whether function has return variable(s).

ParamIns ​

jule
struct ParamIns {
	Decl: &Param
	Type: &Type
}

Parameter instance.

String ​

jule
fn String(*self): string

Implement: Kind Returns ParamIns's type kind as string.

FuncIns ​

jule
struct FuncIns {
	Owner:    &StructIns
	Decl:     &Func
	Generics: []&InsGeneric
	Params:   []&ParamIns
	Result:   &Type // Result type of the instance, nil for void.
	Scope:    &Scope
	Refers:   &ReferenceStack

	// Possible flags are:
	//	F_ANON: if function instance is an anonymous function literal
	//	F_AS_ANON: if function instance used as anonymous function
	//	F_CALLED_SPAWN: if function instance used for concurrent call
	Flags: Flag

	// NOTE: contains filtered hidden or unexported fields
}

Function instance.

Implemented Traits ​

  • Kind

String ​

jule
fn String(*self): string

Implement: Kind Returns function's type kind as string.

Equal ​

jule
fn Equal(&self, other: &Type): bool

Reports whether types are same.

EqualFunc ​

jule
fn EqualFunc(&self, f: &FuncIns, responsive: bool): bool

Reports whether functions are equal. If the responsive is true, checks by responsiveness of functions. See: https://manual.jule.dev/responsiveness/mutability

Types ​

jule
fn Types(mut *self): []&Type

Returns all types of result. Returns nil if result is nil. Returns mutable slice if returns internal slice.

IsBuiltin ​

jule
fn IsBuiltin(*self): bool

Reports whether instance is built-in.

IsAnon ​

jule
fn IsAnon(*self): bool

Reports whether instance is anonymous function.

Same ​

jule
fn Same(*self, f: &FuncIns): bool

Reports whether instances are same. Returns true if declarations and generics are same.

GetKindString ​

jule
fn GetKindString(*self, name: bool): string

Returns kind string of function instance. Appends identifier to kind of this instance. Does not appends identifier of this instance to kind if self.Decl is nil.

ImportInfo ​

jule
struct ImportInfo {
	// Declaration.
	Decl: &ast::Use

	// Absolute path.
	Path: string

	// Use declaration path string.
	// Quotes are not included.
	LinkPath: string

	// Package alias identifier.
	Alias: string

	// True if imported with Importer.GetImport function.
	Duplicate: bool

	// Is external use declaration.
	Extern: bool

	// Is standard library package.
	Std: bool

	// Nil if package is external header.
	Package: &Package

	// Module ID.
	ModID: mod::ID
}

Import information. Represents imported package by use declaration.

Implemented Traits ​

  • Lookup

SelectPackage ​

jule
fn SelectPackage(mut *self, fn(&ImportInfo): bool): &ImportInfo

Returns always nil.

FindVar ​

jule
fn FindVar(mut *self, name: string, _: bool): &Var

Returns variable by identifier and external state. Returns nil if not exist any variable in this identifier.

Lookups by import way such as identifier selection. Just lookups non-external defines.

FindTypeAlias ​

jule
fn FindTypeAlias(mut *self, name: string, _: bool): &TypeAlias

Returns type alias by identifier. Returns nil if not exist any type alias in this identifier.

Lookups by import way such as identifier selection. Just lookups non-external defines.

FindStruct ​

jule
fn FindStruct(mut *self, name: string, _: bool): &Struct

Returns struct by identifier and external state. Returns nil if not exist any struct in this identifier.

Lookups by import way such as identifier selection. Just lookups non-external defines.

FindFunc ​

jule
fn FindFunc(mut *self, name: string, _: bool): &Func

Returns function by identifier and external state. Returns nil if not exist any function in this identifier.

Lookups by import way such as identifier selection. Just lookups non-external defines.

FindTrait ​

jule
fn FindTrait(mut *self, name: string): &Trait

Returns trait by identifier. Returns nil if not exist any trait in this identifier.

Lookups by import way such as identifier selection.

FindEnum ​

jule
fn FindEnum(mut *self, name: string): &Enum

Returns enum by identifier. Returns nil if not exist any enum in this identifier.

Lookups by import way such as identifier selection.

FindTypeEnum ​

jule
fn FindTypeEnum(mut *self, name: string): &TypeEnum

Returns type enum by identifier. Returns nil if not exist any type enum in this identifier.

Lookups by import way such as identifier selection.

OperandExpr ​

jule
struct OperandExpr {
	Type:  &Type
	Model: Expr
}

Operand expression model.

BinaryExpr ​

jule
struct BinaryExpr {
	Left:  &OperandExpr
	Right: &OperandExpr
	Op:    &token::Token
}

Binary operation expression model.

UnaryExpr ​

jule
struct UnaryExpr {
	Expr: &Value
	Op:   &token::Token
}

Unary operation expression model.

StructArgExpr ​

jule
struct StructArgExpr {
	Token: &token::Token
	Field: &FieldIns
	Expr:  &Value
}

Structure field argument expression model for constructors. For example: &MyStruct{10, false, "-"}

StructLitExpr ​

jule
struct StructLitExpr {
	Strct: &StructIns
	Args:  []&StructArgExpr
}

Structure literal.

AllocStructLitExpr ​

jule
struct AllocStructLitExpr {
	Lit: &StructLitExpr
}

Heap allocated structure litral expression. For example: &MyStruct{}

CastingExpr ​

jule
struct CastingExpr {
	Token: &token::Token
	Expr:  &Value
	Type:  &Type
}

Casting expression model. For example: (int)(myFloat)

TypeAssertionExpr ​

jule
struct TypeAssertionExpr {
	Token: &token::Token
	Expr:  &Value
	Type:  &Type
}

Type assertion expression model. For example: myExpr.(destType)

FuncCallExpr ​

jule
struct FuncCallExpr {
	Token:    &token::Token
	Func:     &FuncIns
	IsSpawn:  bool
	Expr:     Expr
	Args:     []Expr
	Handler:  &Scope // Nil for ignored.
	Assigned: bool
}

Function call expression model.

SliceExpr ​

jule
struct SliceExpr {
	ElemType: &Type
	Elems:    []&Value
}

Slice expression model. For example: [1, 2, 3, 4, 5, 6, 8, 9, 10]

IndexingExpr ​

jule
struct IndexingExpr {
	Token: &token::Token
	Expr:  &Value
	Index: &Value
}

Indexing expression model. For example: slice[index]

AnonFuncExpr ​

jule
struct AnonFuncExpr {
	Captured: []&Var
	Func:     &FuncIns
	Global:   bool
}

Anonymous function expression model.

KeyValueExpr ​

jule
struct KeyValueExpr {
	Key:   Expr
	Value: Expr
}

Key-value expression pair model.

MapExpr ​

jule
struct MapExpr {
	Kind:    &Map
	Entries: []&KeyValueExpr
}

Map expression model. For example; {0: false, 1: true}

SlicingExpr ​

jule
struct SlicingExpr {
	Token: &token::Token

	// Expression to slicing.
	Expr: &Value

	// Left index expression.
	// Nil integer if expression have not left index.
	Left: Expr

	// Right index expression.
	// Nil if expression have not right index.
	Right: Expr

	// Cap index expression.
	// Nil if expression have not cap index.
	Cap: Expr
}

Slicing expression model. For example: mySlice[2:len(mySlice)-5]

TraitSubIdentExpr ​

jule
struct TraitSubIdentExpr {
	Token:  &token::Token
	Expr:   Expr
	Method: &Func
	Trt:    &Trait
}

Trait sub-ident expression model. For example: myTrait.subIdent

StructSubIdentExpr ​

jule
struct StructSubIdentExpr {
	Token:  &token::Token
	Expr:   &Value
	Method: &FuncIns
	Field:  &FieldIns
	Owner:  &StructIns
}

Structure sub-ident expression model. For example: myStruct.subIdent

StructStaticIdentExpr ​

jule
struct StructStaticIdentExpr {
	Structure: &StructIns
	Expr:      Expr
	Method:    &FuncIns
}

Structure static ident expression model. For example: MyStruct.mySubIdent

ArrayExpr ​

jule
struct ArrayExpr {
	Kind:  &Array
	Elems: []&Value
}

Array expression model. If array filled, elems field holds 2 data. First data is expression, second is nil, kind of mark to that array filled.

TupleExpr ​

jule
struct TupleExpr {
	Values: []&Value
}

Tuple expression model.

BuiltinPrintCallExpr ​

jule
struct BuiltinPrintCallExpr {
	Expr: &Value
}

Expression Model: for built-in print function calls.

BuiltinPrintlnCallExpr ​

jule
struct BuiltinPrintlnCallExpr {
	Expr: &Value
}

Expression Model: for built-in println function calls.

BuiltinNewCallExpr ​

jule
struct BuiltinNewCallExpr {
	Type: &Type // Element type of smart pointer.
	Init: Expr  // Nil for not initialized.
}

Expression Model: for built-in new function calls.

BuiltinPanicCallExpr ​

jule
struct BuiltinPanicCallExpr {
	Token: &token::Token
	Expr:  Expr
}

Expression Model: for built-in panic function calls.

ChanRecv ​

jule
struct ChanRecv {
	Token: &token::Token
	Expr:  &Value
}

Expression model: for channel receive.

ChanSend ​

jule
struct ChanSend {
	Token: &token::Token
	Chan:  &Value
	Data:  &Value
}

Expression mode: for channel send.

BuiltinCloseCallExpr ​

jule
struct BuiltinCloseCallExpr {
	Token: &token::Token
	Chan:  &Value
}

Expression Model: for built-in close function calls.

BuiltinMakeCallExpr ​

jule
struct BuiltinMakeCallExpr {
	Type: &Type
	Len:  &Value
	Cap:  &Value
}

Expression Model: for built-in make function calls. If Type is slice, the Len and Cap fields may be meaningful. If Type is channel, the buffer size specified in the Cap field if exist. The Len field is undefined for channel types.

BuiltinAppendCallExpr ​

jule
struct BuiltinAppendCallExpr {
	Dest:     &Value // Type is always slice.
	Elements: &Value // Type is always slice or string, no chance for variadic.
}

Expression Model: for built-in append function calls.

BuiltinLenCallExpr ​

jule
struct BuiltinLenCallExpr {
	Expr: &Value
}

Expression Model: for built-in len function calls.

BuiltinCapCallExpr ​

jule
struct BuiltinCapCallExpr {
	Expr: &Value
}

Expression Model: for built-in cap function calls.

BuiltinDeleteCallExpr ​

jule
struct BuiltinDeleteCallExpr {
	Dest: &Value
	Key:  &Value
}

Expression Model: for built-in delete function calls.

BuiltinCopyCallExpr ​

jule
struct BuiltinCopyCallExpr {
	Dest: &Value
	Src:  &Value
}

Expression Model: for built-in copy function calls.

BuiltinRealCallExpr ​

jule
struct BuiltinRealCallExpr {
	Cmplx: &Value
}

Expression Model: for built-in real function calls.

BuiltinImagCallExpr ​

jule
struct BuiltinImagCallExpr {
	Cmplx: &Value
}

Expression Model: for built-in imag function calls.

BuiltinCmplxCallExpr ​

jule
struct BuiltinCmplxCallExpr {
	Real: &Value
	Imag: &Value
}

Expression Model: for built-in cmplx function calls.

BuiltinFutureCallExpr ​

jule
struct BuiltinFutureCallExpr {
	Owner:   &FuncIns
	Ready:   &Value
	Suspend: &Value
}

Expression Model: for built-in future function calls.

BuiltinReadyCallExpr ​

jule
struct BuiltinReadyCallExpr {
	Status: &Value
}

Expression Model: for built-in ready function calls.

BuiltinClearCallExpr ​

jule
struct BuiltinClearCallExpr {
	Value: &Value
}

Expression Model: for built-in clear function calls.

SizeofExpr ​

jule
struct SizeofExpr {
	Expr: Expr
}

Expression Model: for sizeof expressions. For example, in C++: sizeof(int)

AlignofExpr ​

jule
struct AlignofExpr {
	Expr: Expr
}

Expression Model: for alignof expressions. For example, in C++: alignof(int)

RuneExpr ​

jule
struct RuneExpr {
	Code: rune
}

Rune literal expression model. For example: 'a'

BackendEmitExpr ​

jule
struct BackendEmitExpr {
	Code: string

	// Expression Model: for expression or type emit to backend from Jule source code.
	Exprs: []Expr
}

Expression Model: for inline code emit to backend.

AddrcallExpr ​

jule
struct AddrcallExpr {
	Addr:   &Value
	Args:   []&Value
	Result: &Type // Nil for void.
}

Expression Model: for address-based function call.

Package ​

jule
struct Package {
	// Symbol table for each package's file.
	Files: []&SymTab
}

Package.

Implemented Traits ​

  • Lookup

SelectPackage ​

jule
fn SelectPackage(mut *self, fn(&ImportInfo): bool): &ImportInfo

Returns always nil.

FindVar ​

jule
fn FindVar(mut *self, name: string, _extern: bool): &Var

Returns variable by identifier and external state. Returns nil if not exist any variable in this identifier.

FindTypeAlias ​

jule
fn FindTypeAlias(mut *self, name: string, _extern: bool): &TypeAlias

Returns type alias by identifier and external state. Returns nil if not exist any type alias in this identifier.

FindStruct ​

jule
fn FindStruct(mut *self, name: string, _extern: bool): &Struct

Returns struct by identifier and external state. Returns nil if not exist any struct in this identifier.

FindFunc ​

jule
fn FindFunc(mut *self, name: string, _extern: bool): &Func

Returns function by identifier and external state. Returns nil if not exist any function in this identifier.

FindTrait ​

jule
fn FindTrait(mut *self, name: string): &Trait

Returns trait by identifier. Returns nil if not exist any trait in this identifier.

FindEnum ​

jule
fn FindEnum(mut *self, name: string): &Enum

Returns enum by identifier. Returns nil if not exist any enum in this identifier.

FindTypeEnum ​

jule
fn FindTypeEnum(mut *self, name: string): &TypeEnum

Returns type enum by identifier. Returns nil if not exist any type enum in this identifier.

FuncPattern ​

jule
struct FuncPattern{}

Pattern checker for functions and methods.

Main ​

jule
fn Main(f: &Func): bool

Reports whether function is the reserved main function.

Init ​

jule
fn Init(f: &Func): bool

Reports whether function is the reserved init function.

String ​

jule
fn String(f: &Func): bool

Reports whether function is the reserved String function.

ReadyParam ​

jule
fn ReadyParam(mut p: &ParamIns): bool

Reports whether the parameter is a good `ready` function response parameter.

ScopeTrait ​

jule
type ScopeTrait: int

Represents traits of a scope.

Scope ​

jule
struct Scope {
	Traits: ScopeTrait
	Owner:  uintptr // Memory address of the owner.
	Parent: &Scope
	Stmts:  []Stmt

	// Data of the child scope starting from the root scope.
	// For the root scope, counting starts from 0. So the root scope will be 0.
	// It increases by one for each child scope.
	ChildIndex: int

	// If the scope is a child scope,
	// it contains the data of the statement in which it was appear.
	StmtIndex: int
}

Scope.

Use ​

jule
struct Use {
	Value: &Value
}

Use statement.

If ​

jule
struct If {
	Expr:  Expr
	Scope: &Scope
}

Chain conditional node.

Else ​

jule
struct Else {
	Scope: &Scope
}

Default scope of conditional chain.

Conditional ​

jule
struct Conditional {
	Elifs:   []&If // First not is root condition.
	Default: &Else
}

Conditional chain.

InfIter ​

jule
struct InfIter {
	Scope: &Scope // See developer reference (8).
}

Infinity iteration.

WhileIter ​

jule
struct WhileIter {
	Scope: &Scope // See developer reference (8).
	Expr:  Expr   // Can be nil if iteration is while-next kind.
	Next:  Stmt   // Nil if iteration is not while-next kind.
}

While iteration.

IsWhileNext ​

jule
fn IsWhileNext(*self): bool

Reports whether iteration is while-next kind.

RangeIter ​

jule
struct RangeIter {
	Scope:     &Scope // See developer reference (8).
	Expr:      &Value
	ExprToken: &token::Token
	KeyA:      &Var
	KeyB:      &Var
}

Range iteration.

Continue ​

jule
struct Continue {
	It: uintptr
}

Continue statement.

Break ​

jule
struct Break {
	It:     uintptr
	Match:  uintptr
	Select: uintptr
}

Break statement.

Throw ​

jule
struct Throw {
	Func:  &FuncIns
	Error: &Value
}

Throw statement.

Label ​

jule
struct Label {
	Name:  string
	Scope: &Scope // Owner scope.
	Index: int    // Index of statement.
}

Label.

Direction ​

jule
type Direction: int

Basic direction flags.

Goto ​

jule
struct Goto {
	Name:      string
	Token:     &token::Token
	Label:     &Label
	Scope:     &Scope // Owner scope.
	Index:     int    // Index of statement.
	Direction: Direction
}

Goto statement.

Postfix ​

jule
struct Postfix {
	Expr: Expr
	Op:   string
}

Postfix assignment.

Assign ​

jule
struct Assign {
	Left:  &OperandExpr
	Right: &OperandExpr
	Op:    &token::Token
}

Assignment.

MultiAssign ​

jule
struct MultiAssign {
	Decls: []&Var
	Left:  []&Value // Nil Model:s represents ignored expressions.
	Right: Expr
	Op:    &token::Token
}

Multi-declarative assignment.

Match ​

jule
struct Match {
	Scope:   &Scope // Owner scope. See developer reference (8).
	Expr:    &Value
	Cases:   []&Case
	Default: &Case

	// Possible flags are:
	//	F_TYPE: if it is a type match statement
	//	F_CONST: if it is a comptime match statement
	Flags: Flag
}

Match-Case.

IsGenericTypeMatch ​

jule
fn IsGenericTypeMatch(*self): bool

Reports whether match is type-match for generic type.

Select ​

jule
struct Select {
	Scope:   &Scope // Owner scope. See developer reference (8).
	Cases:   []&Case
	Default: &Case
}

Select-Case.

Case ​

jule
struct Case {
	Owner: CaseOwner
	Scope: &Scope
	Exprs: []&Value // Nil for select statements. Refer to Stmt field.
	Next:  &Case

	// Possible in select statements;
	//  - "<-chan", represented as &Value
	//  - "chan<-foo", represented as &Value
	//	- "x = <-chan", represented as &Assign
	//	- "x := <-chan", represented as &Var
	Stmt: Stmt
}

Match-Case case.

Fall ​

jule
struct Fall {
	DestCase: uintptr
}

Fall statement.

Return ​

jule
struct Return {
	Func: &FuncIns
	Expr: Expr
}

Return statement.

Field ​

jule
struct Field {
	AST:   &ast::Field
	Owner: &Struct
	Type:  &Type
	Tags:  map[string]string // Tags in key:value format.
}

Field.

Struct ​

jule
struct Struct {
	AST: &ast::Struct

	// This structure depended to these structures, except external ones.
	// Only stores plain identifier references such as A, B, and MyStruct.
	// Not includes non-plain identifier references such as *A, &B, and []MyStruct.
	//
	// As far as tested, safe to store in structure declaration rather than instances.
	// This collection applied for all instances.
	Depends: []&Struct

	FullName:   string // See developer reference (16).
	Fields:     []&Field
	Methods:    []&Func
	Implements: []&Trait

	// Structure instances for each unique type combination of structure.
	// Nil if structure is never used.
	Instances: []&StructIns

	// NOTE: contains filtered hidden or unexported fields
}

Structure.

FindMethod ​

jule
fn FindMethod(mut *self, name: string, _static: bool): &Func

Returns method by identifier. Returns nil if not exist any method in this identifier.

FindField ​

jule
fn FindField(mut *self, name: string): &Field

Returns field by identifier. Returns nil if not exist any field in this identifier.

IsImplements ​

jule
fn IsImplements(*self, t: &Trait): bool

Reports whether structure implements given trait.

HasRefAccessible ​

jule
fn HasRefAccessible(*self): bool

Reports whether structure has only reference-type-accessible defines.

FieldIns ​

jule
struct FieldIns {
	Owner: &StructIns
	Decl:  &Field
	Type:  &Type
}

Field instance.

StructIns ​

jule
struct StructIns {
	Source:   &Type // See developer reference (9).
	Decl:     &Struct
	Generics: []&InsGeneric
	Fields:   []&FieldIns
	Methods:  []&Func
	Refers:   &ReferenceStack

	// Possible flags are:
	//	F_MUTABLE: if structure has fields with mutable types
	//	F_COMPARABLE: if all structure fields are comparable
	Flags: Flag

	// NOTE: contains filtered hidden or unexported fields
}

Structure instance.

Implemented Traits ​

  • Kind

String ​

jule
fn String(*self): string

Implement: Kind Returns Struct's type kind as string.

Equal ​

jule
fn Equal(&self, other: &Type): bool

Reports whether types are same.

Same ​

jule
fn Same(*self, s: &StructIns): bool

Reports whether instances are same. Returns true if declarations and generics are same.

FindMethod ​

jule
fn FindMethod(mut *self, name: string, _static: bool): &Func

Returns method by identifier. Returns nil if not exist any method in this identifier.

FindField ​

jule
fn FindField(mut *self, name: string): &FieldIns

Returns field by identifier. Returns nil if not exist any field in this identifier.

ReferenceStack ​

jule
struct ReferenceStack {
	// NOTE: contains filtered hidden or unexported fields
}

Stack for symbol references. It used by Sema to store necessary references.

List of necessary references;

  • &FuncIns
  • &StructIns
  • &Trait
  • &Var -> Only global and non-constant ones.

Len ​

jule
fn Len(*self): int

Returns count of references.

At ​

jule
fn At(mut *self, i: int): any

Returns reference by index.

Push ​

jule
fn Push(mut *self, mut ref: any)

Push new reference to stack.

Exist ​

jule
fn Exist[T](*self, t: T): bool

Reports whether reference is exist.

Pass ​

jule
struct Pass {
	Token: &token::Token
	Args:  []string
}

Directive pass.

SymTab ​

jule
struct SymTab {
	File:        &token::FileSet // Owner fileset of this symbol table.
	Passes:      []Pass          // All passed flags with jule:pass directive.
	Imports:     []&ImportInfo   // Imported packages.
	Vars:        []&Var          // Variables.
	TypeAliases: []&TypeAlias    // Type aliases.
	Structs:     []&Struct       // Structures.
	Funcs:       []&Func         // Functions.
	Traits:      []&Trait        // Traits.
	Enums:       []&Enum         // Enums.
	TypeEnums:   []&TypeEnum     // Type enums.
	Impls:       []&ast::Impl    // Implementations.
}

Symbol table. Builds by semantic analyzer.

Implemented Traits ​

  • Lookup

SelectPackage ​

jule
fn SelectPackage(mut *self, selector: fn(&ImportInfo): bool): &ImportInfo

Returns imported package by selector. Returns nil if selector returns false for all packages. Returns nil if selector is nil.

FindVar ​

jule
fn FindVar(mut *self, name: string, _extern: bool): &Var

Returns variable by identifier and external state. Returns nil if refenrece not exist any variable in this identifier.

FindTypeAlias ​

jule
fn FindTypeAlias(mut *self, name: string, _extern: bool): &TypeAlias

Returns type alias by identifier and external state. Returns nil if not exist any type alias in this identifier.

FindStruct ​

jule
fn FindStruct(mut *self, name: string, _extern: bool): &Struct

Returns struct by identifier and external state. Returns nil if not exist any struct in this identifier.

FindFunc ​

jule
fn FindFunc(mut *self, name: string, _extern: bool): &Func

Returns function by identifier and external state. Returns nil if not exist any function in this identifier.

FindTrait ​

jule
fn FindTrait(mut *self, name: string): &Trait

Returns trait by identifier. Returns nil if not exist any trait in this identifier.

FindEnum ​

jule
fn FindEnum(mut *self, name: string): &Enum

Returns enum by identifier. Returns nil if not exist any enum in this identifier.

FindTypeEnum ​

jule
fn FindTypeEnum(mut *self, name: string): &TypeEnum

Returns type enum by identifier. Returns nil if not exist any type enum in this identifier.

Trait ​

jule
struct Trait {
	AST:         &ast::Trait
	FullName:    string // See developer reference (16).
	Inherits:    []&Type
	Methods:     []&Func
	Implemented: []&Struct

	// NOTE: contains filtered hidden or unexported fields
}

Trait.

Implemented Traits ​

  • Kind

String ​

jule
fn String(*self): string

Implement: Kind Returns Trait's identifier.

Equal ​

jule
fn Equal(&self, other: &Type): bool

Reports whether types are same.

FindMethod ​

jule
fn FindMethod(mut *self, name: string): &Func

Returns method by identifier. Returns nil if not exist any method in this identifier.

ConstraintMask ​

jule
struct ConstraintMask {
	Deep: bool // Whether the operator ~ used.
	Type: &Type
}

Single mask value for a constraint.

String ​

jule
fn String(*self): string

InsGeneric ​

jule
struct InsGeneric {
	Type:       &Type
	Constraint: []ConstraintMask
}

Generic type for instance types.

TypeAlias ​

jule
struct TypeAlias {
	AST:      &ast::TypeAlias
	Scope:    &ast::Scope
	FullName: string // See developer reference (16).
	Type:     &Type
	Generics: []&ast::Generic // See the developer reference (3).

	// Possible flags are:
	//	F_USED: if type alias is used in code
	//	F_GENERIC: if type alias is generic
	Flags: Flag
}

Type alias.

Type ​

jule
struct Type {
	Provider: string // Identifier of the type alias, if type provided by a type alias.
	Kind:     Kind

	// Possible flags are:
	//	F_VARIADIC: if type is variadic
	//	F_GENERIC: if type is resolved from a generic type alias
	Flags: Flag
}

Evaluated type declaration.

Implemented Traits ​

  • Kind

String ​

jule
fn String(*self): string

Returns kind as string.

Equal ​

jule
fn Equal(&self, other: &Type): bool

Reports whether types are same.

Extern ​

jule
fn Extern(*self): bool

Reports whether type is external kind.

IsNil ​

jule
fn IsNil(*self): bool

Reports whether kind is "nil".

Void ​

jule
fn Void(*self): bool

Reports whether actual kind is "void".

ActualKind ​

jule
fn ActualKind(mut *self): Kind

Returns actual kind of the type, so returns the root type. If kind is a struct, which is implemented by the type statement, see developer reference (9) for details, returns the actual kind of the source type of the struct.

ActualEqual ​

jule
fn ActualEqual(&self, other: &Type): bool

Reports whether actual kinds are equal.

Comparable ​

jule
fn Comparable(*self): bool

Reports whether actual kind is comparable.

Mutable ​

jule
fn Mutable(*self): bool

Reports whether actual kind is mutable.

Ordered ​

jule
fn Ordered(*self): bool

Reports whether actual kind supports ordered constraint.

NilCompatible ​

jule
fn NilCompatible(*self): bool

Reports whether actual kind is nil compatible.

GC ​

jule
fn GC(*self): bool

Reports whether actual kind performs garbage collection.

Variadicable ​

jule
fn Variadicable(*self): bool

Reports whether actual kind is variadicable.

Prim ​

jule
fn Prim(mut *self): &Prim

Returns primitive type if actual kind is primitive type, nil if not.

Chan ​

jule
fn Chan(mut *self): &Chan

Returns channel type if actual kind is channel, nil if not.

Sptr ​

jule
fn Sptr(mut *self): &Sptr

Returns reference type if actual kind is smart pointer, nil if not.

Ptr ​

jule
fn Ptr(mut *self): &Ptr

Returns pointer type if actual kind is pointer, nil if not.

Enum ​

jule
fn Enum(mut *self): &Enum

Returns enum type if actual kind is enum, nil if not.

TypeEnum ​

jule
fn TypeEnum(mut *self): &TypeEnum

Returns type enum if actual kind is type enum, nil if not.

Array ​

jule
fn Array(mut *self): &Array

Returns array type if actual kind is array, nil if not.

Slice ​

jule
fn Slice(mut *self): &Slice

Returns slice type if actual kind is slice, nil if not.

Func ​

jule
fn Func(mut *self): &FuncIns

Returns function type if actual kind is function, nil if not.

Struct ​

jule
fn Struct(mut *self): &StructIns

Returns struct type if actual kind is structure, nil if not.

SoftStruct ​

jule
fn SoftStruct(mut *self): &StructIns

Returns struct type if actual kind is structure. If type kind is the strict type alias source, returns the underlying structure type of the strict type alias.

Trait ​

jule
fn Trait(mut *self): &Trait

Returns trait type if actual kind is trait, nil if not.

Map ​

jule
fn Map(mut *self): &Map

Returns map type if actual kind is map, nil if not.

Tuple ​

jule
fn Tuple(mut *self): &Tuple

Returns tuple type if actual kind is tuple, nil if not.

Prim ​

jule
struct Prim {
	Kind: string
}

Primitive type.

Implemented Traits ​

  • Kind

String ​

jule
fn String(*self): string

Returns kind.

Equal ​

jule
fn Equal(&self, other: &Type): bool

Reports whether types are same.

IsConstraint ​

jule
fn IsConstraint(*self): bool

Reports whether type is built-in constraint.

IsI8 ​

jule
fn IsI8(*self): bool

Reports whether type is primitive i8.

IsI16 ​

jule
fn IsI16(*self): bool

Reports whether type is primitive i16.

IsI32 ​

jule
fn IsI32(*self): bool

Reports whether type is primitive i32.

IsI64 ​

jule
fn IsI64(*self): bool

Reports whether type is primitive i64.

IsU8 ​

jule
fn IsU8(*self): bool

Reports whether type is primitive u8.

IsU16 ​

jule
fn IsU16(*self): bool

Reports whether type is primitive u16.

IsU32 ​

jule
fn IsU32(*self): bool

Reports whether type is primitive u32.

IsU64 ​

jule
fn IsU64(*self): bool

Reports whether type is primitive u64.

IsF32 ​

jule
fn IsF32(*self): bool

Reports whether type is primitive f32.

IsF64 ​

jule
fn IsF64(*self): bool

Reports whether type is primitive f64.

IsCmplx64 ​

jule
fn IsCmplx64(*self): bool

Reports whether type is primitive cmplx64.

IsCmplx128 ​

jule
fn IsCmplx128(*self): bool

Reports whether type is primitive cmplx128.

IsInt ​

jule
fn IsInt(*self): bool

Reports whether type is primitive int.

IsUint ​

jule
fn IsUint(*self): bool

Reports whether type is primitive uint.

IsUintptr ​

jule
fn IsUintptr(*self): bool

Reports whether type is primitive uintptr.

IsBool ​

jule
fn IsBool(*self): bool

Reports whether type is primitive bool.

IsString ​

jule
fn IsString(*self): bool

Reports whether type is primitive string.

IsAny ​

jule
fn IsAny(*self): bool

Reports whether type is primitive any.

Chan ​

jule
struct Chan {
	Recv:  bool
	Send:  bool
	Value: &Type
}

Channel type.

Implemented Traits ​

  • Kind

String ​

jule
fn String(*self): string

Returns smart pointer kind as string.

Equal ​

jule
fn Equal(&self, other: &Type): bool

Reports whether types are same.

Sptr ​

jule
struct Sptr {
	Value: &Type
}

Smart pointer.

Implemented Traits ​

  • Kind

String ​

jule
fn String(*self): string

Returns smart pointer kind as string.

Equal ​

jule
fn Equal(&self, other: &Type): bool

Reports whether types are same.

Slice ​

jule
struct Slice {
	Value: &Type
}

Slice type.

Implemented Traits ​

  • Kind

String ​

jule
fn String(*self): string

Returns slice kind as string.

Equal ​

jule
fn Equal(&self, other: &Type): bool

Reports whether types are same.

Tuple ​

jule
struct Tuple {
	Types: []&Type
}

Tuple type.

Implemented Traits ​

  • Kind

String ​

jule
fn String(*self): string

Returns tuple kind as string.

Equal ​

jule
fn Equal(&self, other: &Type): bool

Reports whether types are same.

Map ​

jule
struct Map {
	Key:   &Type
	Value: &Type
}

Map type.

Implemented Traits ​

  • Kind

String ​

jule
fn String(*self): string

Returns map kind as string.

Equal ​

jule
fn Equal(&self, other: &Type): bool

Reports whether types are same.

Array ​

jule
struct Array {
	Auto:  bool // Auto-sized array.
	N:     int
	Value: &Type
}

Array type.

Implemented Traits ​

  • Kind

String ​

jule
fn String(*self): string

Returns array kind as string.

Equal ​

jule
fn Equal(&self, other: &Type): bool

Reports whether types are same.

Ptr ​

jule
struct Ptr {
	Value: &Type
}

Pointer type.

Implemented Traits ​

  • Kind

String ​

jule
fn String(*self): string

Returns pointer kind as string.

Equal ​

jule
fn Equal(&self, other: &Type): bool

Reports whether types are same.

IsUnsafe ​

jule
fn IsUnsafe(*self): bool

Reports whether pointer is unsafe pointer (*unsafe).

Var ​

jule
struct Var {
	AST:    &ast::Var
	Scope:  &Scope
	Type:   &Type
	Value:  &Value
	Refers: &ReferenceStack

	// Return variable state for this variable.
	RetState: RetState

	// The 0..n means this variable is the nth variable of the return variables.
	// This order is not useful if variable is not associated with the return type.
	RetOrder: int

	// This variable depended to these variables for initialization expression.
	// Nil if not global variable.
	Depends: []&Var

	// See developer reference (13).
	GroupIndex: int    // Index of variable in the group, if variable is grouped.
	Group:      []&Var // All variables of group in define order, if variable is grouped.

	// Possible flags are:
	//	F_USED: if variable is used in code
	//	F_IOTA: if enumerable iota variable used in the expression
	Flags: Flag
}

Variable.

IsInitialized ​

jule
fn IsInitialized(*self): bool

Reports whether variable is initialized explicitly.

IsTypeInferred ​

jule
fn IsTypeInferred(*self): bool

Reports whether variable is type inferred.

IsEnumField ​

jule
fn IsEnumField(*self): bool

Reports whether variable is enum field.

FuncOwner ​

jule
enum FuncOwner: type {
	&Struct,
	&Trait,
}

Types of a potential owner of a function.

Expr ​

jule
enum Expr: type {
	&Type,
	&constant::Const,
	&Var,
	&FuncIns,
	&StructIns,
	&BinaryExpr,
	&UnaryExpr,
	&StructLitExpr,
	&AllocStructLitExpr,
	&CastingExpr,
	&FuncCallExpr,
	&SliceExpr,
	&IndexingExpr,
	&AnonFuncExpr,
	&MapExpr,
	&SlicingExpr,
	&TraitSubIdentExpr,
	&StructSubIdentExpr,
	&StructStaticIdentExpr,
	&ArrayExpr,
	&TupleExpr,
	&BuiltinPrintCallExpr,
	&BuiltinPrintlnCallExpr,
	&BuiltinNewCallExpr,
	&BuiltinPanicCallExpr,
	&BuiltinMakeCallExpr,
	&BuiltinAppendCallExpr,
	&BuiltinCopyCallExpr,
	&BuiltinLenCallExpr,
	&BuiltinCapCallExpr,
	&BuiltinDeleteCallExpr,
	&BuiltinRealCallExpr,
	&BuiltinImagCallExpr,
	&BuiltinCmplxCallExpr,
	&BuiltinFutureCallExpr,
	&BuiltinReadyCallExpr,
	&BuiltinClearCallExpr,
	&SizeofExpr,
	&AlignofExpr,
	&RuneExpr,
	&BackendEmitExpr,
	&ChanRecv,
	&ChanSend,
	&BuiltinCloseCallExpr,
	&TypeAssertionExpr,
	&AddrcallExpr,
}

Expression model.

Stmt ​

jule
enum Stmt: type {
	&Scope,
	&Var,
	&Value,
	&Conditional,
	&InfIter,
	&WhileIter,
	&RangeIter,
	&Continue,
	&Label,
	&Goto,
	&Postfix,
	&Assign,
	&MultiAssign,
	&Match,
	&Fall,
	&Break,
	&Return,
	&Select,
	&Use,
	&Throw,
}

Statement type.

CaseOwner ​

jule
enum CaseOwner: type {
	&Match,
	&Select,
}

Valid owner types for Case.

RetState ​

jule
enum RetState {
	NA,     // Variable is not associated with return type.
	Single, // Variable is  associated with the single return type.
	Tuple,  // Variable is associated with the tuple return type.
}

Return variable states.