📄 callnode.java
字号:
package ast.binaryExpr;
// children [0] : 1. Parameter
// children [1] : 2. Parameter
public class CallNode extends ast.JSubNode {
private ast.declaration.StaticMethod calledmethod;
public CallNode (ast.declaration.JSubObject calledmethod) {
this.calledmethod = (ast.declaration.StaticMethod)calledmethod;
}
public String toString () {
return "()";
}
public void codegen () {
int k = getNumChildren ();
for (int i = 0; i < k; i++) {
ast.IJSubNode nextvalue = (ast.IJSubNode)getChild (i);
nextvalue.codegen ();
}
codegen.WriteCode.genstaticCall (
calledmethod.getMethodName(),
calledmethod.getSignature(),
calledmethod.getType());
}
public int getDepth () {
int depth = 0;
for (int i = 0; i < children.size(); i++) {
ast.IJSubNode node = (ast.IJSubNode)children.elementAt(i);
int ndepth = node.getDepth() + i + 1;
if (depth < ndepth)
depth = ndepth;
}
return depth;
}
public void dump (String prefix) {
System.out.println (prefix + calledmethod.toString());
super.dump (prefix + " ");
}
public String getXMLType () {
return "call";
}
public void genXML (java.io.PrintStream p, String prefix) {
p.println (prefix + "<" + getXMLType () + ">");
p.println (prefix + "<calledmethod name = \"" + calledmethod.getName () +"\">");
p.println (prefix + "</calledmethod>");
p.println (prefix + "<parameters>");
for (int i = 0; i < children.size(); i++) {
ast.IJSubNode n = (ast.IJSubNode)children.elementAt(i);
n.genXML (p, prefix + " ");
}
p.println (prefix + "</parameters>");
p.println (prefix + "</" + getXMLType () + ">");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -