Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Commits on Dec 26, 2011
@pbevin Fix stack overflow when requiring rexml/document
The overflow happened while doing pre-order traversal of the root
sexp - this switches out the recursive definition of Sexp#dfs for
an iterative method using a stack.
adf507b
@pbevin Fix NoMethodError when --include is given 5645eea
View
20 lib/laser/analysis/sexp.rb
@@ -98,14 +98,18 @@ def all_errors
# Performs a DFS on the node, yielding each subnode (including the given node)
# in DFS order.
def dfs
- yield self
- self.children.each do |child|
- next unless is_sexp?(child)
- case child[0]
- when Array
- child.each { |x| x.dfs { |y| yield y}}
- when ::Symbol
- child.dfs { |y| yield y }
+ stack = [self]
+ while node = stack.pop
+ yield node
+
+ node.children.reverse.each do |child|
+ next unless is_sexp?(child)
+ case child[0]
+ when Array
+ child.reverse.each { |x| stack.push(x) }
+ when ::Symbol
+ stack.push(child)
+ end
end
end
end
View
2  lib/laser/runner.rb
@@ -75,7 +75,7 @@ def get_settings
opt :stdin, 'Read Ruby code from standard input', short: '-s'
opt :'list-modules', 'Print the discovered, loaded modules'
opt :profile, 'Run the profiler during execution'
- opt :include, 'specify $LOAD_PATH directory (may be used more than once)', short: '-I', multi: true
+ opt :include, 'specify $LOAD_PATH directory (may be used more than once)', short: '-I', multi: true#, type: :string
opt :S, 'look for scripts using PATH environment variable', short: '-S'
warning_opts.each { |warning| opt(*warning) }
end
View
6 spec/runner_spec.rb
@@ -141,6 +141,12 @@
settings[:"report-fixed"].should be_true
settings[:"report-fixed_given"].should be_true
end
+
+ it 'has a --include option' do
+ runner = Runner.new(['--include=/some/path', '-I', '/another/path'])
+ settings = runner.swizzling_argv { runner.get_settings }
+ settings[:include].should == ["/some/path", "/another/path"]
+ end
end
describe '#handle_global_options' do

No commit comments for this range

Something went wrong with that request. Please try again.