Skip to content

v2.types #

fn init_universe #

fn init_universe() &Scope

fn new_module #

fn new_module(name string, path string) &Module

fn new_scope #

fn new_scope(parent &Scope) &Scope

fn #

fn &pref.Preferences, file_set &token.FileSet, env &Environment) &Checker

fn #

fn &Environment

fn (Checker) get_module_scope #

fn (mut c Checker) get_module_scope(module_name string, parent &Scope) &Scope

fn (Checker) check_files #

fn (mut c Checker) check_files(files []ast.File)

fn (Checker) check_file #

fn (mut c Checker) check_file(file ast.File)

type Object #

type Object = Const | Fn | Global | Module | SmartCastSelector | Type

fn (Object) typ #

fn (obj &Object) typ() Type

type Type #

type Type = Alias
	| Array
	| ArrayFixed
	| Channel
	| Char
	| Enum
	| FnType
	| ISize
	| Interface
	| Map
	| NamedType
	| Nil
	| None
	| OptionType
	| Pointer
	| Primitive
	| ResultType
	| Rune
	| String
	| Struct
	| SumType
	| Thread
	| Tuple
	| USize
	| Void

Todo: fix nested sum type in tinyv (like TS)

struct Module #

struct Module {
	name    string
	path    string
	imports []Module
	scope   &Scope = new_scope(unsafe { nil })

struct Scope #

struct Scope {
	parent &Scope = unsafe { nil }
	objects map[string]Object
	// TODO: try implement using original concept
	field_smartcasts map[string]Type
	// smartcasts map[string]Type
	// TODO: it may be more efficient looking up local vars using an ID
	// even if we had to store them in two different places. investigate.
	// variables []Object
	start int
	end   int

fn (Scope) lookup_field_smartcast #

fn (mut s Scope) lookup_field_smartcast(name string) ?Type

Todo: try implement the alternate method I was experimenting with (SmartCastSelector)i'm not sure if it is actually possible though. need to explore it.

fn (Scope) lookup #

fn (mut s Scope) lookup(name string) ?Object

fn (Scope) lookup_parent #

fn (mut s Scope) lookup_parent(name string, pos token.Pos) ?Object

fn (Scope) lookup_parent_with_scope #

fn (mut s Scope) lookup_parent_with_scope(name string, pos token.Pos) ?(&Scope, Object)

fn (Scope) insert #

fn (mut s Scope) insert(name string, obj Object)

fn (Scope) print #

fn (s &Scope) print(recurse_parents bool)