(context)
| 116 | } |
| 117 | |
| 118 | parseLeftHandSide(context) { |
| 119 | let result; |
| 120 | |
| 121 | // Unary + Primary expression |
| 122 | primary: switch (this.tkn) { |
| 123 | case T$Plus: |
| 124 | this.nextToken(); |
| 125 | return this.parseLeftHandSide(0); |
| 126 | case T$Minus: |
| 127 | this.nextToken(); |
| 128 | return new Binary('-', new LiteralPrimitive(0), this.parseLeftHandSide(0)); |
| 129 | case T$Bang: |
| 130 | case T$TypeofKeyword: |
| 131 | case T$VoidKeyword: |
| 132 | const op = TokenValues[this.tkn & T$TokenMask]; |
| 133 | this.nextToken(); |
| 134 | return new Unary(op, this.parseLeftHandSide(0)); |
| 135 | case T$ParentScope: // $parent |
| 136 | { |
| 137 | do { |
| 138 | this.nextToken(); |
| 139 | context++; // ancestor |
| 140 | if (this.opt(T$Period)) { |
| 141 | if (this.tkn === T$Period) { |
| 142 | this.err(); |
| 143 | } |
| 144 | continue; |
| 145 | } else if (this.tkn & T$AccessScopeTerminal) { |
| 146 | result = new AccessThis(context & C$Ancestor); |
| 147 | // Keep the ShorthandProp flag, clear all the others, and set context to This |
| 148 | context = (context & C$ShorthandProp) | C$This; |
| 149 | break primary; |
| 150 | } else { |
| 151 | this.err(); |
| 152 | } |
| 153 | } while (this.tkn === T$ParentScope); |
| 154 | } |
| 155 | // falls through |
| 156 | case T$Identifier: // identifier |
| 157 | { |
| 158 | result = new AccessScope(this.val, context & C$Ancestor); |
| 159 | this.nextToken(); |
| 160 | context = (context & C$ShorthandProp) | C$Scope; |
| 161 | break; |
| 162 | } |
| 163 | case T$ThisScope: // $this |
| 164 | this.nextToken(); |
| 165 | result = new AccessThis(0); |
| 166 | context = (context & C$ShorthandProp) | C$This; |
| 167 | break; |
| 168 | case T$LParen: // parenthesized expression |
| 169 | this.nextToken(); |
| 170 | result = this.parseExpression(); |
| 171 | this.expect(T$RParen); |
| 172 | context = C$Primary; |
| 173 | break; |
| 174 | case T$LBracket: // literal array |
| 175 | { |
no test coverage detected