1 31 package org.jruby.ast; 32 33 import java.io.IOException ; 34 import java.util.List ; 35 36 import org.jruby.ast.visitor.NodeVisitor; 37 import org.jruby.evaluator.Instruction; 38 import org.jruby.lexer.yacc.ISourcePosition; 39 40 44 public class OpAsgnNode extends Node { 45 static final long serialVersionUID = -1950295226516487753L; 46 47 private final Node receiverNode; 48 private final Node valueNode; 49 private String variableName; 50 private String operatorName; 51 private String variableNameAsgn; 52 53 public OpAsgnNode(ISourcePosition position, Node receiverNode, Node valueNode, String variableName, String methodName) { 54 super(position, NodeTypes.OPASGNNODE); 55 this.receiverNode = receiverNode; 56 this.valueNode = valueNode; 57 this.variableName = variableName.intern(); 58 this.operatorName = methodName.intern(); 59 this.variableNameAsgn = (variableName + "=").intern(); 60 } 61 62 private void readObject(java.io.ObjectInputStream in) throws IOException , ClassNotFoundException { 63 in.defaultReadObject(); 64 65 variableName = variableName.intern(); 67 operatorName = operatorName.intern(); 68 variableNameAsgn = variableNameAsgn.intern(); 69 } 70 71 75 public Instruction accept(NodeVisitor iVisitor) { 76 return iVisitor.visitOpAsgnNode(this); 77 } 78 79 83 public String getOperatorName() { 84 return operatorName; 85 } 86 87 91 public Node getReceiverNode() { 92 return receiverNode; 93 } 94 95 99 public Node getValueNode() { 100 return valueNode; 101 } 102 103 107 public String getVariableName() { 108 return variableName; 109 } 110 111 public String getVariableNameAsgn() { 112 return variableNameAsgn; 113 } 114 115 public List childNodes() { 116 return Node.createList(receiverNode, valueNode); 117 } 118 119 } 120 | Popular Tags |