📄 returninstr.java
字号:
// $Id: ReturnInstr.java,v 1.4 1999/09/30 01:48:34 deberg Exp $package java6035.tools.IR;/** * The ReturnInstr class captures a return statement. This class optionally * takes a Rhs value as the possible return value. */public class ReturnInstr extends Instruction{ protected Rhs rhs; /** * Creates a return instruction with no return value. */ public ReturnInstr() { rhs = null; } /** * Creates a return instruction with a return value in r. */ public ReturnInstr(Rhs r) { this.rhs = r; } /** * Returns the type of the instruction. */ protected int tnkind() { return RETURN_INSTR; } /** * Replaces the return value. */ public void setReturnValue(Rhs v) { this.rhs = v; } /** * Returns the return value. */ public Rhs getReturnValue() { return rhs; } /** * Walkable: returns the name of the node. */ public String getNodeName() { return "return"; } /** * Walkable: returns the number of neighbors from this node. */ public int getNeighborCount() { if (rhs != null) return 1; return 0; } /** * Walkable: returns a specific neighbor: 0, return value if there is one. */ public Object getNeighbor(int index) { if (rhs != null) { if (index == 0) return rhs; } return null; } public String PPrint(int indent, boolean recursive) { String output = new String(); for(int i=0;i<indent;i++) output += " "; output += "(return_instruction\n"; if (recursive) if (rhs != null) output += this.rhs.PPrint(indent+2, true); for(int i=0;i<indent;i++) output += " "; output += ") /* return_instruction */\n"; return output; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -