varexpr.java
来自「用Java实现的编译器。把源代码编译成SPARC汇编程序」· Java 代码 · 共 87 行
JAVA
87 行
// $Id: VarExpr.java,v 1.4 2000/10/21 22:44:34 mdeeds Exp $package java6035.tools.IR;/** * VarExpr represents a variable expression. */public class VarExpr extends Expression{ protected VarDescriptor var; /** * Creates a new VarExpression for the @param var. * This should be the symboltable entry for @param var. **/ public VarExpr(VarDescriptor var) { this.var = var; } /** * Returns the kind of this expression. (i.e. VAR_EXPR) **/ protected int expkind() { return VAR_EXPR; } /** * Returns the variable descriptor. (Not a clone.) **/ public VarDescriptor getOperand() { return var; } /** * Sets the variable descriptor. **/ public void setOperand(VarDescriptor v) { this.var = v; } /** * Walkable interface: returns the name of the node. */ public String getNodeName() { return "varexpr"; } /** * Walkable interface: returns the number of neighbors. */ public int getNeighborCount() { return 1; } /** * Walkable interface: returns the specified neighbor: 0, left operand; 1, * right operand if operation is binary. */ public Object getNeighbor(int index) { if (index == 0) return var; return null; } public String PPrint(int indent, boolean recursive) { String output = new String(); for(int i=0;i<indent;i++) output += " "; output += "(var_expr\n"; if (recursive) output += var.PPrint(indent+2, true); for(int i=0;i<indent;i++) output += " "; output += ") /* var_expr */\n"; return output; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?