@@ -470,6 +470,8 @@ function createCommandContext(inspector) {
470470 const scripts = { } ;
471471 const watchedExpressions = [ ] ;
472472
473+ const breakPoints = new Map ( ) ;
474+
473475 // Clear current line
474476 function clearline ( ) {
475477 if ( stdout . isTTY ) {
@@ -525,6 +527,20 @@ function createCommandContext(inspector) {
525527 return ctx . debugEval ( code ) ;
526528 } ,
527529
530+ setBreakpoint ( script , line , condition , silent ) {
531+ const registerBreakpoint = ( { breakpointId, actualLocation } ) => {
532+ breakPoints . set ( breakpointId , actualLocation ) ;
533+ } ;
534+
535+ // setBreakpoint()
536+ if ( script === undefined ) {
537+ // set breakpoint at current location
538+ return Debugger . setBreakpoint ( { location : currentSourceLocation , condition } )
539+ . then ( registerBreakpoint ) ;
540+ }
541+ throw new Error ( 'Not implemented' ) ;
542+ } ,
543+
528544 get cont ( ) {
529545 return Debugger . resume ( ) ;
530546 } ,
@@ -572,7 +588,13 @@ function createCommandContext(inspector) {
572588 lineText = markSourceColumn ( lineText , columnNumber , inspector . repl ) ;
573589 }
574590
575- const isBreakpoint = false ; // TODO: show breakpoints
591+ let isBreakpoint = false ;
592+ breakPoints . forEach ( actualLocation => {
593+ if ( actualLocation . scriptId === scriptId && ( actualLocation . lineNumber + 1 ) === i ) {
594+ isBreakpoint = true ;
595+ }
596+ } ) ;
597+
576598 let prefixChar = ' ' ;
577599 if ( isCurrent ) {
578600 prefixChar = '>' ;
0 commit comments