| author | |
| committer | |
| log | 9e92dbdd0889a68e32cde85c1a07767200a9ad7e |
| tree | 3011d68e950e0e1305c7bc8cc65d9b0be2b38647 |
| parent | 100990b052be249c23743140d19ced37d463b51d |
5 files changed, 12 insertions(+), 10 deletions(-)
src/analyze.cpp+1-2| ... | @@ -988,6 +988,7 @@ static TypeTableEntry *analyze_fn_proto_type(CodeGen *g, ImportTableEntry *impor | ... | @@ -988,6 +988,7 @@ static TypeTableEntry *analyze_fn_proto_type(CodeGen *g, ImportTableEntry *impor |
| 988 | case TypeTableEntryIdNullLit: | 988 | case TypeTableEntryIdNullLit: |
| 989 | case TypeTableEntryIdNamespace: | 989 | case TypeTableEntryIdNamespace: |
| 990 | case TypeTableEntryIdGenericFn: | 990 | case TypeTableEntryIdGenericFn: |
| 991 | case TypeTableEntryIdVar: | ||
| 991 | fn_proto->skip = true; | 992 | fn_proto->skip = true; |
| 992 | add_node_error(g, fn_proto->return_type, | 993 | add_node_error(g, fn_proto->return_type, |
| 993 | buf_sprintf("return type '%s' not allowed", buf_ptr(&fn_type_id.return_type->name))); | 994 | buf_sprintf("return type '%s' not allowed", buf_ptr(&fn_type_id.return_type->name))); |
| ... | @@ -1009,8 +1010,6 @@ static TypeTableEntry *analyze_fn_proto_type(CodeGen *g, ImportTableEntry *impor | ... | @@ -1009,8 +1010,6 @@ static TypeTableEntry *analyze_fn_proto_type(CodeGen *g, ImportTableEntry *impor |
| 1009 | case TypeTableEntryIdFn: | 1010 | case TypeTableEntryIdFn: |
| 1010 | case TypeTableEntryIdTypeDecl: | 1011 | case TypeTableEntryIdTypeDecl: |
| 1011 | break; | 1012 | break; |
| 1012 | case TypeTableEntryIdVar: | ||
| 1013 | zig_panic("TODO var return type"); | ||
| 1014 | } | 1013 | } |
| 1015 | 1014 | ||
| 1016 | 1015 |
std/hash_map.zig+3-4| ... | @@ -180,8 +180,8 @@ pub struct SmallHashMap(K: type, V: type, hash: fn(key: K)->u32, eql: fn(a: K, b | ... | @@ -180,8 +180,8 @@ pub struct SmallHashMap(K: type, V: type, hash: fn(key: K)->u32, eql: fn(a: K, b |
| 180 | if (entry.distance_from_start_index < distance_from_start_index) { | 180 | if (entry.distance_from_start_index < distance_from_start_index) { |
| 181 | // robin hood to the rescue | 181 | // robin hood to the rescue |
| 182 | const tmp = *entry; | 182 | const tmp = *entry; |
| 183 | hm.max_distance_from_start_index = math.max(usize, | 183 | hm.max_distance_from_start_index = math.max(hm.max_distance_from_start_index, |
| 184 | hm.max_distance_from_start_index, distance_from_start_index); | 184 | distance_from_start_index); |
| 185 | *entry = Entry { | 185 | *entry = Entry { |
| 186 | .used = true, | 186 | .used = true, |
| 187 | .distance_from_start_index = distance_from_start_index, | 187 | .distance_from_start_index = distance_from_start_index, |
| ... | @@ -201,8 +201,7 @@ pub struct SmallHashMap(K: type, V: type, hash: fn(key: K)->u32, eql: fn(a: K, b | ... | @@ -201,8 +201,7 @@ pub struct SmallHashMap(K: type, V: type, hash: fn(key: K)->u32, eql: fn(a: K, b |
| 201 | hm.size += 1; | 201 | hm.size += 1; |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | hm.max_distance_from_start_index = math.max(usize, distance_from_start_index, | 204 | hm.max_distance_from_start_index = math.max(distance_from_start_index, hm.max_distance_from_start_index); |
| 205 | hm.max_distance_from_start_index); | ||
| 206 | *entry = Entry { | 205 | *entry = Entry { |
| 207 | .used = true, | 206 | .used = true, |
| 208 | .distance_from_start_index = distance_from_start_index, | 207 | .distance_from_start_index = distance_from_start_index, |
std/io.zig+1-1| ... | @@ -79,7 +79,7 @@ pub struct OutStream { | ... | @@ -79,7 +79,7 @@ pub struct OutStream { |
| 79 | const dest_space_left = os.buffer.len - os.index; | 79 | const dest_space_left = os.buffer.len - os.index; |
| 80 | 80 | ||
| 81 | while (src_bytes_left > 0) { | 81 | while (src_bytes_left > 0) { |
| 82 | const copy_amt = math.min(usize, dest_space_left, src_bytes_left); | 82 | const copy_amt = math.min(dest_space_left, src_bytes_left); |
| 83 | @memcpy(&os.buffer[os.index], &bytes[src_index], copy_amt); | 83 | @memcpy(&os.buffer[os.index], &bytes[src_index], copy_amt); |
| 84 | os.index += copy_amt; | 84 | os.index += copy_amt; |
| 85 | if (os.index == os.buffer.len) { | 85 | if (os.index == os.buffer.len) { |
std/math.zig+6-2| ... | @@ -4,11 +4,11 @@ pub enum Cmp { | ... | @@ -4,11 +4,11 @@ pub enum Cmp { |
| 4 | Less, | 4 | Less, |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | pub fn min(inline T: type, x: T, y: T) -> T { | 7 | pub fn min(x: var, y: var) -> @typeOf(x + y) { |
| 8 | if (x < y) x else y | 8 | if (x < y) x else y |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | pub fn max(inline T: type, x: T, y: T) -> T { | 11 | pub fn max(x: var, y: var) -> @typeOf(x + y) { |
| 12 | if (x > y) x else y | 12 | if (x > y) x else y |
| 13 | } | 13 | } |
| 14 | 14 | ||
| ... | @@ -25,3 +25,7 @@ pub fn subOverflow(inline T: type, a: T, b: T) -> %T { | ... | @@ -25,3 +25,7 @@ pub fn subOverflow(inline T: type, a: T, b: T) -> %T { |
| 25 | var answer: T = undefined; | 25 | var answer: T = undefined; |
| 26 | if (@subWithOverflow(T, a, b, &answer)) error.Overflow else answer | 26 | if (@subWithOverflow(T, a, b, &answer)) error.Overflow else answer |
| 27 | } | 27 | } |
| 28 | pub fn shlOverflow(inline T: type, a: T, b: T) -> %T { | ||
| 29 | var answer: T = undefined; | ||
| 30 | if (@shlWithOverflow(T, a, b, &answer)) error.Overflow else answer | ||
| 31 | } |
std/mem.zig+1-1| ... | @@ -50,7 +50,7 @@ pub fn copy(inline T: type, dest: []T, source: []const T) { | ... | @@ -50,7 +50,7 @@ pub fn copy(inline T: type, dest: []T, source: []const T) { |
| 50 | /// Return < 0, == 0, or > 0 if memory a is less than, equal to, or greater than, | 50 | /// Return < 0, == 0, or > 0 if memory a is less than, equal to, or greater than, |
| 51 | /// memory b, respectively. | 51 | /// memory b, respectively. |
| 52 | pub fn cmp(inline T: type, a: []const T, b: []const T) -> Cmp { | 52 | pub fn cmp(inline T: type, a: []const T, b: []const T) -> Cmp { |
| 53 | const n = math.min(usize, a.len, b.len); | 53 | const n = math.min(a.len, b.len); |
| 54 | var i: usize = 0; | 54 | var i: usize = 0; |
| 55 | while (i < n; i += 1) { | 55 | while (i < n; i += 1) { |
| 56 | if (a[i] == b[i]) continue; | 56 | if (a[i] == b[i]) continue; |