Skip to content

Commit

Permalink
rename TypeInfo.Int to TypeInfo.SizedInt
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Nov 9, 2023
1 parent 55b5825 commit 5fca75e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions lib/rivet/src/ast/Table.ri
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ public struct Table {

public func int_bits(self, type: Type) -> uint {
type_sym := type.symbol()?;
return if type_sym.info is .Int as int_info {
return if type_sym.info is .SizedInt as int_info {
int_info.size
} else if type_sym.info is .Uint as uint_info {
} else if type_sym.info is .SizedUint as uint_info {
uint_info.size
} else if type_sym.info is .Isize or type_sym.info is .Usize {
if self.prefs.target_is_64bit { 64 } else { 32 }
Expand Down Expand Up @@ -312,14 +312,14 @@ public struct Table {
.Alias as alias_info -> self.type_size(alias_info.parent),
.Bool -> (1, 1),
.Usize, .Isize -> (self.pointer_size, self.pointer_size),
.Int as int -> match int.size {
.SizedInt as int -> match int.size {
8 -> (1, 1),
16 -> (2, 2),
32 -> (4, 4),
64 -> (8, 8),
else -> (0, 0)
},
.Uint as uint -> match uint.size {
.SizedUint as uint -> match uint.size {
8 -> (1, 1),
16 -> (2, 2),
32 -> (4, 4),
Expand Down
10 changes: 5 additions & 5 deletions lib/rivet/src/ast/TypeInfo.ri
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ public enum TypeInfo < traits.Stringable {
None,
Bool,
Rune,
Int {
SizedInt {
size: uint;
},
Uint {
SizedUint {
size: uint;
},
Isize,
Expand Down Expand Up @@ -150,7 +150,7 @@ public enum TypeInfo < traits.Stringable {

#[inline]
public func is_primitive(self) -> bool {
return self is .Bool or self is .Rune or self is .Int or self is .Uint
return self is .Bool or self is .Rune or self is .SizedInt or self is .Uint
or self is .Usize or self is .Isize or self is .ComptimeInt
or self is .ComptimeFloat or self is .ComptimeFloat or self is .Float;
}
Expand All @@ -168,9 +168,9 @@ public enum TypeInfo < traits.Stringable {
.None -> "none",
.Bool -> "bool",
.Rune -> "rune",
.Int as int_info -> "int{}".fmt(int_info.size),
.SizedInt as int_info -> "int{}".fmt(int_info.size),
.Isize -> "int",
.Uint as uint_info -> "uint{}".fmt(uint_info.size),
.SizedUint as uint_info -> "uint{}".fmt(uint_info.size),
.Usize -> "uint",
.ComptimeInt -> "comptime_int",
.ComptimeFloat -> "comptime_float",
Expand Down
12 changes: 6 additions & 6 deletions lib/rivet/src/codegen/mir/Type.ri
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import std/process;
public enum Type < traits.Stringable {
Void,
Never,
Int {
SizedInt {
bits: uint;
size: uint;
},
Uint {
SizedUint {
bits: uint;
size: uint;
},
Expand Down Expand Up @@ -42,8 +42,8 @@ public enum Type < traits.Stringable {

public func size(self) -> uint {
return match self is {
.Int as int -> int.size,
.Uint as uint -> uint.size,
.SizedInt as int -> int.size,
.SizedUint as uint -> uint.size,
.Basic as basic -> basic.size,
.Rawptr as size -> size,
.Pointer as ptr -> ptr.size,
Expand All @@ -57,8 +57,8 @@ public enum Type < traits.Stringable {
return match self is {
.Void -> "void",
.Never -> "never",
.Int as int -> "int{}".fmt(int.bits),
.Uint as uint -> "uint{}".fmt(uint.bits),
.SizedInt as int -> "int{}".fmt(int.bits),
.SizedUint as uint -> "uint{}".fmt(uint.bits),
.Basic as basic -> if basic.is_primitive {
basic.name
} else {
Expand Down

0 comments on commit 5fca75e

Please sign in to comment.