table: move set_nr_muls to method
parent
d54b48b300
commit
6696e1a6e2
|
@ -87,7 +87,7 @@ pub fn (mut p Parser) parse_fn_type(name string) table.Type {
|
|||
pub fn (mut p Parser) parse_type_with_mut(is_mut bool) table.Type {
|
||||
typ := p.parse_type()
|
||||
if is_mut {
|
||||
return table.type_set_nr_muls(typ, 1)
|
||||
return typ.set_nr_muls(1)
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ pub fn (mut p Parser) parse_type() table.Type {
|
|||
typ = typ.set_flag(.optional)
|
||||
}
|
||||
if nr_muls > 0 {
|
||||
typ = table.type_set_nr_muls(typ, nr_muls)
|
||||
typ = typ.set_nr_muls(nr_muls)
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ pub fn (t Type) is_ptr() bool {
|
|||
|
||||
// set nr_muls on `t` and return it
|
||||
[inline]
|
||||
pub fn type_set_nr_muls(t Type, nr_muls int) Type {
|
||||
pub fn (t Type) set_nr_muls(nr_muls int) Type {
|
||||
if nr_muls < 0 || nr_muls > 255 {
|
||||
panic('typ_set_nr_muls: nr_muls must be between 0 & 255')
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ pub fn (f &Fn) signature() string {
|
|||
mut sig := ''
|
||||
for i, arg in f.args {
|
||||
// TODO: for now ignore mut/pts in sig for now
|
||||
typ := type_set_nr_muls(arg.typ, 0)
|
||||
typ := arg.typ.set_nr_muls(0)
|
||||
// if arg.is_mut {
|
||||
// sig += 'mut_'
|
||||
// }
|
||||
|
|
Loading…
Reference in New Issue