hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit ecf1617e897fd290a5a8ea5e31c870c39c779faf
parent 3d26ac38b3f9cb79b5484ce3d7b9eeeef0ae1653
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sun, 11 Apr 2021 10:25:32 -0400

all: fix append syntax

Diffstat:
Mbufio/buffered.ha | 7++++---
Mbufio/dynamic.ha | 10+++++-----
Mcmd/hare/plan.ha | 2+-
Mcmd/hare/schedule.ha | 2+-
Mcompress/flate/inflate.ha | 4++--
Mcrypto/md5/md5.ha | 2+-
Mcrypto/sha1/sha1.ha | 2+-
Mcrypto/sha256/sha256.ha | 2+-
Mcrypto/sha512/sha512.ha | 2+-
Mhare/ast/expr.ha | 2+-
Mhare/lex/lex.ha | 6+++---
Mos/exec/cmd.ha | 4++--
Mstrings/concat.ha | 2+-
Mstrio/dynamic.ha | 2+-
14 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/bufio/buffered.ha b/bufio/buffered.ha @@ -110,7 +110,7 @@ export fn any_isbuffered(s: *io::stream) bool = { export fn unread(s: *io::stream, buf: []u8) void = { assert(isbuffered(s), "bufio: unread used on non-buffered stream"); let s = s: *bufstream; - append(s.unread, ...buf); + append(s.unread, buf...); }; // Unreads a rune; see [unread]. @@ -119,9 +119,10 @@ export fn unreadrune(s: *io::stream, rn: rune) void = { let s = s: *bufstream; const buf = utf8::encoderune(rn); + // TODO: Insert let new: []u8 = alloc([], len(s.unread) + len(buf)); - append(new, ...buf); - append(new, ...s.unread); + append(new, buf...); + append(new, s.unread...); free(s.unread); s.unread = new; }; diff --git a/bufio/dynamic.ha b/bufio/dynamic.ha @@ -43,13 +43,13 @@ export fn dynamic_from(in: []u8, mode: io::mode) *io::stream = { fn dynamic_write(s: *io::stream, buf: const []u8) (size | io::error) = { let s = s: *dynamic_stream; if (s.pos == len(s.buf)) { - append(s.buf, ...buf); + append(s.buf, buf...); } else { - // TODO: update this after we add insert + // TODO: Insert let new: []u8 = alloc([], len(s.buf) + len(buf)); - append(new, ...s.buf[..s.pos]); - append(new, ...buf[..]); - append(new, ...s.buf[s.pos..]); + append(new, s.buf[..s.pos]...); + append(new, buf[..]...); + append(new, s.buf[s.pos..]...); free(s.buf); s.buf = new; }; diff --git a/cmd/hare/plan.ha b/cmd/hare/plan.ha @@ -192,6 +192,6 @@ fn mkfile(plan: *plan, ext: str) str = { fn mkdepends(t: *task...) []*task = { // XXX: This should just be one alloc call let deps: []*task = alloc([], len(t)); - append(deps, ...t); + append(deps, t...); return deps; }; diff --git a/cmd/hare/schedule.ha b/cmd/hare/schedule.ha @@ -257,6 +257,6 @@ fn sched_hare_exe( // TODO: We should be able to use partial variadic application let link: []*task = alloc([], len(depend)); defer free(link); - append(link, obj, ...depend); + append(link, obj, depend...); return sched_ld(plan, strings::dup(output), link...); }; diff --git a/compress/flate/inflate.ha b/compress/flate/inflate.ha @@ -124,13 +124,13 @@ fn put(d: *decompressor, b: u8...) void = { if (len(d.buf) == 0) { d.bufstart = d.bufstart[..0]; }; - append(d.bufstart, ...b); + append(d.bufstart, b...); d.buf = d.bufstart; let n = BUFSIZE - len(d.hist); if (n > len(b)) { n = len(b); }; - append(d.hist, ...b[..n]); + append(d.hist, b[..n]...); b = b[n..]; d.head += n; for (let s = b; len(s) != 0) { diff --git a/crypto/md5/md5.ha b/crypto/md5/md5.ha @@ -109,7 +109,7 @@ fn sum(h: *hash::hash) []u8 = { endian::leputu32(d[12..], h.h[3]); let slice: []u8 = alloc([], SIZE); - append(slice, ...d); + append(slice, d...); return slice; }; diff --git a/crypto/sha1/sha1.ha b/crypto/sha1/sha1.ha @@ -120,7 +120,7 @@ fn sum(h: *hash::hash) []u8 = { endian::beputu32(d[16..], h.h[4]); let slice: []u8 = alloc([], SIZE); - append(slice, ...d); + append(slice, d...); return slice; }; diff --git a/crypto/sha256/sha256.ha b/crypto/sha256/sha256.ha @@ -137,7 +137,7 @@ fn sum(h: *hash::hash) []u8 = { endian::beputu32(digest[28..], h.h[7]); let slice: []u8 = alloc([], SIZE); - append(slice, ...digest); + append(slice, digest...); return slice; }; diff --git a/crypto/sha512/sha512.ha b/crypto/sha512/sha512.ha @@ -175,7 +175,7 @@ fn sum(h: *hash::hash) []u8 = { // We only copy the necessary bytes from fixed-size array into the // returned slice. The size is already found in the inner hash struct. let slice: []u8 = alloc([], d.hash.sz); - append(slice, ...dig[..d.hash.sz]); + append(slice, dig[..d.hash.sz]...); return slice; }; diff --git a/hare/ast/expr.ha b/hare/ast/expr.ha @@ -30,7 +30,7 @@ export type alloc_expr = struct { capacity: nullable *expr, }; -// append(foo, bar, (more), ...baz) +// append(foo, bar, (more), baz...) export type append_expr = struct { expr: *expr, variadic: nullable *expr, diff --git a/hare/lex/lex.ha b/hare/lex/lex.ha @@ -168,7 +168,7 @@ fn lex_string( else { unget(lex, r); r = lex_rune(lex, loc)?; - append(chars, ...utf8::encoderune(r)); + append(chars, utf8::encoderune(r)...); }, }; return (strings::fromutf8(chars): literal, loc); @@ -207,7 +207,7 @@ fn lex_name( match (next(lex)) { r: rune => { assert(is_name(r, false)); - append(chars, ...utf8::encoderune(r)); + append(chars, utf8::encoderune(r)...); }, (io::EOF | io::error) => abort(), }; @@ -219,7 +219,7 @@ fn lex_name( unget(lex, r); break; }; - append(chars, ...utf8::encoderune(r)); + append(chars, utf8::encoderune(r)...); }, }; diff --git a/os/exec/cmd.ha b/os/exec/cmd.ha @@ -31,8 +31,8 @@ export fn cmd(name: str, args: str...) (command | error) = { env = alloc([], len(env)), ... }; - append(cmd.argv, name, ...args); - append(cmd.env, ...env); + append(cmd.argv, name, args...); + append(cmd.env, env...); return cmd; }; diff --git a/strings/concat.ha b/strings/concat.ha @@ -6,7 +6,7 @@ export fn concat(strs: str...) str = { }; let new: []u8 = alloc([], z); for (let i = 0z; i < len(strs); i += 1) { - append(new, ...toutf8(strs[i])); + append(new, toutf8(strs[i])...); }; return fromutf8_unsafe(new[..z]); }; diff --git a/strio/dynamic.ha b/strio/dynamic.ha @@ -59,7 +59,7 @@ export fn truncate(s: *io::stream) (void | errors::unsupported) = { fn dynamic_write(s: *io::stream, buf: const []u8) (size | io::error) = { let s = s: *dynamic_stream; - append(s.buf, ...buf); + append(s.buf, buf...); return len(buf); };