📄 crtable.java
字号:
} public void visitCase(JCCase tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.pat)); sr.mergeWith(csp(tree.stats)); result = sr; } public void visitSynchronized(JCSynchronized tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.lock)); sr.mergeWith(csp(tree.body)); result = sr; } public void visitTry(JCTry tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.body)); sr.mergeWith(cspCatchers(tree.catchers)); sr.mergeWith(csp(tree.finalizer)); result = sr; } public void visitCatch(JCCatch tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.param)); sr.mergeWith(csp(tree.body)); result = sr; } public void visitConditional(JCConditional tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.cond)); sr.mergeWith(csp(tree.truepart)); sr.mergeWith(csp(tree.falsepart)); result = sr; } public void visitIf(JCIf tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.cond)); sr.mergeWith(csp(tree.thenpart)); sr.mergeWith(csp(tree.elsepart)); result = sr; } public void visitExec(JCExpressionStatement tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.expr)); result = sr; } public void visitBreak(JCBreak tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); result = sr; } public void visitContinue(JCContinue tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); result = sr; } public void visitReturn(JCReturn tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.expr)); result = sr; } public void visitThrow(JCThrow tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.expr)); result = sr; } public void visitAssert(JCAssert tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.cond)); sr.mergeWith(csp(tree.detail)); result = sr; } public void visitApply(JCMethodInvocation tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.meth)); sr.mergeWith(csp(tree.args)); result = sr; } public void visitNewClass(JCNewClass tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.encl)); sr.mergeWith(csp(tree.clazz)); sr.mergeWith(csp(tree.args)); sr.mergeWith(csp(tree.def)); result = sr; } public void visitNewArray(JCNewArray tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.elemtype)); sr.mergeWith(csp(tree.dims)); sr.mergeWith(csp(tree.elems)); result = sr; } public void visitParens(JCParens tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.expr)); result = sr; } public void visitAssign(JCAssign tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.lhs)); sr.mergeWith(csp(tree.rhs)); result = sr; } public void visitAssignop(JCAssignOp tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.lhs)); sr.mergeWith(csp(tree.rhs)); result = sr; } public void visitUnary(JCUnary tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.arg)); result = sr; } public void visitBinary(JCBinary tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.lhs)); sr.mergeWith(csp(tree.rhs)); result = sr; } public void visitTypeCast(JCTypeCast tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.clazz)); sr.mergeWith(csp(tree.expr)); result = sr; } public void visitTypeTest(JCInstanceOf tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.expr)); sr.mergeWith(csp(tree.clazz)); result = sr; } public void visitIndexed(JCArrayAccess tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.indexed)); sr.mergeWith(csp(tree.index)); result = sr; } public void visitSelect(JCFieldAccess tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.selected)); result = sr; } public void visitIdent(JCIdent tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); result = sr; } public void visitLiteral(JCLiteral tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); result = sr; } public void visitTypeIdent(JCPrimitiveTypeTree tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); result = sr; } public void visitTypeArray(JCArrayTypeTree tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.elemtype)); result = sr; } public void visitTypeApply(JCTypeApply tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.clazz)); sr.mergeWith(csp(tree.arguments)); result = sr; } public void visitTypeParameter(JCTypeParameter tree) { SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); sr.mergeWith(csp(tree.bounds)); result = sr; } public void visitWildcard(JCWildcard tree) { result = null; } public void visitErroneous(JCErroneous tree) { result = null; } public void visitTree(JCTree tree) { assert false; } /** The start position of given tree. */ public int startPos(JCTree tree) { if (tree == null) return Position.NOPOS; return tree.pos; } /** The end position of given tree, if it has * defined endpos, NOPOS otherwise. */ public int endPos(JCTree tree) { if (tree == null) return Position.NOPOS; if (tree.getTag() == JCTree.BLOCK) return ((JCBlock) tree).endpos; Integer endpos = endPositions.get(tree); if (endpos != null) return endpos.intValue(); return Position.NOPOS; } } /** This class contains a CharacterRangeTableEntry. */ static class CRTEntry { /** A tree or a list of trees to obtain source positions. */ Object tree; /** The flags described in the CharacterRangeTable spec. */ int flags; /** The starting code position of this entry. */ int startPc; /** The ending code position of this entry. */ int endPc; /** Constructor */ CRTEntry(Object tree, int flags, int startPc, int endPc) { this.tree = tree; this.flags = flags; this.startPc = startPc; this.endPc = endPc; } } /** This class contains source positions * for some tree or list of trees. */ static class SourceRange { /** The starting source position. */ int startPos; /** The ending source position. */ int endPos; /** Constructor */ SourceRange() { startPos = Position.NOPOS; endPos = Position.NOPOS; } /** Constructor */ SourceRange(int startPos, int endPos) { this.startPos = startPos; this.endPos = endPos; } /** Compare the starting and the ending positions * of the source range and combines them assigning * the widest range to this. */ SourceRange mergeWith(SourceRange sr) { if (sr == null) return this; if (startPos == Position.NOPOS) startPos = sr.startPos; else if (sr.startPos != Position.NOPOS) startPos = (startPos < sr.startPos ? startPos : sr.startPos); if (endPos == Position.NOPOS) endPos = sr.endPos; else if (sr.endPos != Position.NOPOS) endPos = (endPos > sr.endPos ? endPos : sr.endPos); return this; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -