BREAKING: Remove Deno.EOF, use null instead (#4953)

This commit is contained in:
Nayeem Rahman 2020-04-28 17:40:43 +01:00 committed by GitHub
parent 47c2f034e9
commit 678313b176
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 329 additions and 325 deletions

View file

@ -1,7 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { sendAsyncMinimal, sendSyncMinimal } from "./dispatch_minimal.ts";
import { EOF } from "../io.ts";
// TODO(bartlomieju): remove this import and maybe lazy-initialize
// OPS_CACHE that belongs only to this module
import { OPS_CACHE } from "../runtime.ts";
@ -10,7 +9,7 @@ import { OPS_CACHE } from "../runtime.ts";
let OP_READ = -1;
let OP_WRITE = -1;
export function readSync(rid: number, buffer: Uint8Array): number | EOF {
export function readSync(rid: number, buffer: Uint8Array): number | null {
if (buffer.length == 0) {
return 0;
}
@ -21,7 +20,7 @@ export function readSync(rid: number, buffer: Uint8Array): number | EOF {
if (nread < 0) {
throw new Error("read error");
} else if (nread == 0) {
return EOF;
return null;
} else {
return nread;
}
@ -30,7 +29,7 @@ export function readSync(rid: number, buffer: Uint8Array): number | EOF {
export async function read(
rid: number,
buffer: Uint8Array
): Promise<number | EOF> {
): Promise<number | null> {
if (buffer.length == 0) {
return 0;
}
@ -41,7 +40,7 @@ export async function read(
if (nread < 0) {
throw new Error("read error");
} else if (nread == 0) {
return EOF;
return null;
} else {
return nread;
}