Skip to content

Commit

Permalink
Added readonly flag to non-reassigned attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
lvcabral committed Dec 13, 2024
1 parent 912ee53 commit 2a02f16
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 41 deletions.
6 changes: 3 additions & 3 deletions src/core/brsTypes/components/RoAudioPlayerEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { MediaEvent } from "../../common";

export class RoAudioPlayerEvent extends BrsComponent implements BrsValue {
readonly kind = ValueKind.Object;
private flags: number;
private index: number;
private message: string;
private readonly flags: number;
private readonly index: number;
private readonly message: string;

constructor(flags: number, index: number) {
super("roAudioPlayerEvent");
Expand Down
8 changes: 4 additions & 4 deletions src/core/brsTypes/components/RoAudioResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { DataType } from "../../common";

export class RoAudioResource extends BrsComponent implements BrsValue {
readonly kind = ValueKind.Object;
private audioName: string;
private audioId?: number;
private readonly audioName: string;
private readonly audioId?: number;
private readonly maxStreams: number;
private readonly valid: boolean;
private currentIndex: number;
private playing: boolean;
private maxStreams: number;
private valid: boolean;

constructor(interpreter: Interpreter, name: BrsString) {
super("roAudioResource");
Expand Down
2 changes: 1 addition & 1 deletion src/core/brsTypes/components/RoBitmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export class RoBitmap extends BrsComponent implements BrsValue {
private readonly height: number;
private readonly name: string;
private readonly disposeCanvas: boolean;
private readonly valid: boolean;
private alphaEnable: boolean;
private rgbaCanvas?: BrsCanvas;
private rgbaLast: number;
private rgbaRedraw: boolean;
private valid: boolean;

constructor(interpreter: Interpreter, param: BrsComponent) {
super("roBitmap");
Expand Down
4 changes: 2 additions & 2 deletions src/core/brsTypes/components/RoChannelStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { RoChannelStoreEvent } from "./RoChannelStoreEvent";
import { RoAssociativeArray, AAMember } from "./RoAssociativeArray";

export class RoChannelStore extends BrsComponent implements BrsValue {
private id: number;
readonly kind = ValueKind.Object;
private readonly id: number;
private order: BrsType[];
private credData: string;
private port?: RoMessagePort;
readonly kind = ValueKind.Object;

constructor() {
super("roChannelStore");
Expand Down
4 changes: 2 additions & 2 deletions src/core/brsTypes/components/RoChannelStoreEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { Int32 } from "../Int32";

export class RoChannelStoreEvent extends BrsComponent implements BrsValue {
readonly kind = ValueKind.Object;
private id: number;
private response?: BrsType[];
private readonly id: number;
private readonly response?: BrsType[];

constructor(id: number, response?: BrsType[]) {
super("roChannelStoreEvent");
Expand Down
10 changes: 5 additions & 5 deletions src/core/brsTypes/components/RoFont.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { BrsCanvasContext2D, createNewCanvas, releaseCanvas } from "../draw2d";

export class RoFont extends BrsComponent implements BrsValue {
readonly kind = ValueKind.Object;
private family: string;
private size: number;
private bold: boolean;
private italic: boolean;
private metrics: FontMetrics;
private readonly family: string;
private readonly size: number;
private readonly bold: boolean;
private readonly italic: boolean;
private readonly metrics: FontMetrics;

// Constructor can only be used by RoFontRegistry()
constructor(
Expand Down
8 changes: 4 additions & 4 deletions src/core/brsTypes/components/RoFontRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ export interface FontMetrics {

export class RoFontRegistry extends BrsComponent implements BrsValue {
readonly kind = ValueKind.Object;
readonly defaultFontSize = 40;
readonly fallbackFontFamily = "Arial, Helvetica, sans-serif";
private defaultFontFamily: string;
private fontRegistry: Map<string, FontMetrics[]>;
private readonly defaultFontSize = 40;
private readonly fallbackFontFamily = "Arial, Helvetica, sans-serif";
private readonly defaultFontFamily: string;
private readonly fontRegistry: Map<string, FontMetrics[]>;

constructor(interpreter: Interpreter) {
super("roFontRegistry");
Expand Down
4 changes: 2 additions & 2 deletions src/core/brsTypes/components/RoInputEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { Interpreter } from "../../interpreter";

export class RoInputEvent extends BrsComponent implements BrsValue {
readonly kind = ValueKind.Object;
readonly id: number;
readonly response?: BrsType;
private readonly id: number;
private readonly response?: BrsType;

constructor(response?: BrsType) {
super("roInputEvent");
Expand Down
2 changes: 1 addition & 1 deletion src/core/brsTypes/components/RoInvalid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Unboxable } from "../Boxing";

export class RoInvalid extends BrsComponent implements BrsValue, Unboxable {
readonly kind = ValueKind.Object;
private intrinsic: BrsInvalid;
private readonly intrinsic: BrsInvalid;

public getValue(): BrsInvalid {
return this.intrinsic;
Expand Down
2 changes: 1 addition & 1 deletion src/core/brsTypes/components/RoRegion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import UPNG from "upng-js";

export class RoRegion extends BrsComponent implements BrsValue {
readonly kind = ValueKind.Object;
private valid: boolean;
private readonly valid: boolean;
private alphaEnable: boolean;
private bitmap: RoBitmap | RoScreen;
private x: number;
Expand Down
4 changes: 2 additions & 2 deletions src/core/brsTypes/components/RoSprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { BrsImageData } from "../draw2d";

export class RoSprite extends BrsComponent implements BrsValue {
readonly kind = ValueKind.Object;
private readonly id: number;
private readonly regions?: RoArray;
private region: RoRegion;
private regions?: RoArray;
private id: number;
private x: number;
private y: number;
private z: number;
Expand Down
12 changes: 6 additions & 6 deletions src/core/brsTypes/components/RoURLEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { Int32 } from "../Int32";

export class RoURLEvent extends BrsComponent implements BrsValue, Comparable {
readonly kind = ValueKind.Object;
private id: number;
private responseCode: number;
private responseString: string;
private failureReason: string;
private headers: string;
private targetIp: string;
private readonly id: number;
private readonly responseCode: number;
private readonly responseString: string;
private readonly failureReason: string;
private readonly headers: string;
private readonly targetIp: string;

constructor(id: number, response: string, status: number, statusText: string, headers: string) {
super("roUrlEvent");
Expand Down
6 changes: 3 additions & 3 deletions src/core/brsTypes/components/RoVideoPlayerEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { MediaEvent } from "../../common";

export class RoVideoPlayerEvent extends BrsComponent implements BrsValue {
readonly kind = ValueKind.Object;
readonly flags: number;
readonly index: number;
readonly message: string;
private readonly flags: number;
private readonly index: number;
private readonly message: string;

constructor(flags: number, index: number) {
super("roVideoPlayerEvent");
Expand Down
2 changes: 1 addition & 1 deletion src/core/interpreter/FileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as nodeFS from "fs";
/** Proxy Object to make File System volumes case insensitive, same as Roku devices */

export class FileSystem {
private paths: Map<string, string>;
private readonly paths: Map<string, string>;
readonly root?: string;
readonly ext?: string;
readonly pfs: typeof zenFS.fs | typeof nodeFS; // pkg:
Expand Down
6 changes: 2 additions & 4 deletions src/core/preprocessor/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { EventEmitter } from "events";

import { Token } from "../lexer";

import { Parser } from "./Parser";
import { Preprocessor as InternalPreprocessor, FilterResults } from "./Preprocessor";

export class Preprocessor {
private parser = new Parser();
private _preprocessor = new InternalPreprocessor();
private readonly parser = new Parser();
private readonly _preprocessor = new InternalPreprocessor();

readonly events = new EventEmitter();

Expand Down

0 comments on commit 2a02f16

Please sign in to comment.