Skip to content

Commit

Permalink
Simplify State representation as generic record
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Dec 1, 2024
1 parent 5a430cf commit 4a544db
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public ACell get(Keyword key) {

@Override
public BlockResult updateRefs(IRefFunction func) {
State newState=state.updateRefs(func);
State newState=(State)state.updateRefs(func);
AVector<Result> newResults=results.updateRefs(func);
return create(newState,newResults);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public int getRefCount() {
return values.getRefCount();
}

@Override
public int encode(byte[] bs, int pos) {
bs[pos++]=tag;
return encodeRaw(bs,pos);
}

/**
* Writes the raw fields of this record in declared order
* @param bs Array to write to
Expand Down Expand Up @@ -83,7 +89,7 @@ public <R extends ACell> Ref<R> getRef(int index) {

@Override
public ARecordGeneric updateRefs(IRefFunction func) {
AVector<ACell> newValues=values.toVector().updateRefs(func); // ensure values are canonical via toVector
AVector<ACell> newValues=values.updateRefs(func); // ensure values are canonical via toVector
return withValues(newValues);
}

Expand Down
Loading

0 comments on commit 4a544db

Please sign in to comment.