mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
bring back map.str()
This commit is contained in:
parent
8d3617b3de
commit
5ed338dc2e
6
compiler/tests/mut_test.v
Normal file
6
compiler/tests/mut_test.v
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
fn test_mut() {
|
||||||
|
a := 1
|
||||||
|
mut b := &a
|
||||||
|
*b = 10
|
||||||
|
println(a)
|
||||||
|
}
|
@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
//url = 'http://localhost:8089'
|
//url = 'http://localhost:8089'
|
||||||
url = 'http://vpm.vlang.io'
|
url = 'https://vpm.best'
|
||||||
)
|
)
|
||||||
|
|
||||||
struct Mod {
|
struct Mod {
|
||||||
@ -25,7 +25,10 @@ fn main() {
|
|||||||
}
|
}
|
||||||
name := os.args.last()
|
name := os.args.last()
|
||||||
s := http.get_text(url + '/jsmod/$name')
|
s := http.get_text(url + '/jsmod/$name')
|
||||||
mod := json.decode(Mod, s) or { return }
|
mod := json.decode(Mod, s) or {
|
||||||
|
println('Error. Make sure you are online.')
|
||||||
|
return
|
||||||
|
}
|
||||||
home := os.home_dir()
|
home := os.home_dir()
|
||||||
os.exec('git -C "$home/.vmodules" clone --depth=1 $mod.url $mod.name')
|
os.exec('git -C "$home/.vmodules" clone --depth=1 $mod.url $mod.name')
|
||||||
println(s)
|
println(s)
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
module builtin
|
module builtin
|
||||||
|
|
||||||
|
import strings
|
||||||
|
|
||||||
struct map {
|
struct map {
|
||||||
element_size int
|
element_size int
|
||||||
root *Node
|
root *Node
|
||||||
@ -243,16 +245,19 @@ pub fn (m map) free() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn (m map_string) str() string {
|
pub fn (m map_string) str() string {
|
||||||
// return 'not impl'
|
|
||||||
if m.size == 0 {
|
if m.size == 0 {
|
||||||
return '{}'
|
return '{}'
|
||||||
}
|
}
|
||||||
// TODO use bytes buffer
|
// TODO use bytes buffer
|
||||||
mut s := '{\n'
|
//mut sb := strings.new_builder(50)
|
||||||
//for key, val in m {
|
//sb.writeln('{')
|
||||||
//val := m[entry.key]
|
mut s := '{\n'
|
||||||
//s += ' "$entry.key" => "$val"\n'
|
for key, val in m {
|
||||||
//}
|
//sb.writeln(' "$entry.key" => "$val"')
|
||||||
s += '}'
|
s += ' "$key" => "$val"\n'
|
||||||
return s
|
}
|
||||||
|
s += '}\n'
|
||||||
|
//sb.writeln('}')
|
||||||
|
//return sb.str()
|
||||||
|
return s
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user