9942 commits 0 issues 0 pull requests 439 contributors 0 branches 0 releases
Additions: 25 Deletions: 5
vlib/os/os.v
1 }
2 }
3 }
4+ $if macos {
5+ // avoid /var/folders/6j/cmsk8gd90pd.... on macs
6+ return '/tmp'
7+ }
8 $if android {
9 // TODO test+use '/data/local/tmp' on Android before using cache_dir()
10 if path == '' {
11
vlib/sqlite/sqlite.v
1
2 // Only for V ORM
3 fn (db DB) init_stmt(query string) &C.sqlite3_stmt {
4+ // println('init_stmt("$query")')
5 stmt := &C.sqlite3_stmt(0)
6 C.sqlite3_prepare_v2(db.conn, &char(query.str), query.len, &stmt, 0)
7 return stmt
8
vlib/sync/channel_1_test.v
1 }
2 assert sum == u64(num_iterations) * (num_iterations - 1) / 2
3 }
4+
5+fn test_builtin_enum() {
6+ x := ChanState.closed
7+ assert x == .closed
8+ println(x)
9+}
10
vlib/v/ast/table.v
1 .placeholder {
2 // override placeholder
3 // println('overriding type placeholder `$typ.name`')
4- t.type_symbols[existing_idx] = TypeSymbol{
5+ t.type_symbols[existing_idx] = {
6 ...typ
7 methods: ex_type.methods
8 }
9
vlib/v/checker/checker.v
1 // If a short form is used, `expected_type` needs to be an enum
2 // with this value.
3 pub fn (mut c Checker) enum_val(mut node ast.EnumVal) ast.Type {
4- typ_idx := if node.enum_name == '' {
5+ mut typ_idx := if node.enum_name == '' {
6 c.expected_type.idx()
7 } else { //
8 c.table.find_type_idx(node.enum_name)
9 }
10 // println('checker: enum_val: $node.enum_name typeidx=$typ_idx')
11 if typ_idx == 0 {
12- c.error('not an enum (name=$node.enum_name) (type_idx=0)', node.pos)
13- return ast.void_type
14+ // Handle `builtin` enums like `ChanState`, so that `x := ChanState.closed` works.
15+ // In the checker the name for such enums was set to `main.ChanState` instead of
16+ // just `ChanState`.
17+ if node.enum_name.starts_with('main.') {
18+ typ_idx = c.table.find_type_idx(node.enum_name['.main'.len..])
19+ if typ_idx == 0 {
20+ c.error('unknown enum `$node.enum_name` (type_idx=0)', node.pos)
21+ return ast.void_type
22+ }
23+ }
24 }
25 mut typ := ast.new_type(typ_idx)
26 if c.pref.translated {
27
vlib/vweb/vweb.v
1 //}
2 for {
3 // Create a new app object for each connection, copy global data like db connections
4- mut request_app := T{}
5+ mut request_app := &T{}
6 $if T is DbInterface {
7 request_app.db = global_app.db
8 } $else {
9
10 // Set s to the form error
11 pub fn (mut ctx Context) error(s string) {
12+ println('vweb error: $s')
13 ctx.form_error = s
14 }
15