33/* @flow */
44
55export type FunctionBreakpoint = { function : string }
6- export type LineBreakpoint = { filePath : string , bufferRow : number }
6+ export type LineBreakpoint = { filePath : string , bufferRow : number }
77export type BreakpointLocation = LineBreakpoint | FunctionBreakpoint
88
99export default class Breakpoint {
10- location : BreakpointLocation ;
11- enabled : boolean ;
12- condition : ?string ;
10+ location : BreakpointLocation ;
11+ enabled : boolean ;
12+ condition : ?string ;
1313 activeBufferRow : ?number ;
1414
1515 constructor ( location : BreakpointLocation , condition ?: string ) {
16-
1716 if ( ! location . function && ( ! location . filePath || ! location . bufferRow ) ) {
1817 throw new TypeError ( 'location must be BreakpointLocation' )
1918 }
2019
21- this . location = location
22- this . condition = ( condition ) ? condition : null
23- this . enabled = true
20+ this . location = location
21+ this . condition = condition || null
22+ this . enabled = true
2423 this . activeBufferRow = null
2524 }
2625
@@ -33,14 +32,12 @@ export default class Breakpoint {
3332 }
3433
3534 equals ( other : Breakpoint ) : bool {
36-
3735 if ( this . location . function && other . location . function ) {
38-
3936 return ( this . location . function === other . location . function )
4037 } else if ( this . location . filePath && other . location . filePath ) {
41- const same_file = ( this . location . filePath === other . location . filePath )
38+ const sameFile = ( this . location . filePath === other . location . filePath )
4239
43- if ( same_file && this . location . bufferRow && other . location . bufferRow ) {
40+ if ( sameFile && this . location . bufferRow && other . location . bufferRow ) {
4441 return ( this . location . bufferRow === other . location . bufferRow )
4542 }
4643 }
@@ -49,9 +46,8 @@ export default class Breakpoint {
4946 }
5047
5148 toHumanized ( ) : string {
52-
5349 if ( this . location . filePath && this . location . bufferRow ) {
54- return this . location . filePath + ':' + ( this . location . bufferRow + 1 )
50+ return ` ${ this . location . filePath } : ${ this . location . bufferRow + 1 } `
5551 }
5652
5753 return '?'
0 commit comments