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

Commits on Dec 30, 2014

  1. Copy the full SHA
    6cfa5bb View commit details
  2. Copy the full SHA
    8d89919 View commit details
  3. Copy the full SHA
    1e3d305 View commit details
40 changes: 0 additions & 40 deletions core/src/main/java/org/jruby/ast/ArgsNoArgNode.java

This file was deleted.

40 changes: 0 additions & 40 deletions core/src/main/java/org/jruby/ast/ArgsPreOneArgNode.java

This file was deleted.

40 changes: 0 additions & 40 deletions core/src/main/java/org/jruby/ast/ArgsPreTwoArgNode.java

This file was deleted.

65 changes: 3 additions & 62 deletions core/src/main/java/org/jruby/ast/AttrAssignNode.java
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ public AttrAssignNode(ISourcePosition position, Node receiverNode, String name,

this.receiverNode = receiverNode;
this.name = name;
setArgsInternal(argsNode);
this.argsNode = argsNode;
}

public NodeType getNodeType() {
@@ -95,74 +95,15 @@ public Node getArgsNode() {
return argsNode;
}


protected Node newAttrAssignNode(ArrayNode argsNode) {
int size = argsNode.size();

switch (size) {
case 1:
return new AttrAssignOneArgNode(getPosition(), receiverNode, name, argsNode);
case 2:
return new AttrAssignTwoArgNode(getPosition(), receiverNode, name, argsNode);
case 3:
return new AttrAssignThreeArgNode(getPosition(), receiverNode, name, argsNode);
default:
return new AttrAssignNode(getPosition(), receiverNode, name, argsNode);
}
}

protected Node newMutatedAttrAssignNode(ArrayNode argsNode) {
int size = argsNode.size();

switch (size) {
case 1:
if (!(this instanceof AttrAssignOneArgNode)) {
return new AttrAssignOneArgNode(getPosition(), receiverNode, name, argsNode);
} else {
return this;
}
case 2:
if (!(this instanceof AttrAssignTwoArgNode)) {
return new AttrAssignTwoArgNode(getPosition(), receiverNode, name, argsNode);
} else {
return this;
}
case 3:
if (!(this instanceof AttrAssignThreeArgNode)) {
return new AttrAssignThreeArgNode(getPosition(), receiverNode, name, argsNode);
} else {
return this;
}
default:
return new AttrAssignNode(getPosition(), receiverNode, name, argsNode);
}
}

/**
* Set the argsNode
*
* @param argsNode set the arguments for this node.
*/
public Node setArgsNode(Node argsNode) {
// Empirical Observations:
// null -> Some arity
// argsNode == this.argsNode then check for arity changes
// newline(splatnode) -> argspushnode
if (this.argsNode == null && argsNode instanceof ArrayNode) {
return newAttrAssignNode((ArrayNode) argsNode);
} else if (this.argsNode == argsNode) {
return newMutatedAttrAssignNode((ArrayNode)argsNode);
}

setArgsInternal(argsNode);

return this;
}

private void setArgsInternal(Node argsNode) {
this.argsNode = argsNode;
if (argsNode instanceof ArrayNode) ((ArrayNode)argsNode).setLightweight(true);

return this;
}

public List<Node> childNodes() {
29 changes: 0 additions & 29 deletions core/src/main/java/org/jruby/ast/AttrAssignOneArgNode.java

This file was deleted.

33 changes: 0 additions & 33 deletions core/src/main/java/org/jruby/ast/AttrAssignThreeArgNode.java

This file was deleted.

31 changes: 0 additions & 31 deletions core/src/main/java/org/jruby/ast/AttrAssignTwoArgNode.java

This file was deleted.

8 changes: 2 additions & 6 deletions core/src/main/java/org/jruby/ast/CallNode.java
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ public CallNode(ISourcePosition position, Node receiverNode, String name, Node a

this.name = name;
this.receiverNode = receiverNode;
setArgsNode(argsNode);
this.argsNode = argsNode;
this.iterNode = iterNode;
}

@@ -96,11 +96,7 @@ public Node getArgsNode() {
*/
public Node setArgsNode(Node argsNode) {
this.argsNode = argsNode;
// If we have more than one arg, make sure the array created to contain them is not ObjectSpaced
if (argsNode instanceof ArrayNode) {
((ArrayNode)argsNode).setLightweight(true);
}


return argsNode;
}

11 changes: 3 additions & 8 deletions core/src/main/java/org/jruby/ast/FCallNode.java
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ public FCallNode(ISourcePosition position, String name) {
public FCallNode(ISourcePosition position, String name, Node argsNode, Node iterNode) {
super(position);
this.name = name;
setArgsNode(argsNode);
this.argsNode = argsNode;
this.iterNode = iterNode;
}

@@ -89,16 +89,11 @@ public Node getArgsNode() {
}

/**
* Set the argsNode. This is for re-writer and general interpretation.
*
* @param argsNode set the arguments for this node.
* Set the argsNode. Changes to parser means fcall is made before actual
* args are associated with fcall so we need a setter.
*/
public Node setArgsNode(Node argsNode) {
this.argsNode = argsNode;
// If we have more than one arg, make sure the array created to contain them is not ObjectSpaced
if (argsNode instanceof ArrayNode) {
((ArrayNode)argsNode).setLightweight(true);
}

return argsNode;
}
11 changes: 3 additions & 8 deletions core/src/main/java/org/jruby/ir/IRBuilder.java
Original file line number Diff line number Diff line change
@@ -579,15 +579,10 @@ protected Operand buildCallArgs(List<Operand> argsList, Node args, IRScope s) {
}
case ARRAYNODE: {
ArrayNode arrayNode = (ArrayNode)args;
if (arrayNode.isLightweight()) {
List<Node> children = arrayNode.childNodes();
List<Node> children = arrayNode.childNodes();
// explode array, it's an internal "args" array
for (Node n: children) {
argsList.add(build(n, s));
}
} else {
// use array as-is, it's a literal array
argsList.add(build(arrayNode, s));
for (Node n: children) {
argsList.add(build(n, s));
}
break;
}
Loading