Skip to content

Commit

Permalink
types: minor refactor to avoid duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
CanadaHonk committed Jan 8, 2025
1 parent 27c32b6 commit 2da00e2
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions compiler/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,9 @@ registerInternalType('Map');
registerInternalType('ArrayBuffer');
registerInternalType('SharedArrayBuffer');
registerInternalType('DataView');
registerInternalType('Uint8Array', ['iterable', 'length']);
registerInternalType('Int8Array', ['iterable', 'length']);
registerInternalType('Uint8ClampedArray', ['iterable', 'length']);
registerInternalType('Uint16Array', ['iterable', 'length']);
registerInternalType('Int16Array', ['iterable', 'length']);
registerInternalType('Uint32Array', ['iterable', 'length']);
registerInternalType('Int32Array', ['iterable', 'length']);
registerInternalType('Float32Array', ['iterable', 'length']);
registerInternalType('Float64Array', ['iterable', 'length']);

for (const x of [ 'Uint8', 'Int8', 'Uint8Clamped', 'Uint16', 'Int16', 'Uint32', 'Int32', 'Float32', 'Float64' ])
registerInternalType(`${x}Array`, ['iterable', 'length']);

registerInternalType('WeakRef');
registerInternalType('WeakSet');
Expand All @@ -78,16 +72,8 @@ registerInternalType('BooleanObject');
registerInternalType('NumberObject');
registerInternalType('StringObject');

registerInternalType('Error');
registerInternalType('AggregateError');
registerInternalType('TypeError');
registerInternalType('ReferenceError');
registerInternalType('SyntaxError');
registerInternalType('RangeError');
registerInternalType('EvalError');
registerInternalType('URIError');
registerInternalType('Test262Error');
registerInternalType('TodoError');
for (const x of [ '', 'Aggregate', 'Type', 'Reference', 'Syntax', 'Range', 'Eval', 'URI', 'Test262', 'Todo' ])
registerInternalType(`${x}Error`);

registerInternalType('__Porffor_Generator');
registerInternalType('__Porffor_AsyncGenerator');
Expand Down

0 comments on commit 2da00e2

Please sign in to comment.