Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/new/S11.2.2_A2.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: Operator "new" uses GetValue
6 es5id: 11.2.2_A2
7 description: >
8 If GetBase(NewExpression) or GetBase(MemberExpression) is null,
9 throw ReferenceError
10 ---*/
11
12 //CHECK#1
13 try {
14 new x;
15 $ERROR('#1.1: new x throw ReferenceError. Actual: ' + (new x));
16 }
17 catch (e) {
18 if ((e instanceof ReferenceError) !== true) {
19 $ERROR('#1.2: new x throw ReferenceError. Actual: ' + (e));
20 }
21 }
22
23 //CHECK#2
24 try {
25 new x();
26 $ERROR('#2: new x() throw ReferenceError');
27 }
28 catch (e) {
29 if ((e instanceof ReferenceError) !== true) {
30 $ERROR('#2: new x() throw ReferenceError');
31 }
32 }