diff --git a/src/Language/Ruby/Assignment.hs b/src/Language/Ruby/Assignment.hs index eaf2b1ed4..e3a84ab01 100644 --- a/src/Language/Ruby/Assignment.hs +++ b/src/Language/Ruby/Assignment.hs @@ -379,8 +379,17 @@ assignment' = makeTerm <$> symbol Assignment <*> children (Statement.As rhs = makeTerm <$> symbol RightAssignmentList <*> children (many expr) <|> expr expr = makeTerm <$> symbol RestAssignment <*> (Syntax.Identifier . name <$> source) <|> makeTerm <$> symbol DestructuredLeftAssignment <*> children (many expr) + <|> lhsIdent <|> expression +lhsIdent :: Assignment +lhsIdent = do + sym <- symbol Identifier <|> symbol Identifier' + locals <- getRubyLocals + ident <- source + putRubyLocals (ident : locals) + pure $ makeTerm sym $ Syntax.Identifier $ name ident + unary :: Assignment unary = symbol Unary >>= \ location -> makeTerm location . Expression.Complement <$> children ( symbol AnonTilde *> expression )