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

all: rollback to old interpolation (step 3) (#16380)

This commit is contained in:
shove
2022-11-10 20:05:34 +08:00
committed by GitHub
parent bbae7a705f
commit 26d643fc5d
27 changed files with 91 additions and 108 deletions

View File

@@ -516,7 +516,7 @@ fn test_struct_print() {
}
a.b << b
a.b << b
assert a.str() == '\{Test [{1 2}, {1 2}]}'
assert a.str() == '{Test [{1 2}, {1 2}]}'
assert b.str() == '{1 2}'
assert a.b.str() == '[{1 2}, {1 2}]'
}

View File

@@ -504,7 +504,7 @@ fn test_struct_print() {
}
a.b << b
a.b << b
assert a.str() == r'{Test [{1 2}, {1 2}]}'
assert a.str() == '{Test [{1 2}, {1 2}]}'
assert b.str() == '{1 2}'
assert a.b.str() == '[{1 2}, {1 2}]'
}

View File

@@ -687,22 +687,22 @@ pub const (
[inline]
pub fn str_intp_sq(in_str string) string {
return 'str_intp(2, _MOV((StrIntpData[]){{ _SLIT("\'"), $si_s_code, {.d_s = $in_str}},{ _SLIT("\'"), 0, {.d_c = 0 }}}))'
return 'str_intp(2, _MOV((StrIntpData[]){{_SLIT("\'"), $si_s_code, {.d_s = $in_str}},{_SLIT("\'"), 0, {.d_c = 0 }}}))'
}
[inline]
pub fn str_intp_rune(in_str string) string {
return 'str_intp(2, _MOV((StrIntpData[]){{ _SLIT("\`"), $si_s_code, {.d_s = $in_str}},{ _SLIT("\`"), 0, {.d_c = 0 }}}))'
return 'str_intp(2, _MOV((StrIntpData[]){{_SLIT("\`"), $si_s_code, {.d_s = $in_str}},{_SLIT("\`"), 0, {.d_c = 0 }}}))'
}
[inline]
pub fn str_intp_g32(in_str string) string {
return 'str_intp(1, _MOV((StrIntpData[]){{ _SLIT0, $si_g32_code, {.d_f32 = $in_str }}}))'
return 'str_intp(1, _MOV((StrIntpData[]){{_SLIT0, $si_g32_code, {.d_f32 = $in_str }}}))'
}
[inline]
pub fn str_intp_g64(in_str string) string {
return 'str_intp(1, _MOV((StrIntpData[]){{ _SLIT0, $si_g64_code, {.d_f64 = $in_str }}}))'
return 'str_intp(1, _MOV((StrIntpData[]){{_SLIT0, $si_g64_code, {.d_f64 = $in_str }}}))'
}
// replace %% with the in_str
@@ -718,12 +718,12 @@ pub fn str_intp_sub(base_str string, in_str string) string {
st_str := base_str[..index]
if index + 2 < base_str.len {
en_str := base_str[index + 2..]
res_str := 'str_intp(2, _MOV((StrIntpData[]){{ _SLIT("$st_str"), $si_s_code, {.d_s = $in_str }},{ _SLIT("$en_str"), 0, {.d_c = 0}}}))'
res_str := 'str_intp(2, _MOV((StrIntpData[]){{_SLIT("$st_str"), $si_s_code, {.d_s = $in_str }},{_SLIT("$en_str"), 0, {.d_c = 0}}}))'
st_str.free()
en_str.free()
return res_str
}
res2_str := 'str_intp(1, _MOV((StrIntpData[]){{ _SLIT("$st_str"), $si_s_code, { .d_s = $in_str }}}))'
res2_str := 'str_intp(1, _MOV((StrIntpData[]){{_SLIT("$st_str"), $si_s_code, {.d_s = $in_str }}}))'
st_str.free()
return res2_str
}

View File

@@ -849,11 +849,6 @@ fn test_raw_inter() {
assert s.contains('$')
}
fn test_new_inter() {
// world := 'world'
// assert 'hello {world}' == 'hello world'
}
fn test_c_r() {
// This used to break because of r'' and c''
c := 42