mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vlib: remove deprecated map{} usages as well as deprecated functions (#11035)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import x.json2
|
||||
|
||||
const (
|
||||
sample_data = map{
|
||||
sample_data = {
|
||||
'int': json2.Any(int(1))
|
||||
'i64': json2.Any(i64(128))
|
||||
'f32': json2.Any(f32(2.0))
|
||||
@@ -10,7 +10,7 @@ const (
|
||||
'str': json2.Any('test')
|
||||
'null': json2.Any(json2.null)
|
||||
'arr': json2.Any([json2.Any('lol')])
|
||||
'obj': json2.Any(map{
|
||||
'obj': json2.Any({
|
||||
'foo': json2.Any(10)
|
||||
})
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ pub fn (f Any) as_map() map[string]Any {
|
||||
}
|
||||
return mp
|
||||
}
|
||||
return map{
|
||||
return {
|
||||
'0': f
|
||||
}
|
||||
}
|
||||
|
@@ -153,7 +153,7 @@ fn (mut u User) from_json(an json2.Any) {
|
||||
|
||||
fn (u User) to_json() string {
|
||||
// TODO: derive from field
|
||||
mut mp := map{
|
||||
mut mp := {
|
||||
'age': json2.Any(u.age)
|
||||
}
|
||||
mp['nums'] = u.nums.map(json2.Any(it))
|
||||
@@ -252,7 +252,7 @@ fn test_struct_in_struct() {
|
||||
*/
|
||||
fn test_encode_map() {
|
||||
expected := '{"one":1,"two":2,"three":3,"four":4}'
|
||||
numbers := map{
|
||||
numbers := {
|
||||
'one': json2.Any(1)
|
||||
'two': json2.Any(2)
|
||||
'three': json2.Any(3)
|
||||
|
@@ -50,7 +50,7 @@ const (
|
||||
// list of valid unicode escapes aside from \u{4-hex digits}
|
||||
valid_unicode_escapes = [`b`, `f`, `n`, `r`, `t`, `\\`, `"`, `/`]
|
||||
// used for transforming escapes into valid unicode (eg. n => \n)
|
||||
unicode_transform_escapes = map{
|
||||
unicode_transform_escapes = {
|
||||
98: `\b`
|
||||
102: `\f`
|
||||
110: `\n`
|
||||
|
Reference in New Issue
Block a user