[macruby-changes] [5206] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jan 28 12:23:20 PST 2011
Revision: 5206
http://trac.macosforge.org/projects/ruby/changeset/5206
Author: eloy.de.enige at gmail.com
Date: 2011-01-28 12:23:20 -0800 (Fri, 28 Jan 2011)
Log Message:
-----------
Make sure the indentation level returned from IRB::Source is never lower than zero. Closes #1133.
Modified Paths:
--------------
MacRuby/trunk/lib/irb/source.rb
MacRuby/trunk/spec/dietrb/source_spec.rb
Modified: MacRuby/trunk/lib/irb/source.rb
===================================================================
--- MacRuby/trunk/lib/irb/source.rb 2011-01-28 20:19:25 UTC (rev 5205)
+++ MacRuby/trunk/lib/irb/source.rb 2011-01-28 20:23:20 UTC (rev 5206)
@@ -74,7 +74,9 @@
@code_block = @terminate = @syntax_error = @in_string = @in_regexp = @in_array = nil
@level = 0
- @code_block = !parse.nil? && !@in_string && !@in_regexp && !@in_array
+ parsed = !parse.nil?
+ @level = 0 if @level < 0
+ @code_block = parsed && !@in_string && !@in_regexp && !@in_array
end
# Returns the code block indentation level.
Modified: MacRuby/trunk/spec/dietrb/source_spec.rb
===================================================================
--- MacRuby/trunk/spec/dietrb/source_spec.rb 2011-01-28 20:19:25 UTC (rev 5205)
+++ MacRuby/trunk/spec/dietrb/source_spec.rb 2011-01-28 20:23:20 UTC (rev 5206)
@@ -156,6 +156,7 @@
end
it "returns the code block indentation level" do
+ reflect("]").level.should == 0
reflect("").level.should == 0
reflect("class A").level.should == 1
reflect("class A; def foo").level.should == 2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110128/7255b2fc/attachment.html>
More information about the macruby-changes
mailing list