v.checker #

fn new_checker #

fn new_checker(table &table.Table, pref &pref.Preferences) Checker

struct Checker #

struct Checker {
	pref &pref.Preferences
pub mut:
	table            &table.Table
	file             &ast.File = 0
	nr_errors        int
	nr_warnings      int
	errors           []errors.Error
	warnings         []errors.Warning
	error_lines      []int
	expected_type    table.Type
	expected_or_type table.Type
	cur_fn           &ast.FnDecl
	const_decl       string
	const_deps       []string
	const_names      []string
	global_names     []string
	locked_names     []string
	rlocked_names    []string
	in_for_count     int
	returns           bool
	scope_returns     bool
	mod               string
	is_builtin_mod    bool
	inside_unsafe     bool
	inside_const      bool
	skip_flags        bool
	cur_generic_types []table.Type
	expr_level                       int
	inside_sql                       bool
	cur_orm_ts                       table.TypeSymbol
	error_details                    []string
	for_in_mut_val_name              string
	vmod_file_content                string
	vweb_gen_types                   []table.Type
	prevent_sum_type_unwrapping_once bool
	loop_label                       string
	timers                           &util.Timers = util.new_timers(false)
	comptime_fields_type             map[string]table.Type
	fn_scope                         &ast.Scope = voidptr(0)

fn (Checker) add_error_detail #

fn (mut c Checker) add_error_detail(s string)

call this before calling error or warn

fn (Checker) array_init #

fn (mut c Checker) array_init(mut array_init ast.ArrayInit) table.Type

fn (Checker) assign_stmt #

fn (mut c Checker) assign_stmt(mut assign_stmt ast.AssignStmt)

fn (Checker) call_expr #

fn (mut c Checker) call_expr(mut call_expr ast.CallExpr) table.Type

fn (Checker) call_fn #

fn (mut c Checker) call_fn(mut call_expr ast.CallExpr) table.Type

fn (Checker) call_method #

fn (mut c Checker) call_method(mut call_expr ast.CallExpr) table.Type

fn (Checker) cast_expr #

fn (mut c Checker) cast_expr(mut node ast.CastExpr) table.Type

fn (Checker) chan_init #

fn (mut c Checker) chan_init(mut node ast.ChanInit) table.Type

fn (Checker) check #

fn (mut c Checker) check(ast_file &ast.File)

fn (Checker) check2 #

fn (mut c Checker) check2(ast_file &ast.File) []errors.Error

not used right now

fn (Checker) check_basic #

fn (mut c Checker) check_basic(got table.Type, expected table.Type) bool

fn (Checker) check_dup_keys #

fn (mut c Checker) check_dup_keys(node &ast.MapInit, i int)

fn (Checker) check_expected #

fn (mut c Checker) check_expected(got table.Type, expected table.Type) ?

fn (Checker) check_expected_call_arg #

fn (mut c Checker) check_expected_call_arg(got table.Type, expected_ table.Type) ?

fn (Checker) check_expr_opt_call #

fn (mut c Checker) check_expr_opt_call(expr ast.Expr, ret_type table.Type) table.Type

return the actual type of the expression, once the optional is handled

fn (Checker) check_files #

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

fn (Checker) check_matching_function_symbols #

fn (mut c Checker) check_matching_function_symbols(got_type_sym &table.TypeSymbol, exp_type_sym &table.TypeSymbol) bool

fn (Checker) check_or_expr #

fn (mut c Checker) check_or_expr(or_expr ast.OrExpr, ret_type table.Type, expr_return_type table.Type)

fn (Checker) check_scope_vars #

fn (mut c Checker) check_scope_vars(sc &ast.Scope)

fn (Checker) check_types #

fn (mut c Checker) check_types(got table.Type, expected table.Type) bool

TODO: promote(), check_types(), symmetric_check() and check() overlap - should be rearranged

fn (Checker) concat_expr #

fn (mut c Checker) concat_expr(mut concat_expr ast.ConcatExpr) table.Type

fn (Checker) const_decl #

fn (mut c Checker) const_decl(mut node ast.ConstDecl)

fn (Checker) enum_decl #

fn (mut c Checker) enum_decl(decl ast.EnumDecl)

fn (Checker) enum_val #

fn (mut c Checker) enum_val(mut node ast.EnumVal) table.Type

.green or Color.green If a short form is used, expected_type needs to be an enum with this value.

fn (Checker) error #

fn (mut c Checker) error(message string, pos token.Position)

fn (Checker) expr #

fn (mut c Checker) expr(node ast.Expr) table.Type

TODO node must be mut

fn (Checker) get_default_fmt #

fn (c &Checker) get_default_fmt(ftyp table.Type, typ table.Type) byte

fn (Checker) ident #

fn (mut c Checker) ident(mut ident ast.Ident) table.Type

fn (Checker) if_expr #

fn (mut c Checker) if_expr(mut node ast.IfExpr) table.Type

fn (Checker) index_expr #

fn (mut c Checker) index_expr(mut node ast.IndexExpr) table.Type

fn (Checker) infer_fn_types #

fn (mut c Checker) infer_fn_types(f table.Fn, mut call_expr ast.CallExpr)

fn (Checker) infix_expr #

fn (mut c Checker) infix_expr(mut infix_expr ast.InfixExpr) table.Type

fn (Checker) interface_decl #

fn (mut c Checker) interface_decl(decl ast.InterfaceDecl)

fn (Checker) lock_expr #

fn (mut c Checker) lock_expr(mut node ast.LockExpr) table.Type

fn (Checker) map_init #

fn (mut c Checker) map_init(mut node ast.MapInit) table.Type

fn (Checker) match_expr #

fn (mut c Checker) match_expr(mut node ast.MatchExpr) table.Type

fn (Checker) postfix_expr #

fn (mut c Checker) postfix_expr(mut node ast.PostfixExpr) table.Type

fn (Checker) prefix_expr #

fn (mut c Checker) prefix_expr(mut node ast.PrefixExpr) table.Type

fn (Checker) promote #

fn (c &Checker) promote(left_type table.Type, right_type table.Type) table.Type

fn (Checker) return_stmt #

fn (mut c Checker) return_stmt(mut return_stmt ast.Return)

TODO: non deferred

fn (Checker) select_expr #

fn (mut c Checker) select_expr(mut node ast.SelectExpr) table.Type

fn (Checker) selector_expr #

fn (mut c Checker) selector_expr(mut selector_expr ast.SelectorExpr) table.Type

fn (Checker) string_inter_lit #

fn (mut c Checker) string_inter_lit(mut node ast.StringInterLiteral) table.Type

fn (Checker) struct_decl #

fn (mut c Checker) struct_decl(mut decl ast.StructDecl)

fn (Checker) struct_init #

fn (mut c Checker) struct_init(mut struct_init ast.StructInit) table.Type

fn (Checker) symmetric_check #

fn (mut c Checker) symmetric_check(left table.Type, right table.Type) bool

fn (Checker) type_decl #

fn (mut c Checker) type_decl(node ast.TypeDecl)

fn (Checker) unsafe_expr #

fn (mut c Checker) unsafe_expr(mut node ast.UnsafeExpr) table.Type

fn (Checker) unwrap_generic #

fn (c &Checker) unwrap_generic(typ table.Type) table.Type

fn (Checker) warn #

fn (mut c Checker) warn(s string, pos token.Position)