mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
check for empty key/value (not doing so caused problems for set)
This commit is contained in:
parent
60edbaffee
commit
2166b1355b
1 changed files with 8 additions and 0 deletions
|
@ -264,6 +264,10 @@ pub const RocDict = extern struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setKey(self: *RocDict, index: usize, alignment: Alignment, key_width: usize, value_width: usize, data: Opaque) void {
|
fn setKey(self: *RocDict, index: usize, alignment: Alignment, key_width: usize, value_width: usize, data: Opaque) void {
|
||||||
|
if (key_width == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const offset = blk: {
|
const offset = blk: {
|
||||||
if (alignment.keyFirst()) {
|
if (alignment.keyFirst()) {
|
||||||
break :blk (index * key_width);
|
break :blk (index * key_width);
|
||||||
|
@ -293,6 +297,10 @@ pub const RocDict = extern struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setValue(self: *RocDict, index: usize, alignment: Alignment, key_width: usize, value_width: usize, data: Opaque) void {
|
fn setValue(self: *RocDict, index: usize, alignment: Alignment, key_width: usize, value_width: usize, data: Opaque) void {
|
||||||
|
if (value_width == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const offset = blk: {
|
const offset = blk: {
|
||||||
if (alignment.keyFirst()) {
|
if (alignment.keyFirst()) {
|
||||||
break :blk (self.capacity() * key_width) + (index * value_width);
|
break :blk (self.capacity() * key_width) + (index * value_width);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue