Skip to content

Commit

Permalink
rivet.ast: rename Usize/Isize to uint/INT
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Nov 9, 2023
1 parent 667d2a2 commit 6087568
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 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 @@ -268,7 +268,7 @@ public struct Table {
int_info.size
} 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 {
} else if type_sym.info is .Int or type_sym.info is .Uint {
if self.prefs.target_is_64bit { 64 } else { 32 }
} else {
75
Expand Down Expand Up @@ -311,7 +311,7 @@ public struct Table {
.Func -> (self.pointer_size, self.pointer_size),
.Alias as alias_info -> self.type_size(alias_info.parent),
.Bool -> (1, 1),
.Usize, .Isize -> (self.pointer_size, self.pointer_size),
.Uint, .Int -> (self.pointer_size, self.pointer_size),
.SizedInt as int -> match int.size {
8 -> (1, 1),
16 -> (2, 2),
Expand Down Expand Up @@ -500,12 +500,12 @@ public func universe() -> Module {
TypeSym(name: "int16", info: .SizedInt(16)),
TypeSym(name: "int32", info: .SizedInt(32)),
TypeSym(name: "int64", info: .SizedInt(64)),
TypeSym(name: "int", info: .Isize()),
TypeSym(name: "int", info: .Int()),
TypeSym(name: "uint8", info: .SizedUint(8)),
TypeSym(name: "uint16", info: .SizedUint(16)),
TypeSym(name: "uint32", info: .SizedUint(32)),
TypeSym(name: "uint64", info: .SizedUint(64)),
TypeSym(name: "uint", info: .Usize()),
TypeSym(name: "uint", info: .Uint()),
TypeSym(name: "comptime_int", info: .ComptimeInt()),
TypeSym(name: "comptime_float", info: .ComptimeFloat()),
TypeSym(name: "float32", info: .Float(32)),
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 @@ -16,8 +16,8 @@ public enum TypeInfo < traits.Stringable {
SizedUint {
size: uint;
},
Isize,
Usize,
Int,
Uint,
ComptimeInt,
ComptimeFloat,
Float {
Expand Down Expand Up @@ -151,7 +151,7 @@ public enum TypeInfo < traits.Stringable {
#[inline]
public func is_primitive(self) -> bool {
return self is .Bool or self is .Rune or self is .SizedInt or self is .SizedUint
or self is .Usize or self is .Isize or self is .ComptimeInt
or self is .Uint or self is .Int or self is .ComptimeInt
or self is .ComptimeFloat or self is .ComptimeFloat or self is .Float;
}

Expand All @@ -169,9 +169,9 @@ public enum TypeInfo < traits.Stringable {
.Bool -> "bool",
.Rune -> "rune",
.SizedInt as int_info -> "int{}".fmt(int_info.size),
.Isize -> "int",
.Int -> "int",
.SizedUint as uint_info -> "uint{}".fmt(uint_info.size),
.Usize -> "uint",
.Uint -> "uint",
.ComptimeInt -> "comptime_int",
.ComptimeFloat -> "comptime_float",
.Float as float_info -> "float{}".fmt(float_info.size),
Expand Down
2 changes: 1 addition & 1 deletion lib/rivet/src/checker/match_expr.ri
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ extend Checker {
}
}

mut branch_exprs := maps.MapStringUsize();
mut branch_exprs := maps.MapStringUint();
match_expr.expected_type = self.expected_type;
for ib, branch in match_expr.branches {
if !branch.is_else {
Expand Down
8 changes: 4 additions & 4 deletions lib/rivet/src/utils/maps/mod.ri
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
// TODO: remove file, use Map![K, V] instead

#[boxed]
struct StringUsize {
struct StringUint {
public key: string;
public mut value: uint;
}

#[boxed]
public struct MapStringUsize {
mut pairs: []mut StringUsize;
public struct MapStringUint {
mut pairs: []mut StringUint;

public func set(mut self, key: string, value: uint) {
for pair in self.pairs {
Expand All @@ -22,7 +22,7 @@ public struct MapStringUsize {
}
}
// new value
self.pairs.push(StringUsize(key, value));
self.pairs.push(StringUint(key, value));
}

public func get(self, key: string) -> ?uint {
Expand Down

0 comments on commit 6087568

Please sign in to comment.