lib/ripper-plus/scope_stack.rb in ripper-plus-1.1.0.pre2 vs lib/ripper-plus/scope_stack.rb in ripper-plus-1.2.0
- old
+ new
@@ -23,10 +23,13 @@
end
end.join(' ')
"< #{middle} >"
end
- def add_variable(var)
+ def add_variable(var, allow_duplicates=true)
+ if !allow_duplicates && @stack.last.include?(var)
+ raise DuplicateArgumentError.new("duplicated argument name (#{var})")
+ end
@stack.last << var
end
# An open scope permits reference to local variables in enclosing scopes.
def with_open_scope
\ No newline at end of file