2016-12-21 10:20:36 +01:00
|
|
|
module Melon
|
|
|
|
|
|
|
|
class LocalsCollector < TotalProcessor
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
@locals = {}
|
|
|
|
end
|
|
|
|
|
|
|
|
def collect(statement)
|
|
|
|
process statement
|
|
|
|
@locals
|
|
|
|
end
|
|
|
|
|
|
|
|
def on_lvasgn statement
|
|
|
|
add_local( statement )
|
|
|
|
end
|
|
|
|
|
|
|
|
def add_local(statement)
|
|
|
|
var = statement.children[0]
|
2017-01-13 21:16:06 +01:00
|
|
|
@locals[var] = :Object #not really used right now
|
2016-12-21 10:20:36 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|