📄 localvariable.java
字号:
package ast.declaration;
public class LocalVariable extends ast.declaration.JSubObject {
private boolean iAmAParameter;
private static int currentNoInThisLevel;
private int no; // current number of varible
// to count local Variable. 0 = this,
public static void reset () {
currentNoInThisLevel = 0;
}
public LocalVariable (String name, boolean iAmAParameter) {
super (name, ast.declaration.JSubObject.TINT);
this.iAmAParameter = iAmAParameter;
no = currentNoInThisLevel++;
}
public String toString () {
return "" + no;
}
public void dump (String prefix) {
char c = ' ';
if (iAmAParameter)
c = 'p';
System.out.print ("local" + c + ' ' + no + " ");
super.dump (prefix);
}
public void genXML (java.io.PrintStream p, String prefix) {
p.println (prefix + "<localvariable name = \"" + getName () +"\"/>");
}
public boolean isParameter () {
return iAmAParameter;
}
public String getStoreString () {
StringBuffer buffer = new StringBuffer ("istore");
if (no <= 3)
buffer.append ('_');//istroe_0,1,2,3 pop int to local variable position 0,1,2,3.
else
buffer.append (' ');//it is functionally equivalent to istore_
buffer.append (no);
return buffer.toString ();
}
public String getLoadString () {
StringBuffer buffer = new StringBuffer ("iload");
if (no <= 3)
buffer.append ('_');//iload_0,1,2,3 pushes int from local variable position 0,1,2,3.
else
buffer.append (' ');//it is functionally equivalent to iload_
buffer.append (no);
return buffer.toString ();
}
public String getXMLType () {
return "local";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -