array: make .set() private + format

pull/1803/head
Alexander Medvednikov 2019-08-31 02:35:05 +03:00
parent 29b4114bc0
commit 72363ada84
2 changed files with 23 additions and 23 deletions

View File

@ -311,7 +311,7 @@ fn (v mut V) compile() {
d.writeln(v.prof_counters()) d.writeln(v.prof_counters())
} }
dd := d.str() dd := d.str()
cgen.lines.set(defs_pos, dd)// TODO `def.str()` doesn't compile cgen.lines[defs_pos] = dd// TODO `def.str()` doesn't compile
v.generate_main() v.generate_main()

View File

@ -153,7 +153,7 @@ pub fn (s array) slice(start, _end int) array {
return res return res
} }
pub fn (a mut array) set(idx int, val voidptr) { fn (a mut array) set(idx int, val voidptr) {
if idx < 0 || idx >= a.len { if idx < 0 || idx >= a.len {
panic('array index out of range: $idx / $a.len') panic('array index out of range: $idx / $a.len')
} }