1
0
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:
joe-conigliaro
2019-10-27 18:03:15 +11:00
committed by Alexander Medvednikov
parent ed55826686
commit 59378dce46
49 changed files with 308 additions and 306 deletions

View File

@ -13,7 +13,7 @@ fn (p mut Parser) struct_decl() {
// V can generate Objective C for integration with Cocoa
// `[objc_interface:ParentInterface]`
is_objc := p.attr.starts_with('objc_interface')
objc_parent := if is_objc { p.attr.right(15) } else { '' }
objc_parent := if is_objc { p.attr[15..] } else { '' }
// interface, union, struct
is_interface := p.tok == .key_interface
is_union := p.tok == .key_union
@ -288,7 +288,7 @@ fn (p mut Parser) struct_init(typ string) string {
// init map fields
if field_typ.starts_with('map_') {
p.gen_struct_field_init(sanitized_name)
p.gen_empty_map(field_typ.right(4))
p.gen_empty_map(field_typ[4..])
inited_fields << sanitized_name
if i != t.fields.len - 1 {
p.gen(',')