mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler/vlib: replace substr/left/right with [start..end] everywhere
This commit is contained in:
committed by
Alexander Medvednikov
parent
ed55826686
commit
59378dce46
@@ -9,7 +9,7 @@ const (
|
||||
fn (p mut Parser) gen_var_decl(name string, is_static bool) string {
|
||||
p.gen('var $name /* typ */ = ')
|
||||
mut typ := p.bool_expression()
|
||||
if typ.starts_with('...') { typ = typ.right(3) }
|
||||
if typ.starts_with('...') { typ = typ[3..] }
|
||||
or_else := p.tok == .key_orelse
|
||||
//tmp := p.get_tmp()
|
||||
if or_else {
|
||||
@@ -149,8 +149,8 @@ fn (p mut Parser) gen_array_init(typ string, no_alloc bool, new_arr_ph int, nr_e
|
||||
}
|
||||
|
||||
fn (p mut Parser) gen_array_set(typ string, is_ptr, is_map bool,fn_ph, assign_pos int, is_cao bool) {
|
||||
mut val := p.cgen.cur_line.right(assign_pos)
|
||||
p.cgen.resetln(p.cgen.cur_line.left(assign_pos))
|
||||
mut val := p.cgen.cur_line[assign_pos..]
|
||||
p.cgen.resetln(p.cgen.cur_line[..assign_pos])
|
||||
p.gen('] =')
|
||||
cao_tmp := p.cgen.cur_line
|
||||
if is_cao {
|
||||
|
||||
Reference in New Issue
Block a user