finished up the CoffeeScript version of the Scope object

This commit is contained in:
Jeremy Ashkenas
2010-02-08 21:10:48 -05:00
parent 69808ba523
commit b8d22bc572
8 changed files with 244 additions and 143 deletions

View File

@@ -55,10 +55,14 @@ module CoffeeScript
@variables[name.to_sym] = Value.new(value)
end
# Does this scope reference any variables that need to be declared in the
# given function body?
def declarations?(body)
!declared_variables.empty? && body == @expressions
end
# Does this scope reference any assignments that need to be declared at the
# top of the given function body?
def assignments?(body)
!assigned_variables.empty? && body == @expressions
end