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

Commits on Nov 3, 2016

  1. Copy the full SHA
    f6d9c41 View commit details
  2. 3
    Copy the full SHA
    1f1fd4a View commit details
6 changes: 3 additions & 3 deletions truffle/src/main/java/org/jruby/truffle/core/CoreLibrary.java
Original file line number Diff line number Diff line change
@@ -841,11 +841,11 @@ private void initializeGlobalVariables() {

globals.put("$,", nilObject);
globals.put("$*", argv);
globals.put("$0", StringOperations.createString(context, StringOperations.encodeRope(context.getJRubyRuntime().getInstanceConfig().displayedFileName(), UTF8Encoding.INSTANCE)));
globals.put("$0", StringOperations.createString(context, StringOperations.encodeRope(context.getJRubyInterop().getDisplayedFileName(), UTF8Encoding.INSTANCE)));

globals.put("$DEBUG", context.getJRubyRuntime().isDebug());
globals.put("$DEBUG", context.getJRubyInterop().isDebug());

Object value = context.getJRubyRuntime().warningsEnabled() ? context.getJRubyRuntime().isVerbose() : nilObject;
Object value = context.getJRubyInterop().warningsEnabled() ? context.getJRubyInterop().isVerbose() : nilObject;
globals.put("$VERBOSE", value);

final DynamicObject defaultRecordSeparator = StringOperations.createString(context, StringOperations.encodeRope(CLI_RECORD_SEPARATOR, UTF8Encoding.INSTANCE));
Original file line number Diff line number Diff line change
@@ -854,7 +854,7 @@ public abstract static class GetsNode extends CoreMethodArrayArgumentsNode {
@Specialization
public DynamicObject gets() {
// TODO(CS): having some trouble interacting with JRuby stdin - so using this hack
final InputStream in = getContext().getJRubyRuntime().getInstanceConfig().getInput();
final InputStream in = getContext().getJRubyInterop().getInput();

Encoding encoding = getContext().getEncodingManager().getDefaultExternalEncoding();

21 changes: 21 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/interop/JRubyInterop.java
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
import org.jruby.truffle.language.loader.SourceLoader;

import java.io.File;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.security.CodeSource;
import java.util.ArrayList;
@@ -153,4 +154,24 @@ public String getExternalEncoding() {
public String getInternalEncoding() {
return jrubyRuntime.getInstanceConfig().getInternalEncoding();
}

public CharSequence getDisplayedFileName() {
return jrubyRuntime.getInstanceConfig().displayedFileName();
}

public boolean isDebug() {
return jrubyRuntime.isDebug();
}

public boolean warningsEnabled() {
return jrubyRuntime.warningsEnabled();
}

public boolean isVerbose() {
return jrubyRuntime.isVerbose();
}

public InputStream getInput() {
return jrubyRuntime.getInstanceConfig().getInput();
}
}
14 changes: 4 additions & 10 deletions truffle/src/main/java/org/jruby/truffle/parser/BodyTranslator.java
Original file line number Diff line number Diff line change
@@ -2159,7 +2159,6 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
RubyNode rhsTranslated;

if (rhs == null) {
context.getJRubyRuntime().getWarnings().warn(IRubyWarnings.ID.TRUFFLE, source.getName(), node.getPosition().getLine(), "no RHS for multiple assignment - using nil");
rhsTranslated = nilNode(source, sourceSection);
} else {
rhsTranslated = rhs.accept(this);
@@ -2457,7 +2456,6 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {

result = new ElidableResultNode(sequence(context, source, sourceSection, sequence), environment.findLocalVarNode(tempRHSName, source, sourceSection));
} else {
context.getJRubyRuntime().getWarnings().warn(IRubyWarnings.ID.TRUFFLE, source.getName(), node.getPosition().getLine(), node + " unknown form of multiple assignment");
result = nilNode(source, sourceSection);
}

@@ -2906,7 +2904,8 @@ public RubyNode visitRescueNode(RescueParseNode node) {
final RescueSplatNode rescueNode = new RescueSplatNode(context, fullSourceSection, splatTranslated, bodyTranslated);
rescueNodes.add(rescueNode);
} else {
unimplemented(node);
RubyNode result;
throw new UnsupportedOperationException();
}
} else {
RubyNode bodyNode;
@@ -3205,14 +3204,9 @@ protected RubyNode initFlipFlopStates(RubySourceSection sourceSection) {

@Override
protected RubyNode defaultVisit(ParseNode node) {
final RubyNode ret = unimplemented(node);
return addNewlineIfNeeded(node, ret);
}

protected RubyNode unimplemented(ParseNode node) {
context.getJRubyRuntime().getWarnings().warn(IRubyWarnings.ID.TRUFFLE, source.getName(), node.getPosition().getLine(), node + " does nothing - translating as nil");
RubySourceSection sourceSection = translate(node.getPosition());
return nilNode(source, sourceSection);
final RubyNode ret = nilNode(source, sourceSection);
return addNewlineIfNeeded(node, ret);
}

public TranslatorEnvironment getEnvironment() {