Fix ESLint warnings (and one actual bug)

This commit is contained in:
Joshua Bell 2023-01-04 19:34:48 -08:00
parent 7a8c663315
commit cc5806e482
3 changed files with 16 additions and 21 deletions

View File

@ -1233,7 +1233,7 @@ this.basic = (function() {
(function(source) {
function munge(kw) {
// Escape special characters
function escape(c) { return (/[\[\]\\\^\$\.\|\?\*\+\(\)]/).test(c) ? '\\' + c : c; }
function escape(c) { return (/[[\]\\^$.|?*+()]/).test(c) ? '\\' + c : c; }
// Allow linear whitespace between characters
//return kw.split('').map(escape).join('[ \\t]*');
@ -1268,9 +1268,9 @@ this.basic = (function() {
var regexReservedWords = new RegExp("^(" + RESERVED_WORDS.map(munge).join("|") + ")", "i"),
regexIdentifier = /^([A-Za-z][A-Za-z0-9]?)[A-Za-z0-9]*(\$|%)?/,
regexStringLiteral = /^"([^"]*?)(?:"|(?=\n|\r|$))/,
regexNumberLiteral = /^[0-9]*\.?[0-9]+(?:[eE]\s*[\-+]?\s*[0-9]+)?/,
regexNumberLiteral = /^[0-9]*\.?[0-9]+(?:[eE]\s*[-+]?\s*[0-9]+)?/,
regexHexLiteral = /^\$[0-9A-Fa-f]+/,
regexOperator = /^[;=<>+\-*\/\^(),]/,
regexOperator = /^[;=<>+\-*/^(),]/,
regexLineNumber = /^[0-9]+/,
regexSeparator = /^:/,

23
dos.js
View File

@ -151,18 +151,13 @@ function DOS(tty) {
if (file === null) {
// Not cached - do a synchronous XmlHttpRequest for the file here
req = new XMLHttpRequest();
try {
url = "vfs/" + encodeURIComponent(filename.replace(/\./g, '_')) + ".txt";
async = false;
req.open("GET", url, async);
req.send(null);
if (req.status === 200 || req.status === 0) { // 0 for file:// protocol
file = req.responseText.replace(/\r\n/g, "\r");
vfs_set(filename, file);
}
} catch (e) {
// File doesn't exist - APPEND/READ will fail
throw e;
url = "vfs/" + encodeURIComponent(filename.replace(/\./g, '_')) + ".txt";
async = false;
req.open("GET", url, async);
req.send(null);
if (req.status === 200 || req.status === 0) { // 0 for file:// protocol
file = req.responseText.replace(/\r\n/g, "\r");
vfs_set(filename, file);
}
}
@ -179,7 +174,7 @@ function DOS(tty) {
// Normal open logic
open(filename, recordlength);
if (!buffers.hasOwnProperty(filename)) {
if (!Object.prototype.hasOwnProperty.call(buffers, filename)) {
doserror(DOSErrors.FILE_NOT_FOUND);
}
@ -196,7 +191,7 @@ function DOS(tty) {
// If not specified, close all buffers
if (!filename) {
for (fn in buffers) {
if (buffers.hasOwnProperty(fn)) {
if (Object.prototype.hasOwnProperty.call(buffers, fn)) {
close(fn);
}
}

View File

@ -87,7 +87,10 @@ function HiRes(element, width, height) {
err = dx - dy,
e2;
while (true) {
last_x = x;
last_y = y;
for (;;) {
this.plot(x0, y0);
if (x0 === x1 && y0 === y1) { return; }
@ -101,9 +104,6 @@ function HiRes(element, width, height) {
y0 += sy;
}
}
last_x = x;
last_y = y;
};
this.getPixel = function(x, y) {