📄 tree.java
字号:
* @param flags variable flags
* @param name variable name
* @param vartype type of the variable
* @param init variables initial value
* @param sym symbol
*/
public static class VarDef extends Tree {
public long flags;
public Name name;
public Tree vartype;
public Tree init;
public VarSymbol sym;
public VarDef(long flags, Name name, Tree vartype, Tree init, VarSymbol sym) {
super(VARDEF);
this.flags = flags;
this.name = name;
this.vartype = vartype;
this.init = init;
this.sym = sym;
}
public void accept(Visitor v) {
v.visitVarDef(this);
}
public static final List emptyList = new List();
}
/**
* A no-op statement ";".
*/
public static class Skip extends Tree {
public Skip() {
super(SKIP);
}
public void accept(Visitor v) {
v.visitSkip(this);
}
}
/**
* A statement block.
* @param stats statements
* @param flags modifier
*/
public static class Block extends Tree {
public long flags;
public List stats;
public int endpos = Position.NOPOS;
public Block(long flags, List stats) {
super(BLOCK);
this.stats = stats;
this.flags = flags;
}
public void accept(Visitor v) {
v.visitBlock(this);
}
}
/**
* A do loop
*/
public static class DoLoop extends Tree {
public Tree body;
public Tree cond;
public DoLoop(Tree body, Tree cond) {
super(DOLOOP);
this.body = body;
this.cond = cond;
}
public void accept(Visitor v) {
v.visitDoLoop(this);
}
}
/**
* A while loop
*/
public static class WhileLoop extends Tree {
public Tree cond;
public Tree body;
public WhileLoop(Tree cond, Tree body) {
super(WHILELOOP);
this.cond = cond;
this.body = body;
}
public void accept(Visitor v) {
v.visitWhileLoop(this);
}
}
/**
* A for loop.
*/
public static class ForLoop extends Tree {
public List init;
public Tree cond;
public List step;
public Tree body;
public ForLoop(List init, Tree cond, List step, Tree body) {
super(FORLOOP);
this.init = init;
this.cond = cond;
this.step = step;
this.body = body;
}
public void accept(Visitor v) {
v.visitForLoop(this);
}
}
/**
* A labelled expression or statement.
*/
public static class Labelled extends Tree {
public Name label;
public Tree body;
public Labelled(Name label, Tree body) {
super(LABELLED);
this.label = label;
this.body = body;
}
public void accept(Visitor v) {
v.visitLabelled(this);
}
}
/**
* A "switch ( ) { }" construction.
*/
public static class Switch extends Tree {
public Tree selector;
public List cases;
public Switch(Tree selector, List cases) {
super(SWITCH);
this.selector = selector;
this.cases = cases;
}
public void accept(Visitor v) {
v.visitSwitch(this);
}
}
/**
* A "case :" of a switch.
*/
public static class Case extends Tree {
public Tree pat;
public List stats;
public Case(Tree pat, List stats) {
super(CASE);
this.pat = pat;
this.stats = stats;
}
public void accept(Visitor v) {
v.visitCase(this);
}
}
/**
* A synchronized block.
*/
public static class Synchronized extends Tree {
public Tree lock;
public Tree body;
public Synchronized(Tree lock, Tree body) {
super(SYNCHRONIZED);
this.lock = lock;
this.body = body;
}
public void accept(Visitor v) {
v.visitSynchronized(this);
}
}
/**
* A "try { } catch ( ) { } finally { }" block.
*/
public static class Try extends Tree {
public Tree body;
public List catchers;
public Tree finalizer;
public Try(Tree body, List catchers, Tree finalizer) {
super(TRY);
this.body = body;
this.catchers = catchers;
this.finalizer = finalizer;
}
public void accept(Visitor v) {
v.visitTry(this);
}
}
/**
* A catch block.
*/
public static class Catch extends Tree {
public VarDef param;
public Tree body;
public Catch(VarDef param, Tree body) {
super(CATCH);
this.param = param;
this.body = body;
}
public void accept(Visitor v) {
v.visitCatch(this);
}
public static List emptyList = new List();
}
/**
* A ( ) ? ( ) : ( ) conditional expression
*/
public static class Conditional extends Tree {
public Tree cond;
public Tree truepart;
public Tree falsepart;
public Conditional(Tree cond, Tree truepart, Tree falsepart) {
super(CONDEXPR);
this.cond = cond;
this.truepart = truepart;
this.falsepart = falsepart;
}
public void accept(Visitor v) {
v.visitConditional(this);
}
}
/**
* An "if ( ) { } else { }" block
*/
public static class If extends Tree {
public Tree cond;
public Tree thenpart;
public Tree elsepart;
public If(Tree cond, Tree thenpart, Tree elsepart) {
super(IF);
this.cond = cond;
this.thenpart = thenpart;
this.elsepart = elsepart;
}
public void accept(Visitor v) {
v.visitIf(this);
}
}
/**
* an expression statement
* @param expr expression structure
*/
public static class Exec extends Tree {
public Tree expr;
public Exec(Tree expr) {
super(EXEC);
this.expr = expr;
}
public void accept(Visitor v) {
v.visitExec(this);
}
}
/**
* A break from a loop or switch.
*/
public static class Break extends Tree {
public Name label;
public Tree target;
public Break(Name label, Tree target) {
super(BREAK);
this.label = label;
this.target = target;
}
public void accept(Visitor v) {
v.visitBreak(this);
}
}
/**
* A continue of a loop.
*/
public static class Continue extends Tree {
public Name label;
public Tree target;
public Continue(Name label, Tree target) {
super(CONTINUE);
this.label = label;
this.target = target;
}
public void accept(Visitor v) {
v.visitContinue(this);
}
}
/**
* A return statement.
*/
public static class Return extends Tree {
public Tree expr;
public Return(Tree expr) {
super(RETURN);
this.expr = expr;
}
public void accept(Visitor v) {
v.visitReturn(this);
}
}
/**
* A throw statement.
*/
public static class Throw extends Tree {
public Tree expr;
public Throw(Tree expr) {
super(THROW);
this.expr = expr;
}
public void accept(Visitor v) {
v.visitThrow(this);
}
}
/**
* An assert statement.
*/
public static class Assert extends Tree {
public Tree cond;
public Tree detail;
public Assert(Tree cond, Tree detail) {
super(ASSERT);
this.cond = cond;
this.detail = detail;
}
public void accept(Visitor v) {
v.visitAssert(this);
}
}
/**
* A method invocation
*/
public static class Apply extends Tree {
public Tree meth;
public List args;
public Apply(Tree meth, List args) {
super(APPLY);
this.meth = meth;
this.args = args;
}
public void accept(Visitor v) {
v.visitApply(this);
}
}
/**
* A new(...) operation.
*/
public static class NewClass extends Tree {
public Tree encl;
public Tree clazz;
public List args;
public ClassDef def;
public Symbol constructor;
public NewClass(Tree encl, Tree clazz, List args, ClassDef def,
Symbol constructor) {
super(NEWCLASS);
this.encl = encl;
this.clazz = clazz;
this.args = args;
this.def = def;
this.constructor = constructor;
}
public void accept(Visitor v) {
v.visitNewClass(this);
}
}
/**
* A new[...] operation.
*/
public static class NewArray extends Tree {
public Tree elemtype;
public List dims;
public List elems;
public NewArray(Tree elemtype, List dims, List elems) {
super(NEWARRAY);
this.elemtype = elemtype;
this.dims = dims;
this.elems = elems;
}
public void accept(Visitor v) {
v.visitNewArray(this);
}
}
/**
* A parenthesized subexpression ( ... )
*/
public static class Parens extends Tree {
public Tree expr;
public Parens(Tree expr) {
super(PARENS);
this.expr = expr;
}
public void accept(Visitor v) {
v.visitParens(this);
}
}
/**
* A assignment with "=".
*/
public static class Assign extends Tree {
public Tree lhs;
public Tree rhs;
public Assign(Tree lhs, Tree rhs) {
super(ASSIGN);
this.lhs = lhs;
this.rhs = rhs;
}
public void accept(Visitor v) {
v.visitAssign(this);
}
}
/**
* An assignment with "+=", "|=" ...
*/
public static class Assignop extends Tree {
public Tree lhs;
public Tree rhs;
public Symbol operator;
public Assignop(int opcode, Tree lhs, Tree rhs, Symbol operator) {
super(opcode);
this.lhs = lhs;
this.rhs = rhs;
this.operator = operator;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -