1// Copyright 2016 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Flags: --expose-debug-as debug
6
7// Test that debug-evaluate doesn't crash when this is used before super() call
8// in constructor.
9
10Debug = debug.Debug
11
12var result;
13
14function listener(event, exec_state, event_data, data)
15{
16  try {
17    if (event == Debug.DebugEvent.Break) {
18      result = exec_state.frame(0).evaluate("this.a").value();
19    }
20  } catch (e) {
21    result = e.message;
22  }
23}
24
25Debug.setListener(listener);
26
27class A { constructor () { this.a = 239; } }
28class B extends A {
29  constructor () {
30    debugger;
31    assertEquals("Cannot read property 'a' of undefined", result);
32    super();
33    debugger;
34    assertEquals(239, result);
35  }
36}
37new B();
38
39Debug.setListener(null);
40