📄 int.java
字号:
package ast.declaration;
// int object in the project
public class Int extends ast.declaration.JSubObject {
private int value;
public Int (String name) {
super (name, ast.declaration.JSubObject.TINT);
value = new Integer (name).intValue();
}
public void dump (String prefix) {
System.out.print (prefix + "constant ");
super.dump ("");
}
public String getLoadString () {
if (0 <= value && value <= 5)
return "iconst_" + value;//push the int value 0 to 5 on the stack
if (-(2 << 7) <= value && value <= (2 << 7) - 1)
return "bipush " + value;// value is an integer >= -128 and <= 127 that is pushed onto the stack.(byte)
if (-(2 << 15) <= value && value <= (2 << 15) - 1)
return "sipush " + value;//value is a signed integer in the range -32768 to 32767.(short)
return "ldc " + value; //value is an int, a float, or a quoted (i.e. literal) string.
public String getStoreString () {
util.Error.e3 ("no value allocate to constant");
return "";
}
public boolean isParameter () {
return false;
}
public String getXMLType () {
return "int";
}
public void genXML (java.io.PrintStream p, String prefix) {
p.println (prefix + "<Int value = \"" + value +"\"/>");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -