v.checker #

fn new_checker #

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

struct Checker #

struct Checker {
	pref &pref.Preferences
pub mut:
	table            &ast.Table
	file             &ast.File = 0
	nr_errors        int
	nr_warnings      int
	nr_notices       int
	should_abort     bool
	errors           []errors.Error
	warnings         []errors.Warning
	notices          []errors.Notice
	error_lines      []int
	expected_type    ast.Type
	expected_or_type ast.Type
	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
	inside_anon_fn bool
	inside_ref_lit bool
	inside_defer   bool
	inside_fn_arg  bool
	inside_ct_attr bool
	skip_flags     bool
	fn_level       int
	ct_cond_stack  []ast.Expr
mut:
	files                            []ast.File
	expr_level                       int
	inside_sql                       bool
	cur_orm_ts                       ast.TypeSymbol
	error_details                    []string
	vmod_file_content                string
	vweb_gen_types                   []ast.Type
	prevent_sum_type_unwrapping_once bool
	loop_label                       string
	timers                           &util.Timers = util.new_timers(false)
	comptime_fields_type             map[string]ast.Type
	fn_scope                         &ast.Scope = voidptr(0)
	main_fn_decl_node                ast.FnDecl
	match_exhaustive_cutoff_limit    int = 10

	using_new_err_struct     bool
	inside_selector_expr     bool
	inside_println_arg       bool
	inside_decl_rhs          bool
	inside_if_guard          bool
	need_recheck_generic_fns bool
}

fn (Checker) add_error_detail #

fn (mut c Checker) add_error_detail(s string)

call this before calling error or warn

fn (Checker) alias_type_decl #

fn (mut c Checker) alias_type_decl(node ast.AliasTypeDecl)

fn (Checker) array_init #

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

fn (Checker) assign_stmt #

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

fn (Checker) call_expr #

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

fn (Checker) cast_expr #

fn (mut c Checker) cast_expr(mut node ast.CastExpr) ast.Type
for bit_size, array in ast.x86_no_number_register_list { 		if name in array { 			return c.table.bitsize_to_type(bit_size) 		} 	} 	for bit_size, array in ast.x86_with_number_register_list { 		if name in array { 			return c.table.bitsize_to_type(bit_size) 		} 	} 	c.error('invalid register name: `$name`', node.pos) 	return ast.void_type }

fn (Checker) chan_init #

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

fn (Checker) change_current_file #

fn (mut c Checker) change_current_file(file &ast.File)

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 ast.Type, expected ast.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 ast.Type, expected ast.Type) ?

fn (Checker) check_expected_arg_count #

fn (mut c Checker) check_expected_arg_count(mut node ast.CallExpr, f &ast.Fn) ?

fn (Checker) check_expected_call_arg #

fn (mut c Checker) check_expected_call_arg(got ast.Type, expected_ ast.Type, language ast.Language) ?

fn (Checker) check_expr_opt_call #

fn (mut c Checker) check_expr_opt_call(expr ast.Expr, ret_type ast.Type) ast.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 &ast.TypeSymbol, exp_type_sym &ast.TypeSymbol) bool

fn (Checker) check_or_expr #

fn (mut c Checker) check_or_expr(node ast.OrExpr, ret_type ast.Type, expr_return_type ast.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 ast.Type, expected ast.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 node ast.ConcatExpr) ast.Type

fn (Checker) const_decl #

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

fn (Checker) ensure_sumtype_array_has_default_value #

fn (mut c Checker) ensure_sumtype_array_has_default_value(node ast.ArrayInit)

fn (Checker) enum_decl #

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

fn (Checker) enum_val #

fn (mut c Checker) enum_val(mut node ast.EnumVal) ast.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) expand_iface_embeds #

fn (mut c Checker) expand_iface_embeds(idecl &ast.InterfaceDecl, level int, iface_embeds []ast.InterfaceEmbedding) []ast.InterfaceEmbedding

fn (Checker) expr #

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

TODO node must be mut

fn (Checker) fail_if_unreadable #

fn (mut c Checker) fail_if_unreadable(expr ast.Expr, typ ast.Type, what string)

fn (Checker) find_unreachable_statements_after_noreturn_calls #

fn (mut c Checker) find_unreachable_statements_after_noreturn_calls(stmts []ast.Stmt)

fn (Checker) fn_call #

fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) ast.Type

fn (Checker) fn_type_decl #

fn (mut c Checker) fn_type_decl(node ast.FnTypeDecl)

fn (Checker) get_base_name #

fn (mut c Checker) get_base_name(node &ast.Expr) string

fn (Checker) get_default_fmt #

fn (mut c Checker) get_default_fmt(ftyp ast.Type, typ ast.Type) byte

fn (Checker) ident #

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

fn (Checker) if_expr #

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

fn (Checker) index_expr #

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

fn (Checker) infer_fn_generic_types #

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

fn (Checker) infix_expr #

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

fn (Checker) int_lit #

fn (mut c Checker) int_lit(mut node ast.IntegerLiteral) ast.Type

fn (Checker) interface_decl #

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

fn (Checker) lock_expr #

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

fn (Checker) map_init #

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

fn (Checker) mark_as_referenced #

fn (mut c Checker) mark_as_referenced(mut node ast.Expr, as_interface bool)

fn (Checker) match_expr #

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

fn (Checker) method_call #

fn (mut c Checker) method_call(mut node ast.CallExpr) ast.Type

fn (Checker) note #

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

fn (Checker) offset_of #

fn (mut c Checker) offset_of(node ast.OffsetOf) ast.Type

fn (Checker) postfix_expr #

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

fn (Checker) prefix_expr #

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

fn (Checker) promote #

fn (mut c Checker) promote(left_type ast.Type, right_type ast.Type) ast.Type

fn (Checker) return_stmt #

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

TODO: non deferred

fn (Checker) select_expr #

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

fn (Checker) selector_expr #

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

fn (Checker) string_inter_lit #

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

fn (Checker) string_lit #

fn (mut c Checker) string_lit(mut node ast.StringLiteral) ast.Type

fn (Checker) struct_decl #

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

fn (Checker) struct_init #

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

fn (Checker) sum_type_decl #

fn (mut c Checker) sum_type_decl(node ast.SumTypeDecl)

fn (Checker) symmetric_check #

fn (mut c Checker) symmetric_check(left ast.Type, right ast.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) ast.Type

fn (Checker) unwrap_generic #

fn (mut c Checker) unwrap_generic(typ ast.Type) ast.Type

fn (Checker) warn #

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