Skip to content

Commit 1a76dd0

Browse files
committed
chore(all): v. 1.4.0
1 parent 030ceb2 commit 1a76dd0

File tree

2 files changed

+9
-26
lines changed

2 files changed

+9
-26
lines changed

src/scanner/scan.ts

+9-17
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,9 @@ export function scan(
342342

343343
if (char === Chars.QuestionMark) {
344344
parser.index++;
345-
if (source.charCodeAt(parser.index) === Chars.EqualSign) {
346-
parser.index++;
347-
return Token.CoalesceAssign;
348-
}
349-
350-
return Token.Coalesce;
345+
if (source.charCodeAt(parser.index) !== Chars.EqualSign) return Token.Coalesce;
346+
parser.index++;
347+
return Token.CoalesceAssign;
351348
}
352349

353350
return Token.QuestionMark;
@@ -456,11 +453,9 @@ export function scan(
456453

457454
if (char === Chars.VerticalBar) {
458455
parser.index++;
459-
if (source.charCodeAt(parser.index) === Chars.EqualSign) {
460-
parser.index++;
461-
return Token.LogicalOrAssign;
462-
}
463-
return Token.LogicalOr;
456+
if (source.charCodeAt(parser.index) !== Chars.EqualSign) return Token.LogicalOr;
457+
parser.index++;
458+
return Token.LogicalOrAssign;
464459
}
465460

466461
if (char === Chars.EqualSign) {
@@ -476,12 +471,9 @@ export function scan(
476471

477472
if (char === Chars.Ampersand) {
478473
parser.index++;
479-
if (source.charCodeAt(parser.index) === Chars.EqualSign) {
480-
parser.index++;
481-
return Token.LogicalAndAssign;
482-
}
483-
484-
return Token.LogicalAnd;
474+
if (source.charCodeAt(parser.index) !== Chars.EqualSign) return Token.LogicalAnd;
475+
parser.index++;
476+
return Token.LogicalAndAssign;
485477
}
486478

487479
if (char === Chars.EqualSign) {

test/scanner/punctuators.ts

-9
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,6 @@ import { create } from '../../src/parser/core';
44
import { Token } from '../../src/token';
55
import { scan } from '../../src/scanner/scan';
66

7-
function convertDecimalToBinary(digit: any, groups: boolean): string {
8-
let res = '';
9-
for (let i = 0, shifted = digit; i < 32; i++, res += String(shifted >>> 31), shifted <<= 1);
10-
// Makes a groups of 8 bits
11-
if (groups) res = res.replace(/\B(?=(.{8})+(?!.))/g, '_');
12-
return res;
13-
}
14-
15-
console.log(convertDecimalToBinary(67109002, false));
167
describe('Scanner - Punctuator', () => {
178
describe('scan()', () => {
189
interface Opts {

0 commit comments

Comments
 (0)