mirror of
https://github.com/github/semantic.git
synced 2025-01-02 20:41:38 +03:00
ruby: define locals as they are encountered
This commit is contained in:
parent
ba99be7345
commit
8dfaae81e1
@ -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 )
|
||||
|
Loading…
Reference in New Issue
Block a user