Skip to content

Commit

Permalink
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions truffle/src/main/java/org/jruby/truffle/Main.java
Original file line number Diff line number Diff line change
@@ -54,7 +54,6 @@ public void run() {
if (in == null) {
return;
} else {

// Global variables
IAccessor d = new ValueAccessor(runtime.newString(filename));
runtime.getGlobalVariables().define("$PROGRAM_NAME", d,
@@ -79,27 +78,26 @@ public void run() {
.parseFromMain(filename, in);

// If no DATA, we're done with the stream, shut it down
if (runtime.fetchGlobalConstant("DATA") == null) {
try {
in.close();
} catch (IOException ioe) {
}
}
ThreadContext context = runtime.getCurrentContext();

String oldFile = context.getFile();
int oldLine = context.getLine();

try {
context.setFileAndLine(scriptNode.getPosition());
runtime.getTruffleContext().execute(scriptNode);
} finally {
context.setFileAndLine(oldFile, oldLine);
runtime.shutdownTruffleContextIfRunning();
}

}

}
if (runtime.fetchGlobalConstant("DATA") == null) {
try {
in.close();
} catch (IOException ioe) {
}
}
ThreadContext context = runtime.getCurrentContext();

String oldFile = context.getFile();
int oldLine = context.getLine();

try {
context.setFileAndLine(scriptNode.getPosition());
runtime.getTruffleContext().execute(scriptNode);
} finally {
context.setFileAndLine(oldFile, oldLine);
runtime.shutdownTruffleContextIfRunning();
}
}

}

}

0 comments on commit 784503e

Please sign in to comment.