Skip to content

v3.gen.c

fn FlatGen.new #

fn FlatGen.new() FlatGen

fn Gen.new #

fn Gen.new() Gen

struct FlatGen #

struct FlatGen {
mut:
	sb                      strings.Builder
	indent                  int
	a                       &flat.FlatAst = unsafe { nil }
	used_fns                map[string]bool
	used_fn_names           []string
	str_lits                []string
	str_lit_ids             map[string]int
	global_types            map[string]types.Type
	enum_vals               map[string]int
	defers                  []flat.NodeId
	interfaces              map[string][]string
	const_vals              map[string]flat.NodeId
	const_modules           map[string]string
	global_modules          map[string]string
	tc                      &types.TypeChecker = unsafe { nil }
	has_builtins            bool
	tmp_count               int
	line_start              bool
	modules                 map[string]string // alias -> full module name
	fn_ptr_types            map[string]string // fn_ptr:ret|params -> typedef name
	fn_decl_param_types     map[string][]types.Type
	struct_decl_infos       map[string]StructDeclInfo
	struct_decl_short_infos map[string]StructDeclInfo
	runtime_inits           []string
	cur_fn_ret              types.Type = types.Type(types.void_)
	cur_fn_ret_is_optional  bool
	cur_fn_ret_base         types.Type = types.Type(types.void_)
	expected_expr_type      types.Type = types.Type(types.void_)
	expected_enum           string
	needed_optional_types   map[string]string
	emitted_fns             map[string]bool
	array_method_cache      map[string]string
}

fn (FlatGen) gen #

fn (mut g FlatGen) gen(a &flat.FlatAst) string

fn (FlatGen) gen_with_used #

fn (mut g FlatGen) gen_with_used(a &flat.FlatAst, used_fns map[string]bool, tc &types.TypeChecker) string

fn (FlatGen) gen_with_used_options #

fn (mut g FlatGen) gen_with_used_options(a &flat.FlatAst, used_fns map[string]bool, tc &types.TypeChecker, no_parallel bool) string

struct Gen #

struct Gen {
mut:
	sb           strings.Builder
	indent       int
	cur_fn       string
	had_main     bool
	fn_decls     []ast.FnDecl
	str_lits     []string
	str_lit_id   int
	fn_ret_types map[string]string
	var_types    map[string]string
}

fn (Gen) gen #

fn (mut g Gen) gen(files []ast.File) string