~loic.molinari/+junk/qtdeclarative-shadereffectsource-changes

« back to all changes in this revision

Viewing changes to tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-6.js

  • Committer: Loïc Molinari
  • Date: 2012-04-21 17:59:51 UTC
  • Revision ID: loic.molinari@canonical.com-20120421175951-bqx68caaf5zrp76l
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 
2
/* ***** BEGIN LICENSE BLOCK *****
 
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
4
 *
 
5
 * The contents of this file are subject to the Mozilla Public License Version
 
6
 * 1.1 (the "License"); you may not use this file except in compliance with
 
7
 * the License. You may obtain a copy of the License at
 
8
 * http://www.mozilla.org/MPL/
 
9
 *
 
10
 * Software distributed under the License is distributed on an "AS IS" basis,
 
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
12
 * for the specific language governing rights and limitations under the
 
13
 * License.
 
14
 *
 
15
 * The Original Code is Mozilla Communicator client code, released
 
16
 * March 31, 1998.
 
17
 *
 
18
 * The Initial Developer of the Original Code is
 
19
 * Netscape Communications Corporation.
 
20
 * Portions created by the Initial Developer are Copyright (C) 1998
 
21
 * the Initial Developer. All Rights Reserved.
 
22
 *
 
23
 * Contributor(s):
 
24
 *
 
25
 * Alternatively, the contents of this file may be used under the terms of
 
26
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 
27
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
28
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
29
 * of those above. If you wish to allow use of your version of this file only
 
30
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
31
 * use your version of this file under the terms of the MPL, indicate your
 
32
 * decision by deleting the provisions above and replace them with the notice
 
33
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
34
 * the provisions above, a recipient may use your version of this file under
 
35
 * the terms of any one of the MPL, the GPL or the LGPL.
 
36
 *
 
37
 * ***** END LICENSE BLOCK ***** */
 
38
 
 
39
gTestfile = '10.1.4-6.js';
 
40
 
 
41
/**
 
42
   File Name:          10.1.4-1.js
 
43
   ECMA Section:       10.1.4 Scope Chain and Identifier Resolution
 
44
   Description:
 
45
   Every execution context has associated with it a scope chain. This is
 
46
   logically a list of objects that are searched when binding an Identifier.
 
47
   When control enters an execution context, the scope chain is created and
 
48
   is populated with an initial set of objects, depending on the type of
 
49
   code. When control leaves the execution context, the scope chain is
 
50
   destroyed.
 
51
 
 
52
   During execution, the scope chain of the execution context is affected
 
53
   only by WithStatement. When execution enters a with block, the object
 
54
   specified in the with statement is added to the front of the scope chain.
 
55
   When execution leaves a with block, whether normally or via a break or
 
56
   continue statement, the object is removed from the scope chain. The object
 
57
   being removed will always be the first object in the scope chain.
 
58
 
 
59
   During execution, the syntactic production PrimaryExpression : Identifier
 
60
   is evaluated using the following algorithm:
 
61
 
 
62
   1.  Get the next object in the scope chain. If there isn't one, go to step 5.
 
63
   2.  Call the [[HasProperty]] method of Result(l), passing the Identifier as
 
64
   the property.
 
65
   3.  If Result(2) is true, return a value of type Reference whose base object
 
66
   is Result(l) and whose property name is the Identifier.
 
67
   4.  Go to step 1.
 
68
   5.  Return a value of type Reference whose base object is null and whose
 
69
   property name is the Identifier.
 
70
   The result of binding an identifier is always a value of type Reference with
 
71
   its member name component equal to the identifier string.
 
72
   Author:             christine@netscape.com
 
73
   Date:               12 november 1997
 
74
*/
 
75
var SECTION = "10.1.4-6";
 
76
var VERSION = "ECMA_1";
 
77
startTest();
 
78
 
 
79
writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
 
80
 
 
81
 
 
82
var testcase = new TestCase( "SECTION",
 
83
                             "with MyObject, eval should be [object Global].eval " );
 
84
 
 
85
var MYOBJECT = new MyObject();
 
86
var INPUT = 2;
 
87
testcase.description += ( INPUT +"" );
 
88
 
 
89
with ( MYOBJECT ) {
 
90
  ;
 
91
}
 
92
testcase.actual = eval( INPUT );
 
93
testcase.expect = INPUT;
 
94
 
 
95
test();
 
96
 
 
97
 
 
98
function MyObject() {
 
99
  this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
 
100
}