From b3c94b3268deeb8b07bb1023b596fc92cc52f9be Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Mon, 17 Feb 2020 23:47:18 -0800 Subject: [PATCH] Update call-proto-not-ctor.js --- .../expressions/super/call-proto-not-ctor.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/test/language/expressions/super/call-proto-not-ctor.js b/test/language/expressions/super/call-proto-not-ctor.js index 883fb70195..614d7e3b97 100644 --- a/test/language/expressions/super/call-proto-not-ctor.js +++ b/test/language/expressions/super/call-proto-not-ctor.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-super-keyword -es6id: 12.3.5 description: SuperCall should evaluate Arguments prior to checking IsConstructor info: | SuperCall : `super` Arguments @@ -16,16 +15,27 @@ features: [class] ---*/ var evaluatedArg = false; +var caught; class C extends Object { constructor() { - super(evaluatedArg = true); + try { + super(evaluatedArg = true); + } catch (err) { + caught = err; + } } } Object.setPrototypeOf(C, parseInt); -assert.throws(TypeError, () => { +// When the "construct" invocation completes and the "this" value is +// uninitialized, the specification dictates that a ReferenceError must be +// thrown. That behavior is tested elsewhere, so the error is ignored (if it is +// produced at all). +try { new C(); -}); +} catch (_) {} +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); assert(evaluatedArg, 'performs ArgumentsListEvaluation');