forked from jruby/jruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlockArg18Node.java
More file actions
53 lines (42 loc) · 1.18 KB
/
Copy pathBlockArg18Node.java
File metadata and controls
53 lines (42 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package org.jruby.ast;
import java.util.List;
import org.jruby.ast.visitor.NodeVisitor;
import org.jruby.lexer.yacc.ISourcePosition;
/**
* Similiar to BlockArg, but with idiosyncracies that 1.8.7 allows:
*
* proc { |a,&b| }
* proc { |a,&FOO| }
* proc { |a,b.c| }
* proc { |a,b[0]| }
*
*/
public class BlockArg18Node extends Node {
private Node normalBlockArgs;
private Node blockArgAssignee;
public BlockArg18Node(ISourcePosition position, Node blockArgAssignee,
Node normalBlockArgs) {
super(position);
assert blockArgAssignee != null : "Must be a value to assign too";
this.blockArgAssignee = blockArgAssignee;
this.normalBlockArgs = normalBlockArgs;
}
public Node getArgs() {
return normalBlockArgs;
}
public Node getBlockArg() {
return blockArgAssignee;
}
@Override
public Object accept(NodeVisitor visitor) {
return visitor.visitBlockArg18Node(this);
}
@Override
public List<Node> childNodes() {
return createList(normalBlockArgs, blockArgAssignee);
}
@Override
public NodeType getNodeType() {
return NodeType.BLOCKARG18NODE;
}
}