mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
0.5.3: Single-module not respected. Fix issue with compiler defined types. Fix optimization levels for projects. Use GEP i8 on offsets. Optimize foreach on len 1 arrays. Move panic blocks last. Fix generic module wildcard imports. Deprecate init_temp / init_new. Fix issue with macro vaarg and untyped lists. Fix extern const globals.
This commit is contained in:
committed by
Christoffer Lerno
parent
e91f6e268e
commit
deb4cc7c4b
@@ -24,7 +24,7 @@ fn void! set_get()
|
||||
assert(bs.cardinality() == 2);
|
||||
|
||||
List found;
|
||||
found.init_temp();
|
||||
found.temp_init();
|
||||
foreach (i, x : bs)
|
||||
{
|
||||
switch (i)
|
||||
@@ -50,7 +50,7 @@ def GrowableBitSet = GrowableBitSet(<char>);
|
||||
fn void! growable_set_get()
|
||||
{
|
||||
GrowableBitSet bs;
|
||||
bs.init_temp();
|
||||
bs.temp_init();
|
||||
assert(bs.cardinality() == 0, "Invalid cardinality");
|
||||
|
||||
assert(!bs.get(0), "Get was true");
|
||||
@@ -68,7 +68,7 @@ fn void! growable_set_get()
|
||||
assert(bs.len() == 2001, "Len should be 2001");
|
||||
|
||||
List found;
|
||||
found.init_temp();
|
||||
found.temp_init();
|
||||
foreach (i, x : bs)
|
||||
{
|
||||
switch (i)
|
||||
|
||||
@@ -10,7 +10,7 @@ fn void! copy_map() @test
|
||||
mem::@scoped(&alloc)
|
||||
{
|
||||
HashMap(<String, int>) x;
|
||||
x.init_new();
|
||||
x.new_init();
|
||||
DString y;
|
||||
y.append("hello");
|
||||
x.set(y.str_view(), 123);
|
||||
|
||||
@@ -17,7 +17,7 @@ fn void map()
|
||||
{
|
||||
Map m;
|
||||
assert(!m.is_initialized());
|
||||
m.init_temp();
|
||||
m.temp_init();
|
||||
assert(m.is_initialized());
|
||||
assert(m.is_empty());
|
||||
assert(m.len() == 0);
|
||||
@@ -41,7 +41,7 @@ fn void map()
|
||||
}
|
||||
|
||||
List list;
|
||||
list.init_temp();
|
||||
list.temp_init();
|
||||
m.@each(;String key, usz value)
|
||||
{
|
||||
list.push({key, value});
|
||||
|
||||
@@ -27,7 +27,7 @@ fn void! readbuffer()
|
||||
reader_buf.init(&src, buf[..]);
|
||||
|
||||
ByteWriter bw;
|
||||
bw.init_temp();
|
||||
bw.temp_init();
|
||||
|
||||
usz n = io::copy_to(&reader_buf, &bw)!;
|
||||
|
||||
@@ -39,7 +39,7 @@ fn void! readbuffer()
|
||||
fn void! writebuffer_large()
|
||||
{
|
||||
ByteWriter out;
|
||||
out.init_temp();
|
||||
out.temp_init();
|
||||
char[16] buf;
|
||||
WriteBuffer write_buf;
|
||||
write_buf.init(&out, buf[..]);
|
||||
@@ -56,7 +56,7 @@ fn void! writebuffer()
|
||||
ByteReader br;
|
||||
br.init(DATA);
|
||||
ByteWriter out;
|
||||
out.init_temp();
|
||||
out.temp_init();
|
||||
char[3] buf;
|
||||
WriteBuffer write_buf;
|
||||
write_buf.init(&out, buf[..]);
|
||||
|
||||
@@ -4,7 +4,7 @@ import std::io;
|
||||
fn void! write_read()
|
||||
{
|
||||
ByteBuffer buffer;
|
||||
buffer.init_new(0)!;
|
||||
buffer.new_init(0)!;
|
||||
|
||||
buffer.write("hello")!;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ fn void! bytestream()
|
||||
usz len = s.read(&buffer)!;
|
||||
assert((String)buffer[:len] == "abc");
|
||||
ByteWriter w;
|
||||
w.init_new();
|
||||
w.new_init();
|
||||
OutStream* ws = &w;
|
||||
ws.write("helloworld")!;
|
||||
assert(w.str_view() == "helloworld");
|
||||
@@ -43,7 +43,7 @@ fn void! bytewriter_read_from()
|
||||
InStream* s = &r;
|
||||
|
||||
ByteWriter bw;
|
||||
bw.init_temp();
|
||||
bw.temp_init();
|
||||
bw.read_from(s)!;
|
||||
|
||||
assert(bw.str_view() == data);
|
||||
|
||||
@@ -3,7 +3,7 @@ module std::io @test;
|
||||
fn void! test_writing()
|
||||
{
|
||||
DString foo;
|
||||
foo.init_new();
|
||||
foo.new_init();
|
||||
OutStream* s = &foo;
|
||||
s.write("hello")!!;
|
||||
s.write_byte('-')!!;
|
||||
|
||||
@@ -4,7 +4,7 @@ import std::io;
|
||||
fn void! write_read()
|
||||
{
|
||||
ByteBuffer buf;
|
||||
buf.init_temp(16)!;
|
||||
buf.temp_init(16)!;
|
||||
usz n;
|
||||
uint x;
|
||||
uint y;
|
||||
@@ -45,7 +45,7 @@ fn void! samples()
|
||||
foreach (tc : tcases)
|
||||
{
|
||||
ByteWriter bw;
|
||||
bw.init_temp();
|
||||
bw.temp_init();
|
||||
usz n = io::write_varint(&bw, tc.in)!;
|
||||
assert(n == tc.bytes.len, "got %d; want %d", n, tc.bytes.len);
|
||||
char[] bytes = bw.bytes[:bw.index];
|
||||
|
||||
@@ -76,7 +76,7 @@ def List = List(<int>);
|
||||
fn void quicksort_list()
|
||||
{
|
||||
List list;
|
||||
list.init_temp();
|
||||
list.temp_init();
|
||||
list.add_array({ 2, 1, 3});
|
||||
sort::quicksort(list, &sort::cmp_int_value);
|
||||
assert(check::int_sort(list.array_view()));
|
||||
|
||||
Reference in New Issue
Block a user