1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: map[string]pointer, ?pointer, fix []pointer

This commit is contained in:
れもん
2019-12-22 07:44:16 +09:00
committed by Alexander Medvednikov
parent b76227b781
commit 28ecfb231d
14 changed files with 98 additions and 48 deletions

View File

@@ -4,7 +4,7 @@ const (
)
fn test_pointer() {
mut arr := []*int
mut arr := []&int
a := 1
b := 2
c := 3
@@ -14,6 +14,10 @@ fn test_pointer() {
assert *arr[0] == 1
arr[1] = &c
assert *arr[1] == 3
mut d_arr := [arr] // [][]&int
d_arr << arr
assert *d_arr[0][1] == 3
assert *d_arr[1][0] == 1
}
fn test_ints() {

View File

@@ -132,13 +132,13 @@ fn test_various_map_value() {
m13['test'] = rune(0)
assert m13['test'] == rune(0)
//mut m14 := map[string]voidptr
//m14['test'] = voidptr(0)
//assert m14['test'] == voidptr(0)
mut m14 := map[string]voidptr
m14['test'] = voidptr(0)
assert m14['test'] == voidptr(0)
//mut m15 := map[string]byteptr
//m15['test'] = byteptr(0)
//assert m15['test'] == byteptr(0)
mut m15 := map[string]byteptr
m15['test'] = byteptr(0)
assert m15['test'] == byteptr(0)
mut m16 := map[string]i64
m16['test'] = i64(0)
@@ -147,6 +147,10 @@ fn test_various_map_value() {
mut m17 := map[string]u64
m17['test'] = u64(0)
assert m17['test'] == u64(0)
mut m18 := map[string]&int
m18['test'] = &int(0)
assert m18['test'] == &int(0)
}