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

Commits on Dec 12, 2016

  1. Copy the full SHA
    fd2d624 View commit details
  2. Copy the full SHA
    e6906cd View commit details
Showing with 13 additions and 13 deletions.
  1. +8 −8 truffle/src/main/java/org/jruby/truffle/Main.java
  2. +5 −5 truffle/src/main/java/org/jruby/truffle/RubyEngine.java
16 changes: 8 additions & 8 deletions truffle/src/main/java/org/jruby/truffle/Main.java
Original file line number Diff line number Diff line change
@@ -69,14 +69,14 @@ public static void main(String[] args) {
if (!mee.isAborted()) {
config.getError().println(mee.getMessage());
if (mee.isUsageError()) {
doPrintUsage(config, true);
printUsage(config, true);
}
}
System.exit(mee.getStatus());
}

doShowVersion(config);
doShowCopyright(config);
showVersion(config);
showCopyright(config);

final int exitCode;

@@ -105,7 +105,7 @@ public static void main(String[] args) {
exitCode = 1;
} else if (config.getShouldCheckSyntax()) {
// check syntax only and exit
exitCode = rubyEngine.doCheckSyntax(config.getScriptSource(), filename);
exitCode = rubyEngine.checkSyntax(config.getScriptSource(), filename);
} else {
exitCode = rubyEngine.execute(filename);
}
@@ -114,7 +114,7 @@ public static void main(String[] args) {
rubyEngine.dispose();
}
} else {
doPrintUsage(config, false);
printUsage(config, false);
exitCode = 1;
}

@@ -123,19 +123,19 @@ public static void main(String[] args) {
System.exit(exitCode);
}

private static void doPrintUsage(RubyInstanceConfig config, boolean force) {
private static void printUsage(RubyInstanceConfig config, boolean force) {
if (config.getShouldPrintUsage() || force) {
config.getOutput().print(OutputStrings.getBasicUsageHelp());
}
}

private static void doShowCopyright(RubyInstanceConfig config) {
private static void showCopyright(RubyInstanceConfig config) {
if (config.isShowCopyright()) {
config.getOutput().println(OutputStrings.getCopyrightString());
}
}

private static void doShowVersion(RubyInstanceConfig config) {
private static void showVersion(RubyInstanceConfig config) {
if (config.isShowVersion()) {
config.getOutput().println(OutputStrings.getVersionString());
}
10 changes: 5 additions & 5 deletions truffle/src/main/java/org/jruby/truffle/RubyEngine.java
Original file line number Diff line number Diff line change
@@ -82,23 +82,23 @@ private Source loadSource(String source, String name) {
return Source.newBuilder(source).name(name).mimeType(RubyLanguage.MIME_TYPE).build();
}

public int doCheckSyntax(InputStream in, String filename) {
public int checkSyntax(InputStream in, String filename) {
// check primary script
boolean status = checkSyntax(in, filename);
boolean status = runCheckSyntax(in, filename);

// check other scripts specified on argv
for (String arg : context.getOptions().ARGUMENTS) {
status = status && checkFileSyntax(arg);
}

return status ? 0 : -1;
return status ? 0 : 1;
}

private boolean checkFileSyntax(String filename) {
File file = new File(filename);
if (file.exists()) {
try {
return checkSyntax(new FileInputStream(file), filename);
return runCheckSyntax(new FileInputStream(file), filename);
} catch (FileNotFoundException fnfe) {
System.err.println("File not found: " + filename);
return false;
@@ -108,7 +108,7 @@ private boolean checkFileSyntax(String filename) {
}
}

public boolean checkSyntax(InputStream in, String filename) {
private boolean runCheckSyntax(InputStream in, String filename) {
context.setSyntaxCheckInputStream(in);
context.setOriginalInputFile(filename);