test/debugger/debug/debug-return-value.js
// Listener which expects to do four steps to reach returning from the function.
Listener which expects to do four steps to reach returning from the function.
Listener which expects to do four steps to reach returning from the function .
function listener(event, exec_state, event_data, data) {
  try {
    if (event == Debug.DebugEvent.Break)
    {
      break_count++;
      if (break_count < 4) {
        switch (break_count) {
          case 1:
            debugger_source_position = exec_state.frame(0).sourcePosition();
            break;
          case 2:
            assertEquals(expected_source_position.shift() + debugger_source_position,
                         exec_state.frame(0).sourcePosition());
            break;
          case 3:
            assertEquals(expected_source_position.shift() + debugger_source_position,
                         exec_state.frame(0).sourcePosition());
            break;
          default:
            fail("Unexpected");
        }
        exec_state.prepareStep(Debug.StepAction.StepInto);
      } else {
        assertEquals(expected_source_position.shift() + debugger_source_position,
                     exec_state.frame(0).sourcePosition());
        assertEquals(expected_return_value,
                     exec_state.frame(0).returnValue().value());
        listener_complete = true;
      }
    }
  } catch (e) {
    exceptionThrown = true;
    print(e + e.stack)
  };
}
function listener ( event , exec_state , event_data , data ) { try { if ( event == Debug . DebugEvent . Break ) { break_count ++ ; if ( break_count < 4 ) { switch ( break_count ) { case 1 : debugger_source_position = exec_state . frame ( 0 ) . sourcePosition ( ) ; break ; case 2 : assertEquals ( expected_source_position . shift ( ) + debugger_source_position , exec_state . frame ( 0 ) . sourcePosition ( ) ) ; break ; case 3 : assertEquals ( expected_source_position . shift ( ) + debugger_source_position , exec_state . frame ( 0 ) . sourcePosition ( ) ) ; break ; default : fail ( "Unexpected" ) ; } exec_state . prepareStep ( Debug . StepAction . StepInto ) ; } else { assertEquals ( expected_source_position . shift ( ) + debugger_source_position , exec_state . frame ( 0 ) . sourcePosition ( ) ) ; assertEquals ( expected_return_value , exec_state . frame ( 0 ) . returnValue ( ) . value ( ) ) ; listener_complete = true ; } } } catch ( e ) { exceptionThrown = true ; print ( e + e . stack ) } ; }
Listener which expects to do four steps to reach returning from the function.
Listener which expects to do four steps to reach returning from the function .
// Collect the position of the debugger statement. // Position now at the if statement. // Position now at either of the returns. // Position at the end of the function. // Just about to return from the function.