Skip to content

v.gen.js #

JavaScript backend

Attributes

When specified on an interface, the @[single_impl] attribute prevents any type from implementing it.

Verbatim lines

Any lines starting with a # character will be included verbatim in the final output.

See also

A lot of important code is under the vlib/builtin/js directory. Especially jsfns*.js.v which defines all supported built-in JavaScript types and functions.

Constants #

const builtin_functions = ['print', 'println', 'eprint', 'eprintln', 'isnil', 'panic', 'exit']

fn data_str #

fn data_str(x StrIntpType) string

fn gen #

fn gen(files []&ast.File, mut table ast.Table, pref_ &pref.Preferences) string

fn type_to_str #

fn type_to_str(x StrIntpType) string

fn (JsGen) dec_indent #

fn (mut g JsGen) dec_indent()

fn (JsGen) doc_typ #

fn (mut g JsGen) doc_typ(t ast.Type) string

V type to JS type

fn (JsGen) enter_namespace #

fn (mut g JsGen) enter_namespace(name string)

fn (JsGen) escape_namespace #

fn (mut g JsGen) escape_namespace()

fn (JsGen) find_class_methods #

fn (mut g JsGen) find_class_methods(stmts []ast.Stmt)

fn (JsGen) gen_indent #

fn (mut g JsGen) gen_indent()

fn (JsGen) gen_js_main_for_tests #

fn (mut g JsGen) gen_js_main_for_tests()

fn (JsGen) inc_indent #

fn (mut g JsGen) inc_indent()

fn (JsGen) init #

fn (mut g JsGen) init()

fn (JsGen) new_tmp_var #

fn (mut g JsGen) new_tmp_var() string

fn (JsGen) push_pub_var #

fn (mut g JsGen) push_pub_var(s string)

fn (JsGen) styp #

fn (mut g JsGen) styp(t ast.Type) string

fn (JsGen) write #

fn (mut g JsGen) write(s string)

fn (JsGen) writeln #

fn (mut g JsGen) writeln(s string)

enum StrIntpType #

enum StrIntpType {
	si_no_str = 0 // no parameter to print only fix string
	si_c
	si_u8
	si_i8
	si_u16
	si_i16
	si_u32
	si_i32
	si_u64
	si_i64
	si_e32
	si_e64
	si_f32
	si_f64
	si_g32
	si_g64
	si_s
	si_p
	si_r
	si_vp
}