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: 53027d209429
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ac88ab18b12b
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Oct 1, 2015

  1. Copy the full SHA
    3fe04ea View commit details
  2. Copy the full SHA
    ac88ab1 View commit details
Showing with 7 additions and 3 deletions.
  1. +1 −0 spec/ruby/core/binding/local_variable_set_spec.rb
  2. +6 −3 truffle/src/main/java/org/jruby/truffle/translator/TranslatorDriver.java
1 change: 1 addition & 0 deletions spec/ruby/core/binding/local_variable_set_spec.rb
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
bind.eval('local_variables').should == []
bind.local_variable_set :foo, 1
bind.eval('local_variables').should == [:foo]
bind.eval('foo').should == 1
end
end
end
Original file line number Diff line number Diff line change
@@ -18,8 +18,10 @@
import com.oracle.truffle.api.source.NullSourceSection;
import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.api.source.SourceSection;

import org.jcodings.Encoding;
import org.jruby.parser.StaticScope;
import org.jruby.runtime.DynamicScope;
import org.jruby.runtime.scope.ManyVarsDynamicScope;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.RubyRootNode;
@@ -56,7 +58,6 @@ public RubyRootNode parse(RubyContext context, Source source, Encoding defaultEn
final org.jruby.parser.Parser parser = new org.jruby.parser.Parser(context.getRuntime());

final StaticScope staticScope = context.getRuntime().getStaticScopeFactory().newLocalScope(null);

if (parentFrame != null) {
/*
* Note that jruby-parser will be mistaken about how deep the existing variables are,
@@ -70,14 +71,16 @@ public RubyRootNode parse(RubyContext context, Source source, Encoding defaultEn
for (FrameSlot slot : frame.getFrameDescriptor().getSlots()) {
if (slot.getIdentifier() instanceof String) {
final String name = (String) slot.getIdentifier();
staticScope.addVariableThisScope(name);
staticScope.addVariableThisScope(name.intern()); // StaticScope expects interned var names
}
}

frame = RubyArguments.getDeclarationFrame(frame.getArguments());
}
}

final DynamicScope dynamicScope = new ManyVarsDynamicScope(staticScope);

boolean isInlineSource = parserContext == ParserContext.SHELL;
boolean isEvalParse = parserContext == ParserContext.EVAL || parserContext == ParserContext.MODULE;
final org.jruby.parser.ParserConfiguration parserConfiguration = new org.jruby.parser.ParserConfiguration(context.getRuntime(), 0, isInlineSource, !isEvalParse, true);
@@ -88,7 +91,7 @@ public RubyRootNode parse(RubyContext context, Source source, Encoding defaultEn
org.jruby.ast.RootNode node;

try {
node = (org.jruby.ast.RootNode) parser.parse(source.getName(), source.getCode().getBytes(StandardCharsets.UTF_8), new ManyVarsDynamicScope(staticScope), parserConfiguration);
node = (org.jruby.ast.RootNode) parser.parse(source.getName(), source.getCode().getBytes(StandardCharsets.UTF_8), dynamicScope, parserConfiguration);
} catch (org.jruby.exceptions.RaiseException e) {
String message = e.getException().getMessage().asJavaString();