Skip to content

Commit

Permalink
[lib/util] Simplify DataReader constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
titzer committed Jan 29, 2024
1 parent cdd4c0a commit d4519da
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/util/DataReader.v3
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class DataReader {
def var data: Range<byte>; // array containing data
def var pos: int; // current position
def var limit: int; // read limit within array
def var limit: int = data.length; // read limit within array
def var pos_offset: int; // address of pos = 0

def var ok: bool = true; // true if no error
Expand All @@ -22,10 +22,7 @@ class DataReader {
var onEOF = DataReader.setEOFError; // EOF callback
var onError = DataReader.setFirstError; // error callback

new(data) {
if (data == null) this.data = data = EMPTY_BYTES;
limit = data.length;
}
new(data) { }

// {true} if the input has been completely consumed
def done() -> bool {
Expand Down

0 comments on commit d4519da

Please sign in to comment.