Home | History | Annotate | Download | only in Expressions
      1 /* The contents of this file are subject to the Netscape Public
      2  * License Version 1.1 (the "License"); you may not use this file
      3  * except in compliance with the License. You may obtain a copy of
      4  * the License at http://www.mozilla.org/NPL/
      5  *
      6  * Software distributed under the License is distributed on an "AS
      7  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
      8  * implied. See the License for the specific language governing
      9  * rights and limitations under the License.
     10  *
     11  * The Original Code is Mozilla Communicator client code, released March
     12  * 31, 1998.
     13  *
     14  * The Initial Developer of the Original Code is Netscape Communications
     15  * Corporation. Portions created by Netscape are
     16  * Copyright (C) 1998 Netscape Communications Corporation. All
     17  * Rights Reserved.
     18  *
     19  * Contributor(s):
     20  *
     21  */
     22 /**
     23     File Name:          11.2.2-6-n.js
     24     ECMA Section:       11.2.2. The new operator
     25     Description:
     26 
     27     MemberExpression:
     28         PrimaryExpression
     29         MemberExpression[Expression]
     30         MemberExpression.Identifier
     31         new MemberExpression Arguments
     32 
     33     new NewExpression
     34 
     35     The production NewExpression : new NewExpression is evaluated as follows:
     36 
     37    1.   Evaluate NewExpression.
     38    2.   Call GetValue(Result(1)).
     39    3.   If Type(Result(2)) is not Object, generate a runtime error.
     40    4.   If Result(2) does not implement the internal [[Construct]] method,
     41         generate a runtime error.
     42    5.   Call the [[Construct]] method on Result(2), providing no arguments
     43         (that is, an empty list of arguments).
     44    6.   If Type(Result(5)) is not Object, generate a runtime error.
     45    7.   Return Result(5).
     46 
     47     The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
     48 
     49    1.   Evaluate MemberExpression.
     50    2.   Call GetValue(Result(1)).
     51    3.   Evaluate Arguments, producing an internal list of argument values
     52         (section 0).
     53    4.   If Type(Result(2)) is not Object, generate a runtime error.
     54    5.   If Result(2) does not implement the internal [[Construct]] method,
     55         generate a runtime error.
     56    6.   Call the [[Construct]] method on Result(2), providing the list
     57         Result(3) as the argument values.
     58    7.   If Type(Result(6)) is not Object, generate a runtime error.
     59    8    .Return Result(6).
     60 
     61     Author:             christine (at) netscape.com
     62     Date:               12 november 1997
     63 */
     64     var SECTION = "11.2.2-6-n.js";
     65     var VERSION = "ECMA_1";
     66     startTest();
     67     var TITLE   = "The new operator";
     68 
     69     writeHeaderToLog( SECTION + " "+ TITLE);
     70 
     71     var BOOLEAN  = true;
     72 
     73     testcases[tc++] = new TestCase( SECTION,
     74                                     "BOOLEAN = true; var b = new BOOLEAN()",
     75                                     "error",
     76                                     b = new BOOLEAN() );
     77     test();
     78 
     79 function TestFunction() {
     80     return arguments;
     81 }
     82