diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 624f420c7d0e41..42152dba0213d2 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -1407,7 +1407,7 @@ pub fn (s string) last_index_u8(c u8) int { // count returns the number of occurrences of `substr` in the string. // count returns -1 if no `substr` could be found. @[direct_array_access] -pub fn (s &string) count(substr string) int { +pub fn (s string) count(substr string) int { if s.len == 0 || substr.len == 0 { return 0 } diff --git a/vlib/v/token/pos.v b/vlib/v/token/pos.v index 68b460ac7e43d2..05dfdd12625eca 100644 --- a/vlib/v/token/pos.v +++ b/vlib/v/token/pos.v @@ -17,11 +17,11 @@ pub mut: pub fn (mut p Pos) free() { } -pub fn (p &Pos) line_str() string { +pub fn (p Pos) line_str() string { return '{l: ${p.line_nr + 1:5}, c: ${p.col:3}, p: ${p.pos:5}, ll: ${p.last_line + 1:5}}' } -pub fn (pos &Pos) extend(end Pos) Pos { +pub fn (pos Pos) extend(end Pos) Pos { return Pos{ ...pos len: end.pos - pos.pos + end.len @@ -29,7 +29,7 @@ pub fn (pos &Pos) extend(end Pos) Pos { } } -pub fn (pos &Pos) extend_with_last_line(end Pos, last_line int) Pos { +pub fn (pos Pos) extend_with_last_line(end Pos, last_line int) Pos { return Pos{ len: end.pos - pos.pos + end.len line_nr: pos.line_nr diff --git a/vlib/v/token/token.v b/vlib/v/token/token.v index ff19fd17539004..e6072ab2c79287 100644 --- a/vlib/v/token/token.v +++ b/vlib/v/token/token.v @@ -385,11 +385,11 @@ pub fn (t Kind) str() string { } @[inline] -pub fn (t &Token) is_next_to(pre_token Token) bool { +pub fn (t Token) is_next_to(pre_token Token) bool { return t.pos - pre_token.pos == pre_token.len } -pub fn (t &Token) str() string { +pub fn (t Token) str() string { mut s := t.kind.str() if s.len == 0 { eprintln('missing token kind string') @@ -493,7 +493,7 @@ const precedences = build_precedences() // precedence returns a tokens precedence if defined, otherwise 0 @[direct_array_access; inline] -pub fn (tok &Token) precedence() int { +pub fn (tok Token) precedence() int { return int(precedences[tok.kind]) } @@ -505,13 +505,13 @@ pub fn (kind Kind) precedence() int { // is_scalar returns true if the token is a scalar @[inline] -pub fn (tok &Token) is_scalar() bool { +pub fn (tok Token) is_scalar() bool { return tok.kind in [.number, .string] } // is_unary returns true if the token can be in a unary expression @[inline] -pub fn (tok &Token) is_unary() bool { +pub fn (tok Token) is_unary() bool { // `+` | `-` | `!` | `~` | `*` | `&` | `<-` return tok.kind in [.plus, .minus, .not, .bit_not, .mul, .amp, .arrow] }