Files
Kmake/deps/v8/test/mjsunit/turboshaft/maglev-frontend/constructor-extend-null-throw.js

22 lines
721 B
JavaScript
Raw Normal View History

2026-05-26 23:36:42 -07:00
// Copyright 2024 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --turbolev --turbofan
// Testing ThrowIfNotSuperConstructor (which triggers because the base class
// of A1 is "null", which doesn't have a constructor).
class A1 extends null {
constructor() {
super();
}
}
%PrepareFunctionForOptimization(A1);
assertThrows(() => new A1(), TypeError,
"Super constructor null of A1 is not a constructor");
%OptimizeFunctionOnNextCall(A1);
assertThrows(() => new A1(), TypeError,
"Super constructor null of A1 is not a constructor");
assertOptimized(A1);