Skip to content
Permalink
Browse files
Merge branch 'master' of github.com:jruby/jruby
  • Loading branch information
chrisseaton committed Dec 5, 2014
2 parents d454f28 + 59c9f74 commit 5a441e6766c1758801d2fd6662c32133605152f0
@@ -66,15 +66,10 @@ public IRubyObject append(ThreadContext context, IRubyObject obj) {
paths = context.runtime.newArray(obj).toJavaArray();
}

boolean is1_8 = context.getRuntime().is1_8();
for (IRubyObject path: paths) {
String ss = path.convertToString().toString();
try {
URL url = getURL(path.convertToString().toString());
if (url.getProtocol().equals("file")) {
path = is1_8 ? RubyFile.expand_path(context, null, new IRubyObject[]{ path })
: RubyFile.expand_path19(context, null, new IRubyObject[]{ path });
url = getURL(path.convertToString().toString());
}
URL url = getURL(ss);
getRuntime().getJRubyClassLoader().addURL(url);
} catch (MalformedURLException mue) {
throw getRuntime().newArgumentError(mue.getLocalizedMessage());
@@ -3510,7 +3510,12 @@ private Operand[] adjustVariableDepth(Operand[] args, int depthFromSuper) {
Operand[] newArgs = new Operand[args.length];

for (int i = 0; i < args.length; i++) {
newArgs[i] = ((DepthCloneable) args[i]).cloneForDepth(depthFromSuper);
// Because of keyword args, we can have a keyword-arg hash in the call args.
if (args[i] instanceof Hash) {
newArgs[i] = ((Hash) args[i]).cloneForLVarDepth(depthFromSuper);
} else {
newArgs[i] = ((DepthCloneable) args[i]).cloneForDepth(depthFromSuper);
}
}

return newArgs;
@@ -71,6 +71,14 @@ public void addUsedVariables(List<Variable> l) {
}
}

public Operand cloneForLVarDepth(int newDepth) {
List<KeyValuePair<Operand, Operand>> newPairs = new java.util.ArrayList<KeyValuePair<Operand, Operand>>();
for (KeyValuePair<Operand, Operand> pair : pairs) {
newPairs.add(new KeyValuePair(pair.getKey(), ((DepthCloneable) pair.getValue()).cloneForDepth(newDepth)));
}
return new Hash(newPairs, isKWArgsHash);
}

@Override
public Operand cloneForInlining(CloneInfo ii) {
if (hasKnownValue())
@@ -4,14 +4,15 @@
describe "<<" do
it "accepts an object" do
$CLASSPATH << "file"
$CLASSPATH.to_a.include?("file:#{File.expand_path('file')}").should == true
$CLASSPATH.to_a.include?("file:file").should == true
end

it "accepts an array" do
Dir.chdir(File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')) do
$CLASSPATH << Dir.glob("*.jar")
($CLASSPATH.to_a.include?("file:#{File.expand_path('jruby.jar')}")).should == true
($CLASSPATH.to_a.include?("file:jruby.jar") ||
$CLASSPATH.to_a.include?("file:jruby-complete.jar") ).should == true
end
end
end
end
end

0 comments on commit 5a441e6

Please sign in to comment.