Skip to content

v.markused #

fn mark_used #

fn mark_used(mut table ast.Table, mut pref_ pref.Preferences, ast_files []&ast.File)

mark_used walks the AST, starting at main() and marks all used fns transitively

struct Walker #

struct Walker {
pub mut:
	table        &ast.Table = unsafe { nil }
	used_fns     map[string]bool // used_fns['println'] == true
	used_consts  map[string]bool // used_consts['os.args'] == true
	used_globals map[string]bool
	used_structs map[string]bool
	n_asserts    int
	pref         &pref.Preferences = unsafe { nil }
mut:
	files       []&ast.File
	all_fns     map[string]ast.FnDecl
	all_consts  map[string]ast.ConstField
	all_globals map[string]ast.GlobalField
}

fn (Walker) mark_fn_as_used #

fn (mut w Walker) mark_fn_as_used(fkey string)

fn (Walker) mark_builtin_array_method_as_used #

fn (mut w Walker) mark_builtin_array_method_as_used(method_name string)

fn (Walker) mark_builtin_map_method_as_used #

fn (mut w Walker) mark_builtin_map_method_as_used(method_name string)

fn (Walker) mark_builtin_type_method_as_used #

fn (mut w Walker) mark_builtin_type_method_as_used(k string, rk string)

fn (Walker) mark_const_as_used #

fn (mut w Walker) mark_const_as_used(ckey string)

fn (Walker) mark_global_as_used #

fn (mut w Walker) mark_global_as_used(ckey string)

fn (Walker) mark_root_fns #

fn (mut w Walker) mark_root_fns(all_fn_root_names []string)

fn (Walker) mark_exported_fns #

fn (mut w Walker) mark_exported_fns()

fn (Walker) mark_markused_fns #

fn (mut w Walker) mark_markused_fns()

fn (Walker) mark_markused_consts #

fn (mut w Walker) mark_markused_consts()

fn (Walker) mark_markused_globals #

fn (mut w Walker) mark_markused_globals()

fn (Walker) stmt #

fn (mut w Walker) stmt(node_ ast.Stmt)

fn (Walker) a_struct_info #

fn (mut w Walker) a_struct_info(sname string, info ast.Struct)

fn (Walker) fn_decl #

fn (mut w Walker) fn_decl(mut node ast.FnDecl)

fn (Walker) call_expr #

fn (mut w Walker) call_expr(mut node ast.CallExpr)

fn (Walker) fn_by_name #

fn (mut w Walker) fn_by_name(fn_name string)

fn (Walker) struct_fields #

fn (mut w Walker) struct_fields(sfields []ast.StructField)

fn (Walker) const_fields #

fn (mut w Walker) const_fields(cfields []ast.ConstField)

fn (Walker) or_block #

fn (mut w Walker) or_block(node ast.OrExpr)