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

make function arguments immutable by default

This commit is contained in:
Alexander Medvednikov
2019-08-07 08:19:27 +02:00
parent 06b8bd9382
commit 34e0b164eb
22 changed files with 107 additions and 83 deletions

View File

@@ -115,8 +115,8 @@ fn is_js_prim(typ string) bool {
typ == 'i8' || typ == 'i16' || typ == 'i32' || typ == 'i64'
}
fn (p mut Parser) decode_array(typ string) string {
typ = typ.replace('array_', '')
fn (p mut Parser) decode_array(array_type string) string {
typ := array_type.replace('array_', '')
t := p.table.find_type(typ)
fn_name := js_dec_name(typ)
// If we have `[]Profile`, have to register a Profile en(de)coder first
@@ -149,8 +149,8 @@ fn js_dec_name(typ string) string {
return name
}
fn (p &Parser) encode_array(typ string) string {
typ = typ.replace('array_', '')
fn (p &Parser) encode_array(array_type string) string {
typ := array_type.replace('array_', '')
fn_name := js_enc_name(typ)
return '
o = cJSON_CreateArray();