Skip to content

Commit 736067d

Browse files
committed
V 0.4.6
1 parent 774253e commit 736067d

File tree

8 files changed

+425
-61
lines changed

8 files changed

+425
-61
lines changed

CHANGELOG.md

+333
Large diffs are not rendered by default.

cmd/tools/changelog_helper.v

+12-8
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ fn (mut app App) process_line(text string) ! {
209209
// exit(0)
210210
//}
211211
if (semicolon_pos < 15
212-
&& prefix in ['checker', 'cgen', 'parser', 'v.parser', 'ast', 'jsgen', 'v.gen.js', 'fmt', 'vfmt'])
212+
&& prefix in ['checker', 'cgen', 'parser', 'v.parser', 'ast', 'jsgen', 'v.gen.js', 'fmt', 'vfmt', 'tools'])
213213
|| (semicolon_pos < 30 && prefix.contains(', ')) {
214214
s = '- ' + text[semicolon_pos + 2..].capitalize()
215215
}
@@ -348,12 +348,6 @@ const db_strings = [
348348
'pg:',
349349
]
350350

351-
const improvements_strings = [
352-
'all:',
353-
'v:',
354-
'coroutines:',
355-
]
356-
357351
const parser_strings = [
358352
'parser:',
359353
'ast:',
@@ -367,6 +361,7 @@ const stdlib_strings = [
367361
'sync:',
368362
'datatypes:',
369363
'math:',
364+
'math.',
370365
'math.big',
371366
'crypto',
372367
'sokol',
@@ -376,11 +371,11 @@ const stdlib_strings = [
376371
'toml:',
377372
'vlib:',
378373
'arrays:',
379-
'math.',
380374
'os.',
381375
'term:',
382376
'sync.',
383377
'builtin:',
378+
'builtin,',
384379
'strconv',
385380
'readline',
386381
'cli:',
@@ -439,6 +434,13 @@ fn is_internal(text string) bool {
439434
return is_xxx(text, internal_strings)
440435
}
441436

437+
const improvements_strings = [
438+
'all:',
439+
'v:',
440+
'coroutines:',
441+
'autofree',
442+
]
443+
442444
fn is_improvements(text string) bool {
443445
return is_xxx(text, improvements_strings)
444446
}
@@ -469,6 +471,8 @@ const tools_strings = [
469471
'vtest',
470472
'repl',
471473
'REPL',
474+
'vet',
475+
'tools.',
472476
]
473477

474478
fn is_tools(text string) bool {

v.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Module {
22
name: 'V'
33
description: 'The V programming language.'
4-
version: '0.4.5'
4+
version: '0.4.6'
55
license: 'MIT'
66
repo_url: 'https://github.com/vlang/v'
77
dependencies: []

vlib/builtin/int.v

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ module builtin
77
// ----- value to string functions -----
88
//
99

10+
pub struct VContext {
11+
allocator int
12+
}
13+
1014
// type u8 = byte
1115
type byte = u8
1216

vlib/semver/v.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Module {
22
name: 'semver'
3-
version: '0.4.5'
3+
version: '0.4.6'
44
deps: []
55
}

vlib/v/checker/fn.v

+22
Original file line numberDiff line numberDiff line change
@@ -1435,6 +1435,14 @@ fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) ast.
14351435
continue
14361436
}
14371437
}
1438+
// if first_sym.name == 'VContext' && f.params[0].name == 'ctx' { // TODO use int comparison for perf
1439+
//}
1440+
/*
1441+
if param_typ_sym.info is ast.Struct && param_typ_sym.name == 'VContext' {
1442+
c.note('ok', call_arg.pos)
1443+
continue
1444+
}
1445+
*/
14381446
c.error('${err.msg()} in argument ${i + 1} to `${fn_name}`', call_arg.pos)
14391447
}
14401448
if final_param_sym.kind == .struct_ && arg_typ !in [ast.voidptr_type, ast.nil_type]
@@ -2644,6 +2652,7 @@ fn (mut c Checker) check_expected_arg_count(mut node ast.CallExpr, f &ast.Fn) !
26442652
}
26452653
if nr_args < min_required_params {
26462654
if min_required_params == nr_args + 1 {
2655+
// params struct?
26472656
last_typ := f.params.last().typ
26482657
last_sym := c.table.sym(last_typ)
26492658
if last_sym.info is ast.Struct {
@@ -2658,6 +2667,19 @@ fn (mut c Checker) check_expected_arg_count(mut node ast.CallExpr, f &ast.Fn) !
26582667
return
26592668
}
26602669
}
2670+
// Implicit context first arg?
2671+
/*
2672+
first_typ := f.params[0].typ
2673+
first_sym := c.table.sym(first_typ)
2674+
if first_sym.info is ast.Struct {
2675+
if c.fileis('a.v') {
2676+
if first_sym.name == 'VContext' && f.params[0].name == 'ctx' { // TODO use int comparison for perf
2677+
// c.error('got ctx ${first_sym.name}', node.pos)
2678+
return
2679+
}
2680+
}
2681+
}
2682+
*/
26612683
}
26622684
c.error('expected ${min_required_params} arguments, but got ${nr_args}', node.pos)
26632685
return error('')

vlib/v/util/version/version.c.v

-51
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
module version
22

3-
import os
4-
5-
pub const v_version = '0.4.5'
6-
73
// vhash() returns the build string C.V_COMMIT_HASH . See cmd/tools/gen_vc.v .
84
pub fn vhash() string {
95
mut buf := [50]u8{}
@@ -14,50 +10,3 @@ pub fn vhash() string {
1410
return tos_clone(bp)
1511
}
1612
}
17-
18-
pub fn full_hash() string {
19-
build_hash := vhash()
20-
current_hash := @VCURRENTHASH
21-
if build_hash == current_hash {
22-
return build_hash
23-
}
24-
return '${build_hash}.${current_hash}'
25-
}
26-
27-
// full_v_version() returns the full version of the V compiler
28-
pub fn full_v_version(is_verbose bool) string {
29-
if is_verbose {
30-
return 'V ${version.v_version} ${full_hash()}'
31-
}
32-
return 'V ${version.v_version} ${@VCURRENTHASH}'
33-
}
34-
35-
// githash tries to find the current git commit hash for the specified
36-
// project path by parsing the relevant files in its `.git/` folder.
37-
pub fn githash(path string) !string {
38-
// .git/HEAD
39-
git_head_file := os.join_path(path, '.git', 'HEAD')
40-
if !os.exists(git_head_file) {
41-
return error('failed to find `${git_head_file}`')
42-
}
43-
// 'ref: refs/heads/master' ... the current branch name
44-
head_content := os.read_file(git_head_file) or {
45-
return error('failed to read `${git_head_file}`')
46-
}
47-
current_branch_hash := if head_content.starts_with('ref: ') {
48-
rev_rel_path := head_content.replace('ref: ', '').trim_space()
49-
rev_file := os.join_path(path, '.git', rev_rel_path)
50-
// .git/refs/heads/master
51-
if !os.exists(rev_file) {
52-
return error('failed to find revision file `${rev_file}`')
53-
}
54-
// get the full commit hash contained in the ref heads file
55-
os.read_file(rev_file) or { return error('failed to read revision file `${rev_file}`') }
56-
} else {
57-
head_content
58-
}
59-
desired_hash_length := 7
60-
return current_branch_hash[0..desired_hash_length] or {
61-
error('failed to limit hash `${current_branch_hash}` to ${desired_hash_length} characters')
62-
}
63-
}

vlib/v/util/version/version.v

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
module version
2+
3+
import os
4+
5+
pub const v_version = '0.4.6'
6+
7+
pub fn full_hash() string {
8+
build_hash := vhash()
9+
current_hash := @VCURRENTHASH
10+
if build_hash == current_hash {
11+
return build_hash
12+
}
13+
return '${build_hash}.${current_hash}'
14+
}
15+
16+
// full_v_version() returns the full version of the V compiler
17+
pub fn full_v_version(is_verbose bool) string {
18+
if is_verbose {
19+
return 'V ${version.v_version} ${full_hash()}'
20+
}
21+
return 'V ${version.v_version} ${@VCURRENTHASH}'
22+
}
23+
24+
// githash tries to find the current git commit hash for the specified
25+
// project path by parsing the relevant files in its `.git/` folder.
26+
pub fn githash(path string) !string {
27+
// .git/HEAD
28+
git_head_file := os.join_path(path, '.git', 'HEAD')
29+
if !os.exists(git_head_file) {
30+
return error('failed to find `${git_head_file}`')
31+
}
32+
// 'ref: refs/heads/master' ... the current branch name
33+
head_content := os.read_file(git_head_file) or {
34+
return error('failed to read `${git_head_file}`')
35+
}
36+
current_branch_hash := if head_content.starts_with('ref: ') {
37+
rev_rel_path := head_content.replace('ref: ', '').trim_space()
38+
rev_file := os.join_path(path, '.git', rev_rel_path)
39+
// .git/refs/heads/master
40+
if !os.exists(rev_file) {
41+
return error('failed to find revision file `${rev_file}`')
42+
}
43+
// get the full commit hash contained in the ref heads file
44+
os.read_file(rev_file) or { return error('failed to read revision file `${rev_file}`') }
45+
} else {
46+
head_content
47+
}
48+
desired_hash_length := 7
49+
return current_branch_hash[0..desired_hash_length] or {
50+
error('failed to limit hash `${current_branch_hash}` to ${desired_hash_length} characters')
51+
}
52+
}

0 commit comments

Comments
 (0)