Fix explicit access

This commit is contained in:
Daniel Imms
2020-04-14 06:23:11 -07:00
parent a5ebb6d98c
commit 9817754f92
31 changed files with 303 additions and 303 deletions
+52 -52
View File
@@ -13,7 +13,7 @@ import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEventType, ICharset } from
import { UnicodeV6 } from 'common/input/UnicodeV6';
export class MockBufferService implements IBufferService {
serviceBrand: any;
public serviceBrand: any;
public get buffer(): IBuffer { return this.buffers.active; }
public buffers: IBufferSet = {} as any;
constructor(
@@ -23,86 +23,86 @@ export class MockBufferService implements IBufferService {
) {
this.buffers = new BufferSet(optionsService, this);
}
resize(cols: number, rows: number): void {
public resize(cols: number, rows: number): void {
this.cols = cols;
this.rows = rows;
}
reset(): void {}
public reset(): void {}
}
export class MockCoreMouseService implements ICoreMouseService {
activeEncoding: string = '';
activeProtocol: string = '';
addEncoding(name: string): void {}
addProtocol(name: string): void {}
reset(): void {}
triggerMouseEvent(event: ICoreMouseEvent): boolean { return false; }
onProtocolChange: IEvent<CoreMouseEventType> = new EventEmitter<CoreMouseEventType>().event;
explainEvents(events: CoreMouseEventType): {[event: string]: boolean} {
public activeEncoding: string = '';
public activeProtocol: string = '';
public addEncoding(name: string): void {}
public addProtocol(name: string): void {}
public reset(): void {}
public triggerMouseEvent(event: ICoreMouseEvent): boolean { return false; }
public onProtocolChange: IEvent<CoreMouseEventType> = new EventEmitter<CoreMouseEventType>().event;
public explainEvents(events: CoreMouseEventType): {[event: string]: boolean} {
throw new Error('Method not implemented.');
}
}
export class MockCharsetService implements ICharsetService {
serviceBrand: any;
charset: ICharset | undefined;
glevel: number = 0;
charsets: ReadonlyArray<ICharset> = [];
reset(): void {}
setgLevel(g: number): void {}
setgCharset(g: number, charset: ICharset): void {}
public serviceBrand: any;
public charset: ICharset | undefined;
public glevel: number = 0;
public charsets: ReadonlyArray<ICharset> = [];
public reset(): void {}
public setgLevel(g: number): void {}
public setgCharset(g: number, charset: ICharset): void {}
}
export class MockCoreService implements ICoreService {
serviceBrand: any;
isCursorInitialized: boolean = false;
isCursorHidden: boolean = false;
isFocused: boolean = false;
decPrivateModes: IDecPrivateModes = {
public serviceBrand: any;
public isCursorInitialized: boolean = false;
public isCursorHidden: boolean = false;
public isFocused: boolean = false;
public decPrivateModes: IDecPrivateModes = {
applicationCursorKeys: false,
applicationKeypad: false,
origin: false,
wraparound: true
};
onData: IEvent<string> = new EventEmitter<string>().event;
onUserInput: IEvent<void> = new EventEmitter<void>().event;
onBinary: IEvent<string> = new EventEmitter<string>().event;
reset(): void {}
triggerDataEvent(data: string, wasUserInput?: boolean): void {}
triggerBinaryEvent(data: string): void {}
public onData: IEvent<string> = new EventEmitter<string>().event;
public onUserInput: IEvent<void> = new EventEmitter<void>().event;
public onBinary: IEvent<string> = new EventEmitter<string>().event;
public reset(): void {}
public triggerDataEvent(data: string, wasUserInput?: boolean): void {}
public triggerBinaryEvent(data: string): void {}
}
export class MockDirtyRowService implements IDirtyRowService {
serviceBrand: any;
start: number = 0;
end: number = 0;
clearRange(): void {}
markDirty(y: number): void {}
markRangeDirty(y1: number, y2: number): void {}
markAllDirty(): void {}
public serviceBrand: any;
public start: number = 0;
public end: number = 0;
public clearRange(): void {}
public markDirty(y: number): void {}
public markRangeDirty(y1: number, y2: number): void {}
public markAllDirty(): void {}
}
export class MockLogService implements ILogService {
serviceBrand: any;
debug(message: any, ...optionalParams: any[]): void {}
info(message: any, ...optionalParams: any[]): void {}
warn(message: any, ...optionalParams: any[]): void {}
error(message: any, ...optionalParams: any[]): void {}
public serviceBrand: any;
public debug(message: any, ...optionalParams: any[]): void {}
public info(message: any, ...optionalParams: any[]): void {}
public warn(message: any, ...optionalParams: any[]): void {}
public error(message: any, ...optionalParams: any[]): void {}
}
export class MockOptionsService implements IOptionsService {
serviceBrand: any;
options: ITerminalOptions = clone(DEFAULT_OPTIONS);
onOptionChange: IEvent<string> = new EventEmitter<string>().event;
public serviceBrand: any;
public options: ITerminalOptions = clone(DEFAULT_OPTIONS);
public onOptionChange: IEvent<string> = new EventEmitter<string>().event;
constructor(testOptions?: IPartialTerminalOptions) {
if (testOptions) {
Object.keys(testOptions).forEach(key => this.options[key] = (<any>testOptions)[key]);
}
}
setOption<T>(key: string, value: T): void {
public setOption<T>(key: string, value: T): void {
throw new Error('Method not implemented.');
}
getOption<T>(key: string): T {
public getOption<T>(key: string): T {
throw new Error('Method not implemented.');
}
}
@@ -110,14 +110,14 @@ export class MockOptionsService implements IOptionsService {
// defaults to V6 always to keep tests passing
export class MockUnicodeService implements IUnicodeService {
private _provider = new UnicodeV6();
register(provider: IUnicodeVersionProvider): void {
public register(provider: IUnicodeVersionProvider): void {
throw new Error('Method not implemented.');
}
versions: string[] = [];
activeVersion: string = '';
onChange: IEvent<string> = new EventEmitter<string>().event;
wcwidth = (codepoint: number): number => this._provider.wcwidth(codepoint);
getStringCellWidth(s: string): number {
public versions: string[] = [];
public activeVersion: string = '';
public onChange: IEvent<string> = new EventEmitter<string>().event;
public wcwidth = (codepoint: number): number => this._provider.wcwidth(codepoint);
public getStringCellWidth(s: string): number {
throw new Error('Method not implemented.');
}
}
+3 -3
View File
@@ -7,15 +7,15 @@ import { IAttributeData, IColorRGB } from 'common/Types';
import { Attributes, FgFlags, BgFlags } from 'common/buffer/Constants';
export class AttributeData implements IAttributeData {
static toColorRGB(value: number): IColorRGB {
public static toColorRGB(value: number): IColorRGB {
return [
value >>> Attributes.RED_SHIFT & 255,
value >>> Attributes.GREEN_SHIFT & 255,
value & 255
];
}
static fromColorRGB(value: IColorRGB): number {
public static fromColorRGB(value: IColorRGB): number {
return (value[0] & 255) << Attributes.RED_SHIFT | (value[1] & 255) << Attributes.GREEN_SHIFT | value[2] & 255;
}
+2 -2
View File
@@ -64,7 +64,7 @@ export class StringToUtf32 {
* the provided input data does not exceed the size of `target`.
* Returns the number of written codepoints in `target`.
*/
decode(input: string, target: Uint32Array): number {
public decode(input: string, target: Uint32Array): number {
const length = input.length;
if (!length) {
@@ -132,7 +132,7 @@ export class Utf8ToUtf32 {
* the provided data chunk does not exceed the size of `target`.
* Returns the number of written codepoints in `target`.
*/
decode(input: Uint8Array, target: Uint32Array): number {
public decode(input: Uint8Array, target: Uint32Array): number {
const length = input.length;
if (!length) {
+3 -3
View File
@@ -55,13 +55,13 @@ function identifier(id: IFunctionIdentifier): number {
class TestHandler implements IDcsHandler {
constructor(public output: any[], public msg: string, public returnFalse: boolean = false) {}
hook(params: IParams): void {
public hook(params: IParams): void {
this.output.push([this.msg, 'HOOK', params.toArray()]);
}
put(data: Uint32Array, start: number, end: number): void {
public put(data: Uint32Array, start: number, end: number): void {
this.output.push([this.msg, 'PUT', utf32ToString(data, start, end)]);
}
unhook(success: boolean): void | boolean {
public unhook(success: boolean): void | boolean {
this.output.push([this.msg, 'UNHOOK', success]);
if (this.returnFalse) {
return false;
@@ -41,16 +41,16 @@ class MockOscPutParser implements IOscParser {
this._fallback(id, 'END', this.data.slice(this.data.indexOf(';') + 1));
}
}
addHandler(ident: number, handler: IOscHandler): IDisposable {
public addHandler(ident: number, handler: IOscHandler): IDisposable {
throw new Error('not implemented');
}
setHandler(ident: number, handler: IOscHandler): void {
public setHandler(ident: number, handler: IOscHandler): void {
throw new Error('not implemented');
}
clearHandler(ident: number): void {
public clearHandler(ident: number): void {
throw new Error('not implemented');
}
setHandlerFallback(handler: OscFallbackHandlerType): void {
public setHandlerFallback(handler: OscFallbackHandlerType): void {
this._fallback = handler;
}
}
+3 -3
View File
@@ -17,13 +17,13 @@ function toUtf32(s: string): Uint32Array {
class TestHandler implements IOscHandler {
constructor(public id: number, public output: any[], public msg: string, public returnFalse: boolean = false) {}
start(): void {
public start(): void {
this.output.push([this.msg, this.id, 'START']);
}
put(data: Uint32Array, start: number, end: number): void {
public put(data: Uint32Array, start: number, end: number): void {
this.output.push([this.msg, this.id, 'PUT', utf32ToString(data, start, end)]);
}
end(success: boolean): void | boolean {
public end(success: boolean): void | boolean {
this.output.push([this.msg, this.id, 'END', success]);
if (this.returnFalse) {
return false;
+1 -1
View File
@@ -11,7 +11,7 @@ export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
export const MINIMUM_ROWS = 1;
export class BufferService implements IBufferService {
serviceBrand: any;
public serviceBrand: any;
public cols: number;
public rows: number;
+1 -1
View File
@@ -7,7 +7,7 @@ import { ICharsetService } from 'common/services/Services';
import { ICharset } from 'common/Types';
export class CharsetService implements ICharsetService {
serviceBrand: any;
public serviceBrand: any;
public charset: ICharset | undefined;
public charsets: ICharset[] = [];
+1 -1
View File
@@ -16,7 +16,7 @@ const DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({
});
export class CoreService implements ICoreService {
serviceBrand: any;
public serviceBrand: any;
public isCursorInitialized: boolean = false;
public isCursorHidden: boolean = false;
+1 -1
View File
@@ -6,7 +6,7 @@
import { IBufferService, IDirtyRowService } from 'common/services/Services';
export class DirtyRowService implements IDirtyRowService {
serviceBrand: any;
public serviceBrand: any;
private _start!: number;
private _end!: number;
+4 -4
View File
@@ -22,21 +22,21 @@ export class ServiceCollection {
}
}
set<T>(id: IServiceIdentifier<T>, instance: T): T {
public set<T>(id: IServiceIdentifier<T>, instance: T): T {
const result = this._entries.get(id);
this._entries.set(id, instance);
return result;
}
forEach(callback: (id: IServiceIdentifier<any>, instance: any) => any): void {
public forEach(callback: (id: IServiceIdentifier<any>, instance: any) => any): void {
this._entries.forEach((value, key) => callback(key, value));
}
has(id: IServiceIdentifier<any>): boolean {
public has(id: IServiceIdentifier<any>): boolean {
return this._entries.has(id);
}
get<T>(id: IServiceIdentifier<T>): T | undefined {
public get<T>(id: IServiceIdentifier<T>): T | undefined {
return this._entries.get(id);
}
}
+5 -5
View File
@@ -39,7 +39,7 @@ const optionsKeyToLogLevel: { [key: string]: LogLevel } = {
const LOG_PREFIX = 'xterm.js: ';
export class LogService implements ILogService {
serviceBrand: any;
public serviceBrand: any;
private _logLevel!: LogLevel;
@@ -71,25 +71,25 @@ export class LogService implements ILogService {
type.call(console, LOG_PREFIX + message, ...optionalParams);
}
debug(message: string, ...optionalParams: any[]): void {
public debug(message: string, ...optionalParams: any[]): void {
if (this._logLevel <= LogLevel.DEBUG) {
this._log(console.log, message, optionalParams);
}
}
info(message: string, ...optionalParams: any[]): void {
public info(message: string, ...optionalParams: any[]): void {
if (this._logLevel <= LogLevel.INFO) {
this._log(console.info, message, optionalParams);
}
}
warn(message: string, ...optionalParams: any[]): void {
public warn(message: string, ...optionalParams: any[]): void {
if (this._logLevel <= LogLevel.WARN) {
this._log(console.warn, message, optionalParams);
}
}
error(message: string, ...optionalParams: any[]): void {
public error(message: string, ...optionalParams: any[]): void {
if (this._logLevel <= LogLevel.ERROR) {
this._log(console.error, message, optionalParams);
}
+1 -1
View File
@@ -60,7 +60,7 @@ export const DEFAULT_OPTIONS: ITerminalOptions = Object.freeze({
const CONSTRUCTOR_ONLY_OPTIONS = ['cols', 'rows'];
export class OptionsService implements IOptionsService {
serviceBrand: any;
public serviceBrand: any;
public options: ITerminalOptions;
+2 -2
View File
@@ -8,8 +8,8 @@ import { UnicodeService } from 'common/services/UnicodeService';
import { IUnicodeVersionProvider } from 'common/services/Services';
class DummyProvider implements IUnicodeVersionProvider {
version = '123';
wcwidth(n: number): 0 | 1 | 2 {
public version = '123';
public wcwidth(n: number): 0 | 1 | 2 {
return 2;
}
}