Skip to content

Commit eb1aa5c

Browse files
Yuyupoyichoi
authored andcommitted
Visibility and return type for functions (#32)
IoT.js-Debug-DCO-1.0-Signed-off-by: Daniella Barsony [email protected]
1 parent 606c110 commit eb1aa5c

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

src/JerryBreakpoints.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class Breakpoint {
4646
}
4747
}
4848

49-
toString() {
49+
public toString(): string {
5050
const sourceName = this.func.sourceName || '<unknown>';
5151

5252
let detail = '';

src/JerryDebuggerClient.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class JerryDebuggerClient {
4444
this.port = options.port || DEFAULT_DEBUGGER_PORT;
4545
}
4646

47-
connect(): Promise<void> {
47+
public connect(): Promise<void> {
4848
if (this.connectPromise) {
4949
return this.connectPromise;
5050
}
@@ -72,24 +72,24 @@ export class JerryDebuggerClient {
7272
return this.connectPromise;
7373
}
7474

75-
disconnect() {
75+
public disconnect(): void {
7676
if (this.socket) {
7777
this.socket.close();
7878
this.socket = undefined;
7979
}
8080
}
8181

82-
onMessage(data: ArrayBuffer) {
82+
private onMessage(data: ArrayBuffer): void {
8383
this.delegate.onMessage(new Uint8Array(data));
8484
}
8585

86-
onClose() {
86+
private onClose(): void {
8787
if (this.delegate.onClose) {
8888
this.delegate.onClose();
8989
}
9090
}
9191

92-
send(data: Uint8Array): boolean {
92+
public send(data: Uint8Array): boolean {
9393
this.socket!.send(data, () => {
9494
return false;
9595
});

src/JerryProtocolHandler.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export class JerryDebugProtocolHandler {
192192
}
193193

194194
// FIXME: this lets test suite run for now
195-
unused() {
195+
public unused(): void {
196196
// tslint:disable-next-line no-unused-expression
197197
this.lastBreakpointExact;
198198
}
@@ -220,7 +220,7 @@ export class JerryDebugProtocolHandler {
220220
return this.resumeExec(SP.CLIENT.JERRY_DEBUGGER_CONTINUE);
221221
}
222222

223-
getPossibleBreakpoints(scriptId: number, startLine: number, endLine?: number): Array<Breakpoint> {
223+
public getPossibleBreakpoints(scriptId: number, startLine: number, endLine?: number): Array<Breakpoint> {
224224
const array = [];
225225
const lineList = this.lineLists[scriptId];
226226
for (const line in lineList) {
@@ -236,18 +236,18 @@ export class JerryDebugProtocolHandler {
236236
return array;
237237
}
238238

239-
getSource(scriptId: number) {
239+
public getSource(scriptId: number): string {
240240
if (scriptId < this.sources.length) {
241241
return this.sources[scriptId].source || '';
242242
}
243243
return '';
244244
}
245245

246-
decodeMessage(format: string, message: Uint8Array, offset: number) {
246+
public decodeMessage(format: string, message: Uint8Array, offset: number): any {
247247
return decodeMessage(this.byteConfig, format, message, offset);
248248
}
249249

250-
onConfiguration(data: Uint8Array) {
250+
public onConfiguration(data: Uint8Array): void {
251251
this.logPacket('Configuration');
252252
if (data.length < 5) {
253253
this.abort('configuration message wrong size');
@@ -268,7 +268,7 @@ export class JerryDebugProtocolHandler {
268268
}
269269
}
270270

271-
onByteCodeCP(data: Uint8Array) {
271+
public onByteCodeCP(data: Uint8Array): void {
272272
this.logPacket('Byte Code CP', true);
273273
if (this.evalsPending) {
274274
return;
@@ -313,7 +313,7 @@ export class JerryDebugProtocolHandler {
313313
this.newFunctions = {};
314314
}
315315

316-
onParseFunction(data: Uint8Array) {
316+
public onParseFunction(data: Uint8Array): void {
317317
this.logPacket('Parse Function');
318318
const position = this.decodeMessage('II', data, 1);
319319
this.stack.push({
@@ -331,7 +331,7 @@ export class JerryDebugProtocolHandler {
331331
return;
332332
}
333333

334-
onBreakpointList(data: Uint8Array) {
334+
public onBreakpointList(data: Uint8Array): void {
335335
this.logPacket('Breakpoint List', true);
336336
if (this.evalsPending) {
337337
return;
@@ -354,7 +354,7 @@ export class JerryDebugProtocolHandler {
354354
}
355355
}
356356

357-
onSourceCode(data: Uint8Array) {
357+
public onSourceCode(data: Uint8Array): void {
358358
this.logPacket('Source Code', true);
359359
if (this.evalsPending) {
360360
return;
@@ -391,7 +391,7 @@ export class JerryDebugProtocolHandler {
391391
}
392392
}
393393

394-
onSourceCodeName(data: Uint8Array) {
394+
public onSourceCodeName(data: Uint8Array): void {
395395
this.logPacket('Source Code Name');
396396
this.sourceNameData = assembleUint8Arrays(this.sourceNameData, data);
397397
if (data[0] === SP.SERVER.JERRY_DEBUGGER_SOURCE_CODE_NAME_END) {
@@ -402,7 +402,7 @@ export class JerryDebugProtocolHandler {
402402
}
403403
}
404404

405-
onFunctionName(data: Uint8Array) {
405+
private onFunctionName(data: Uint8Array): void {
406406
this.logPacket('Function Name');
407407
this.functionNameData = assembleUint8Arrays(this.functionNameData, data);
408408
if (data[0] === SP.SERVER.JERRY_DEBUGGER_FUNCTION_NAME_END) {
@@ -411,7 +411,7 @@ export class JerryDebugProtocolHandler {
411411
}
412412
}
413413

414-
releaseFunction(byteCodeCP: number) {
414+
public releaseFunction(byteCodeCP: number): void {
415415
const func = this.functions[byteCodeCP];
416416

417417
const lineList = this.lineLists[func.scriptId];
@@ -429,7 +429,7 @@ export class JerryDebugProtocolHandler {
429429
delete this.functions[byteCodeCP];
430430
}
431431

432-
onReleaseByteCodeCP(data: Uint8Array) {
432+
private onReleaseByteCodeCP(data: Uint8Array): void {
433433
this.logPacket('Release Byte Code CP', true);
434434
if (!this.evalsPending) {
435435
const byteCodeCP = this.decodeMessage('C', data, 1)[0];
@@ -445,7 +445,7 @@ export class JerryDebugProtocolHandler {
445445
this.sendSimpleRequest(data);
446446
}
447447

448-
getBreakpoint(breakpointData: Array<number>) {
448+
private getBreakpoint(breakpointData: Array<number>): JerryMessageBreakpointHit {
449449
const func = this.functions[breakpointData[0]];
450450
const offset = breakpointData[1];
451451

@@ -477,7 +477,7 @@ export class JerryDebugProtocolHandler {
477477
};
478478
}
479479

480-
onBreakpointHit(data: Uint8Array) {
480+
public onBreakpointHit(data: Uint8Array): void {
481481
if (data[0] === SP.SERVER.JERRY_DEBUGGER_BREAKPOINT_HIT) {
482482
this.logPacket('Breakpoint Hit');
483483
} else {
@@ -520,7 +520,7 @@ export class JerryDebugProtocolHandler {
520520
}
521521
}
522522

523-
onBacktrace(data: Uint8Array): Breakpoint[] {
523+
public onBacktrace(data: Uint8Array): Breakpoint[] {
524524
this.logPacket('Backtrace');
525525
for (let i = 1; i < data.byteLength; i += this.byteConfig.cpointerSize + 4) {
526526
const breakpointData = this.decodeMessage('CI', data, i);
@@ -568,7 +568,7 @@ export class JerryDebugProtocolHandler {
568568
return result;
569569
}
570570

571-
onMessage(message: Uint8Array) {
571+
public onMessage(message: Uint8Array): void {
572572
if (message.byteLength < 1) {
573573
this.abort('message too short');
574574
return;
@@ -606,7 +606,7 @@ export class JerryDebugProtocolHandler {
606606
}
607607
}
608608

609-
getLastBreakpoint() {
609+
public getLastBreakpoint(): Breakpoint {
610610
return this.lastBreakpointHit;
611611
}
612612

@@ -616,7 +616,7 @@ export class JerryDebugProtocolHandler {
616616
throw new Error('no such source');
617617
}
618618

619-
getActiveBreakpoint(breakpointId: number) {
619+
public getActiveBreakpoint(breakpointId: number): Breakpoint {
620620
return this.activeBreakpoints[breakpointId];
621621
}
622622

@@ -695,7 +695,7 @@ export class JerryDebugProtocolHandler {
695695
]));
696696
}
697697

698-
requestBacktrace() {
698+
public requestBacktrace(): Promise<any> {
699699
if (!this.lastBreakpointHit) {
700700
return Promise.reject('backtrace not allowed while app running');
701701
}
@@ -768,7 +768,7 @@ export class JerryDebugProtocolHandler {
768768
return this.sendSimpleRequest(encodeMessage(this.byteConfig, 'B', [code]));
769769
}
770770

771-
onWaitForSource() {
771+
public onWaitForSource(): void {
772772
this.waitForSourceEnabled = true;
773773
if (this.delegate.onWaitForSource) {
774774
this.delegate.onWaitForSource();
@@ -805,7 +805,7 @@ export class JerryDebugProtocolHandler {
805805
return true;
806806
}
807807

808-
onExceptionStr(data: Uint8Array) {
808+
private onExceptionStr(data: Uint8Array): void {
809809
this.logPacket('onExceptionStr');
810810
this.exceptionData = assembleUint8Arrays(this.exceptionData, data);
811811
if (data[0] === SP.SERVER.JERRY_DEBUGGER_EXCEPTION_STR_END) {

0 commit comments

Comments
 (0)