< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeCopier.java

Print this page
rev 51104 : imported patch switch


 123     }
 124 
 125     @DefinedBy(Api.COMPILER_TREE)
 126     public JCTree visitBinary(BinaryTree node, P p) {
 127         JCBinary t = (JCBinary) node;
 128         JCExpression lhs = copy(t.lhs, p);
 129         JCExpression rhs = copy(t.rhs, p);
 130         return M.at(t.pos).Binary(t.getTag(), lhs, rhs);
 131     }
 132 
 133     @DefinedBy(Api.COMPILER_TREE)
 134     public JCTree visitBlock(BlockTree node, P p) {
 135         JCBlock t = (JCBlock) node;
 136         List<JCStatement> stats = copy(t.stats, p);
 137         return M.at(t.pos).Block(t.flags, stats);
 138     }
 139 
 140     @DefinedBy(Api.COMPILER_TREE)
 141     public JCTree visitBreak(BreakTree node, P p) {
 142         JCBreak t = (JCBreak) node;
 143         return M.at(t.pos).Break(t.label);

 144     }
 145 
 146     @DefinedBy(Api.COMPILER_TREE)
 147     public JCTree visitCase(CaseTree node, P p) {
 148         JCCase t = (JCCase) node;
 149         JCExpression pat = copy(t.pat, p);
 150         List<JCStatement> stats = copy(t.stats, p);
 151         return M.at(t.pos).Case(pat, stats);

 152     }
 153 
 154     @DefinedBy(Api.COMPILER_TREE)
 155     public JCTree visitCatch(CatchTree node, P p) {
 156         JCCatch t = (JCCatch) node;
 157         JCVariableDecl param = copy(t.param, p);
 158         JCBlock body = copy(t.body, p);
 159         return M.at(t.pos).Catch(param, body);
 160     }
 161 
 162     @DefinedBy(Api.COMPILER_TREE)
 163     public JCTree visitClass(ClassTree node, P p) {
 164         JCClassDecl t = (JCClassDecl) node;
 165         JCModifiers mods = copy(t.mods, p);
 166         List<JCTypeParameter> typarams = copy(t.typarams, p);
 167         JCExpression extending = copy(t.extending, p);
 168         List<JCExpression> implementing = copy(t.implementing, p);
 169         List<JCTree> defs = copy(t.defs, p);
 170         return M.at(t.pos).ClassDef(mods, t.name, typarams, extending, implementing, defs);
 171     }


 354         JCExpression expr = copy(t.expr, p);
 355         List<JCExpression> typeargs = copy(t.typeargs, p);
 356         return M.at(t.pos).Reference(t.mode, t.name, expr, typeargs);
 357     }
 358 
 359     @DefinedBy(Api.COMPILER_TREE)
 360     public JCTree visitEmptyStatement(EmptyStatementTree node, P p) {
 361         JCSkip t = (JCSkip) node;
 362         return M.at(t.pos).Skip();
 363     }
 364 
 365     @DefinedBy(Api.COMPILER_TREE)
 366     public JCTree visitSwitch(SwitchTree node, P p) {
 367         JCSwitch t = (JCSwitch) node;
 368         JCExpression selector = copy(t.selector, p);
 369         List<JCCase> cases = copy(t.cases, p);
 370         return M.at(t.pos).Switch(selector, cases);
 371     }
 372 
 373     @DefinedBy(Api.COMPILER_TREE)









 374     public JCTree visitSynchronized(SynchronizedTree node, P p) {
 375         JCSynchronized t = (JCSynchronized) node;
 376         JCExpression lock = copy(t.lock, p);
 377         JCBlock body = copy(t.body, p);
 378         return M.at(t.pos).Synchronized(lock, body);
 379     }
 380 
 381     @DefinedBy(Api.COMPILER_TREE)
 382     public JCTree visitThrow(ThrowTree node, P p) {
 383         JCThrow t = (JCThrow) node;
 384         JCExpression expr = copy(t.expr, p);
 385         return M.at(t.pos).Throw(expr);
 386     }
 387 
 388     @DefinedBy(Api.COMPILER_TREE)
 389     public JCTree visitCompilationUnit(CompilationUnitTree node, P p) {
 390         JCCompilationUnit t = (JCCompilationUnit) node;
 391         List<JCTree> defs = copy(t.defs, p);
 392         return M.at(t.pos).TopLevel(defs);
 393     }


 542     @Override @DefinedBy(Api.COMPILER_TREE)
 543     public JCRequires visitRequires(RequiresTree node, P p) {
 544         JCRequires t = (JCRequires) node;
 545         JCExpression moduleName = copy(t.moduleName, p);
 546         return M.at(t.pos).Requires(t.isTransitive, t.isStaticPhase, moduleName);
 547     }
 548 
 549     @Override @DefinedBy(Api.COMPILER_TREE)
 550     public JCUses visitUses(UsesTree node, P p) {
 551         JCUses t = (JCUses) node;
 552         JCExpression serviceName = copy(t.qualid, p);
 553         return M.at(t.pos).Uses(serviceName);
 554     }
 555 
 556     @DefinedBy(Api.COMPILER_TREE)
 557     public JCTree visitOther(Tree node, P p) {
 558         JCTree tree = (JCTree) node;
 559         switch (tree.getTag()) {
 560             case LETEXPR: {
 561                 LetExpr t = (LetExpr) node;
 562                 List<JCVariableDecl> defs = copy(t.defs, p);
 563                 JCExpression expr = copy(t.expr, p);
 564                 return M.at(t.pos).LetExpr(defs, expr);
 565             }
 566             default:
 567                 throw new AssertionError("unknown tree tag: " + tree.getTag());
 568         }
 569     }
 570 
 571 }


 123     }
 124 
 125     @DefinedBy(Api.COMPILER_TREE)
 126     public JCTree visitBinary(BinaryTree node, P p) {
 127         JCBinary t = (JCBinary) node;
 128         JCExpression lhs = copy(t.lhs, p);
 129         JCExpression rhs = copy(t.rhs, p);
 130         return M.at(t.pos).Binary(t.getTag(), lhs, rhs);
 131     }
 132 
 133     @DefinedBy(Api.COMPILER_TREE)
 134     public JCTree visitBlock(BlockTree node, P p) {
 135         JCBlock t = (JCBlock) node;
 136         List<JCStatement> stats = copy(t.stats, p);
 137         return M.at(t.pos).Block(t.flags, stats);
 138     }
 139 
 140     @DefinedBy(Api.COMPILER_TREE)
 141     public JCTree visitBreak(BreakTree node, P p) {
 142         JCBreak t = (JCBreak) node;
 143         JCExpression value = copy(t.value, p);
 144         return M.at(t.pos).Break(value);
 145     }
 146 
 147     @DefinedBy(Api.COMPILER_TREE)
 148     public JCTree visitCase(CaseTree node, P p) {
 149         JCCase t = (JCCase) node;
 150         List<JCExpression> pats = copy(t.pats, p);
 151         List<JCStatement> stats = copy(t.stats, p);
 152         JCTree body = copy(t.body, p);
 153         return M.at(t.pos).Case(t.caseKind, pats, stats, body);
 154     }
 155 
 156     @DefinedBy(Api.COMPILER_TREE)
 157     public JCTree visitCatch(CatchTree node, P p) {
 158         JCCatch t = (JCCatch) node;
 159         JCVariableDecl param = copy(t.param, p);
 160         JCBlock body = copy(t.body, p);
 161         return M.at(t.pos).Catch(param, body);
 162     }
 163 
 164     @DefinedBy(Api.COMPILER_TREE)
 165     public JCTree visitClass(ClassTree node, P p) {
 166         JCClassDecl t = (JCClassDecl) node;
 167         JCModifiers mods = copy(t.mods, p);
 168         List<JCTypeParameter> typarams = copy(t.typarams, p);
 169         JCExpression extending = copy(t.extending, p);
 170         List<JCExpression> implementing = copy(t.implementing, p);
 171         List<JCTree> defs = copy(t.defs, p);
 172         return M.at(t.pos).ClassDef(mods, t.name, typarams, extending, implementing, defs);
 173     }


 356         JCExpression expr = copy(t.expr, p);
 357         List<JCExpression> typeargs = copy(t.typeargs, p);
 358         return M.at(t.pos).Reference(t.mode, t.name, expr, typeargs);
 359     }
 360 
 361     @DefinedBy(Api.COMPILER_TREE)
 362     public JCTree visitEmptyStatement(EmptyStatementTree node, P p) {
 363         JCSkip t = (JCSkip) node;
 364         return M.at(t.pos).Skip();
 365     }
 366 
 367     @DefinedBy(Api.COMPILER_TREE)
 368     public JCTree visitSwitch(SwitchTree node, P p) {
 369         JCSwitch t = (JCSwitch) node;
 370         JCExpression selector = copy(t.selector, p);
 371         List<JCCase> cases = copy(t.cases, p);
 372         return M.at(t.pos).Switch(selector, cases);
 373     }
 374 
 375     @DefinedBy(Api.COMPILER_TREE)
 376     @SuppressWarnings("removal")
 377     public JCTree visitSwitchExpression(SwitchExpressionTree node, P p) {
 378         JCSwitchExpression t = (JCSwitchExpression) node;
 379         JCExpression selector = copy(t.selector, p);
 380         List<JCCase> cases = copy(t.cases, p);
 381         return M.at(t.pos).SwitchExpression(selector, cases);
 382     }
 383 
 384     @DefinedBy(Api.COMPILER_TREE)
 385     public JCTree visitSynchronized(SynchronizedTree node, P p) {
 386         JCSynchronized t = (JCSynchronized) node;
 387         JCExpression lock = copy(t.lock, p);
 388         JCBlock body = copy(t.body, p);
 389         return M.at(t.pos).Synchronized(lock, body);
 390     }
 391 
 392     @DefinedBy(Api.COMPILER_TREE)
 393     public JCTree visitThrow(ThrowTree node, P p) {
 394         JCThrow t = (JCThrow) node;
 395         JCExpression expr = copy(t.expr, p);
 396         return M.at(t.pos).Throw(expr);
 397     }
 398 
 399     @DefinedBy(Api.COMPILER_TREE)
 400     public JCTree visitCompilationUnit(CompilationUnitTree node, P p) {
 401         JCCompilationUnit t = (JCCompilationUnit) node;
 402         List<JCTree> defs = copy(t.defs, p);
 403         return M.at(t.pos).TopLevel(defs);
 404     }


 553     @Override @DefinedBy(Api.COMPILER_TREE)
 554     public JCRequires visitRequires(RequiresTree node, P p) {
 555         JCRequires t = (JCRequires) node;
 556         JCExpression moduleName = copy(t.moduleName, p);
 557         return M.at(t.pos).Requires(t.isTransitive, t.isStaticPhase, moduleName);
 558     }
 559 
 560     @Override @DefinedBy(Api.COMPILER_TREE)
 561     public JCUses visitUses(UsesTree node, P p) {
 562         JCUses t = (JCUses) node;
 563         JCExpression serviceName = copy(t.qualid, p);
 564         return M.at(t.pos).Uses(serviceName);
 565     }
 566 
 567     @DefinedBy(Api.COMPILER_TREE)
 568     public JCTree visitOther(Tree node, P p) {
 569         JCTree tree = (JCTree) node;
 570         switch (tree.getTag()) {
 571             case LETEXPR: {
 572                 LetExpr t = (LetExpr) node;
 573                 List<JCStatement> defs = copy(t.defs, p);
 574                 JCExpression expr = copy(t.expr, p);
 575                 return M.at(t.pos).LetExpr(defs, expr);
 576             }
 577             default:
 578                 throw new AssertionError("unknown tree tag: " + tree.getTag());
 579         }
 580     }
 581 
 582 }
< prev index next >