table: move set_nr_muls to method

pull/4587/head
joe-conigliaro 2020-04-25 17:54:32 +10:00
parent d54b48b300
commit 6696e1a6e2
No known key found for this signature in database
GPG Key ID: C12F7136C08206F1
3 changed files with 4 additions and 4 deletions

View File

@ -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
}

View File

@ -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')
}

View File

@ -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_'
// }