Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 363175b00187
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b731175d4837
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Jun 30, 2015

  1. Always use variableNames for sizing growable scopes. Fixes #3089.

    variableNames is updated when IRScope gets set into StaticScope,
    and is used for other sizing and definition logic, so make it the
    sole place we get variable counts from when sizing scopes.
    headius committed Jun 30, 2015
    Copy the full SHA
    1e6e3ff View commit details
  2. Copy the full SHA
    b731175 View commit details
Showing with 17 additions and 1 deletion.
  1. +1 −1 core/src/main/java/org/jruby/parser/StaticScope.java
  2. +4 −0 spec/ruby/core/binding/fixtures/classes.rb
  3. +12 −0 spec/ruby/core/binding/local_variable_set_spec.rb
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/parser/StaticScope.java
Original file line number Diff line number Diff line change
@@ -225,7 +225,7 @@ public String[] getVariables() {
}

public int getNumberOfVariables() {
return irScope == null ? variableNames.length : irScope.getUsedVariablesCount();
return variableNames.length;
}

public void setVariables(String[] names) {
4 changes: 4 additions & 0 deletions spec/ruby/core/binding/fixtures/classes.rb
Original file line number Diff line number Diff line change
@@ -24,5 +24,9 @@ def get_line_of_binding
def get_file_of_binding
__FILE__
end

def get_empty_binding
binding
end
end
end
12 changes: 12 additions & 0 deletions spec/ruby/core/binding/local_variable_set_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)

describe "Binding#local_variable_set" do
it "adds nonexistent variables to the binding's eval scope" do
obj = BindingSpecs::Demo.new(1)
bind = obj.get_empty_binding
bind.eval('local_variables').should == []
bind.local_variable_set :foo, 1
bind.eval('local_variables').should == [:foo]
end
end