Skip to content

Commit

Permalink
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -63,6 +63,7 @@
import java.io.File;
import java.io.PrintStream;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -618,7 +619,7 @@ public Object execute(final org.jruby.ast.RootNode rootNode) {

if (inputFile.equals("-e")) {
// Assume UTF-8 for the moment
source = Source.fromBytes(runtime.getInstanceConfig().inlineScript(), "-e", new BytesDecoder.UTF8BytesDecoder());
source = Source.fromText(new String(runtime.getInstanceConfig().inlineScript(), StandardCharsets.UTF_8), "-e");
} else {
source = sourceManager.forFile(inputFile);
}
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class SourceManager {
@@ -45,7 +46,7 @@ public synchronized Source forFile(String path) {
final byte[] bytes = FileUtils.readAllBytesInterruptedly(context, path);

// Assume UTF-8 for the moment
source = Source.fromBytes(bytes, path, new BytesDecoder.UTF8BytesDecoder());
source = Source.fromText(new String(bytes, StandardCharsets.UTF_8), path);

sources.put(canonicalPath, source);
}
Original file line number Diff line number Diff line change
@@ -105,7 +105,7 @@ public RubyRootNode parse(RubyContext context, Source source, Encoding defaultEn
return parse(currentNode, context, source, parserContext, parentFrame, ownScopeForAssignments, node, wrapper);
}

public RubyRootNode parse(Node currentNode, RubyContext context, Source source, ParserContext parserContext, MaterializedFrame parentFrame, boolean ownScopeForAssignments, org.jruby.ast.RootNode rootNode, NodeWrapper wrapper) {
private RubyRootNode parse(Node currentNode, RubyContext context, Source source, ParserContext parserContext, MaterializedFrame parentFrame, boolean ownScopeForAssignments, org.jruby.ast.RootNode rootNode, NodeWrapper wrapper) {
final SourceSection sourceSection = source.createSection("<main>", 0, source.getCode().length());

final InternalMethod parentMethod = parentFrame == null ? null : RubyArguments.getMethod(parentFrame.getArguments());

0 comments on commit 7855222

Please sign in to comment.