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

Commits on Jan 5, 2015

  1. Copy the full SHA
    289281d View commit details
  2. Copy the full SHA
    0562581 View commit details
Showing with 11 additions and 4 deletions.
  1. +2 −1 .gitignore
  2. +9 −3 core/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -94,11 +94,12 @@ nbproject/private
# Eclipse files
/.metadata
/.recommenders
core/.apt_generated
core/.classpath
core/.gitignore
core/.project
core/.settings
core/.apt_generated
core/build.eclipse

# Truffle findbugs
truffle-findbugs-report.html
12 changes: 9 additions & 3 deletions core/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java
Original file line number Diff line number Diff line change
@@ -19,6 +19,8 @@
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.api.source.SourceSection;

import org.jcodings.Encoding;
import org.jruby.runtime.Visibility;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.RubyRootNode;
@@ -400,23 +402,27 @@ public Object classEval(VirtualFrame frame, RubyModule module, RubyString code,
notDesignedForCompilation();

final Source source = Source.fromText(code.getBytes(), "(eval)");
return getContext().execute(getContext(), source, code.getBytes().getEncoding(), TranslatorDriver.ParserContext.MODULE, module, frame.materialize(), this);
return classEvalSource(frame, module, source, code.getBytes().getEncoding());
}

@Specialization
public Object classEval(VirtualFrame frame, RubyModule module, RubyString code, RubyString file, @SuppressWarnings("unused") UndefinedPlaceholder line, @SuppressWarnings("unused") UndefinedPlaceholder block) {
notDesignedForCompilation();

final Source source = Source.asPseudoFile(code.getBytes(), file.toString());
return getContext().execute(getContext(), source, code.getBytes().getEncoding(), TranslatorDriver.ParserContext.MODULE, module, frame.materialize(), this);
return classEvalSource(frame, module, source, code.getBytes().getEncoding());
}

@Specialization
public Object classEval(VirtualFrame frame, RubyModule module, RubyString code, RubyString file, @SuppressWarnings("unused") int line, @SuppressWarnings("unused") UndefinedPlaceholder block) {
notDesignedForCompilation();

final Source source = Source.asPseudoFile(code.getBytes(), file.toString());
return getContext().execute(getContext(), source, code.getBytes().getEncoding(), TranslatorDriver.ParserContext.MODULE, module, frame.materialize(), this);
return classEvalSource(frame, module, source, code.getBytes().getEncoding());
}

private Object classEvalSource(VirtualFrame frame, RubyModule module, Source source, Encoding encoding) {
return getContext().execute(getContext(), source, encoding, TranslatorDriver.ParserContext.MODULE, module, frame.materialize(), this);
}

@Specialization