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

string: last_index ?int

This commit is contained in:
Alexander Medvednikov
2019-12-12 21:44:52 +03:00
parent 8e1c27d129
commit b8f728590b
5 changed files with 28 additions and 29 deletions

View File

@@ -2137,7 +2137,10 @@ fn (p mut Parser) index_expr(typ_ string, fn_ph int) string {
// }
if is_indexer {
l := p.cgen.cur_line.trim_space()
index_val := l[l.last_index(' ')..].trim_space()
idx := l.last_index(' ') or {
panic('idx')
}
index_val := l[idx..].trim_space()
p.cgen.resetln(l[..fn_ph])
p.table.varg_access << VargAccess{
fn_name: p.cur_fn.name,