test/script/basic/parser/loopStat.js.EXPECTED

Thu, 12 Sep 2013 22:16:40 +0530

author
sundar
date
Thu, 12 Sep 2013 22:16:40 +0530
changeset 551
917b16e509bd
parent 0
b1a7da25b547
permissions
-rw-r--r--

8024693: Various minor issues with JSONWriter used by script parser API
Reviewed-by: jlaskey, hannesw

     1 {
     2     "type": "Program",
     3     "body": [
     4         {
     5             "type": "WhileStatement",
     6             "test": {
     7                 "type": "Literal",
     8                 "value": true
     9             },
    10             "body": {
    11                 "type": "BlockStatement",
    12                 "body": [
    13                     {
    14                         "type": "ExpressionStatement",
    15                         "expression": {
    16                             "type": "CallExpression",
    17                             "callee": {
    18                                 "type": "Identifier",
    19                                 "name": "print"
    20                             },
    21                             "arguments": [
    22                                 {
    23                                     "type": "Literal",
    24                                     "value": "hello"
    25                                 }
    26                             ]
    27                         }
    28                     }
    29                 ]
    30             }
    31         }
    32     ]
    33 }
    34 {
    35     "type": "Program",
    36     "body": [
    37         {
    38             "type": "DoWhileStatement",
    39             "body": {
    40                 "type": "BlockStatement",
    41                 "body": [
    42                     {
    43                         "type": "ExpressionStatement",
    44                         "expression": {
    45                             "type": "CallExpression",
    46                             "callee": {
    47                                 "type": "Identifier",
    48                                 "name": "print"
    49                             },
    50                             "arguments": [
    51                                 {
    52                                     "type": "Literal",
    53                                     "value": "hello"
    54                                 }
    55                             ]
    56                         }
    57                     }
    58                 ]
    59             },
    60             "test": {
    61                 "type": "Literal",
    62                 "value": true
    63             }
    64         }
    65     ]
    66 }
    67 {
    68     "type": "Program",
    69     "body": [
    70         {
    71             "type": "ForInStatement",
    72             "left": {
    73                 "type": "Identifier",
    74                 "name": "i"
    75             },
    76             "right": {
    77                 "type": "Identifier",
    78                 "name": "obj"
    79             },
    80             "body": {
    81                 "type": "BlockStatement",
    82                 "body": [
    83                     {
    84                         "type": "ExpressionStatement",
    85                         "expression": {
    86                             "type": "CallExpression",
    87                             "callee": {
    88                                 "type": "Identifier",
    89                                 "name": "print"
    90                             },
    91                             "arguments": [
    92                                 {
    93                                     "type": "MemberExpression",
    94                                     "object": {
    95                                         "type": "Identifier",
    96                                         "name": "obj"
    97                                     },
    98                                     "property": {
    99                                         "type": "Identifier",
   100                                         "name": "i"
   101                                     },
   102                                     "computed": true
   103                                 }
   104                             ]
   105                         }
   106                     }
   107                 ]
   108             },
   109             "each": false
   110         }
   111     ]
   112 }
   113 {
   114     "type": "Program",
   115     "body": [
   116         {
   117             "type": "ForInStatement",
   118             "left": {
   119                 "type": "Identifier",
   120                 "name": "i"
   121             },
   122             "right": {
   123                 "type": "Identifier",
   124                 "name": "obj"
   125             },
   126             "body": {
   127                 "type": "BlockStatement",
   128                 "body": [
   129                     {
   130                         "type": "ExpressionStatement",
   131                         "expression": {
   132                             "type": "CallExpression",
   133                             "callee": {
   134                                 "type": "Identifier",
   135                                 "name": "print"
   136                             },
   137                             "arguments": [
   138                                 {
   139                                     "type": "Identifier",
   140                                     "name": "i"
   141                                 }
   142                             ]
   143                         }
   144                     }
   145                 ]
   146             },
   147             "each": true
   148         }
   149     ]
   150 }
   151 {
   152     "type": "Program",
   153     "body": [
   154         {
   155             "type": "ForStatement",
   156             "init": {
   157                 "type": "AssignmentExpression",
   158                 "operator": "=",
   159                 "left": {
   160                     "type": "Identifier",
   161                     "name": "i"
   162                 },
   163                 "right": {
   164                     "type": "Literal",
   165                     "value": 0
   166                 }
   167             },
   168             "test": {
   169                 "type": "BinaryExpression",
   170                 "operator": "<",
   171                 "left": {
   172                     "type": "Identifier",
   173                     "name": "i"
   174                 },
   175                 "right": {
   176                     "type": "Literal",
   177                     "value": 10
   178                 }
   179             },
   180             "update": {
   181                 "type": "UpdateExpression",
   182                 "operator": "++",
   183                 "prefix": false,
   184                 "argument": {
   185                     "type": "Identifier",
   186                     "name": "i"
   187                 }
   188             },
   189             "body": {
   190                 "type": "BlockStatement",
   191                 "body": [
   192                     {
   193                         "type": "ExpressionStatement",
   194                         "expression": {
   195                             "type": "CallExpression",
   196                             "callee": {
   197                                 "type": "Identifier",
   198                                 "name": "print"
   199                             },
   200                             "arguments": [
   201                                 {
   202                                     "type": "Identifier",
   203                                     "name": "i"
   204                                 }
   205                             ]
   206                         }
   207                     }
   208                 ]
   209             }
   210         }
   211     ]
   212 }

mercurial