2 * Copyright (c) 2016, Facebook, Inc.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
12 let rec check_lvalue errorf
= function
13 | pos
, Obj_get
(_
, (_
, Id
(_
, _
)), OG_nullsafe
) ->
14 errorf pos
"?-> syntax is not supported for lvalues"
15 | pos
, Obj_get
(_
, (_
, Id
(_
, name
)), _
) when name
.[0] = '
:'
->
16 errorf pos
"->: syntax is not supported for lvalues"
17 | pos
, Array_get
((_
, Class_const _
), _
) ->
18 errorf pos
"Array-like class consts are not valid lvalues"
19 | _
, (Lvar _
| Obj_get _
| Array_get _
| Class_get _
|
20 Unsafeexpr _
| Omitted
| BracedExpr _
| Dollar _
) -> ()
21 | pos
, Call
((_
, Id
(_
, "tuple")), _
, _
, _
) ->
22 errorf pos
"Tuple cannot be used as an lvalue. Maybe you meant list?"
23 | _
, List el
-> List.iter
(check_lvalue errorf
) el
24 | pos
, (Array _
| Darray _
| Varray _
| Shape _
| Collection _
25 | Null
| True
| False
| Id _
| Clone _
26 | Class_const _
| Call _
| Int _
| Float _
| PrefixedString _
27 | String _
| String2 _
| Yield _
| Yield_break
| Yield_from _
28 | Await _
| Suspend _
| Expr_list _
| Cast _
| Unop _
29 | Binop _
| Eif _
| InstanceOf _
30 | New _
| NewAnonClass _
| Efun _
| Lfun _
31 | Xml _
| Import _
| Pipe _
| Callconv _
| Is _
| Execution_operator _
| As _
32 | ParenthesizedExpr _
) ->
33 errorf pos
"Invalid lvalue"