< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java

Print this page

493 
494     public void visitVarDef(JCVariableDecl tree) {
495         tree.vartype = translate(tree.vartype, null);
496         tree.init = translate(tree.init, tree.sym.erasure(types));
497         tree.type = erasure(tree.type);
498         result = tree;
499     }
500 
501     public void visitDoLoop(JCDoWhileLoop tree) {
502         tree.body = translate(tree.body);
503         tree.cond = translate(tree.cond, syms.booleanType);
504         result = tree;
505     }
506 
507     public void visitWhileLoop(JCWhileLoop tree) {
508         tree.cond = translate(tree.cond, syms.booleanType);
509         tree.body = translate(tree.body);
510         result = tree;
511     }
512 







513     public void visitForLoop(JCForLoop tree) {
514         tree.init = translate(tree.init, null);
515         if (tree.cond != null)
516             tree.cond = translate(tree.cond, syms.booleanType);
517         tree.step = translate(tree.step, null);
518         tree.body = translate(tree.body);
519         result = tree;
520     }
521 
522     public void visitForeachLoop(JCEnhancedForLoop tree) {
523         tree.var = translate(tree.var, null);
524         Type iterableType = tree.expr.type;
525         tree.expr = translate(tree.expr, erasure(tree.expr.type));
526         if (types.elemtype(tree.expr.type) == null)
527             tree.expr.type = iterableType; // preserve type for Lower
528         tree.body = translate(tree.body);
529         result = tree;
530     }
531 
532     public void visitLambda(JCLambda tree) {

493 
494     public void visitVarDef(JCVariableDecl tree) {
495         tree.vartype = translate(tree.vartype, null);
496         tree.init = translate(tree.init, tree.sym.erasure(types));
497         tree.type = erasure(tree.type);
498         result = tree;
499     }
500 
501     public void visitDoLoop(JCDoWhileLoop tree) {
502         tree.body = translate(tree.body);
503         tree.cond = translate(tree.cond, syms.booleanType);
504         result = tree;
505     }
506 
507     public void visitWhileLoop(JCWhileLoop tree) {
508         tree.cond = translate(tree.cond, syms.booleanType);
509         tree.body = translate(tree.body);
510         result = tree;
511     }
512 
513     public void visitWithField(JCWithField tree) {
514         tree.field = translate(tree.field, null);
515         tree.value = translate(tree.value, erasure(tree.field.type));
516         tree.type = erasure(tree.type);
517         result = retype(tree, tree.type, pt);
518     }
519 
520     public void visitForLoop(JCForLoop tree) {
521         tree.init = translate(tree.init, null);
522         if (tree.cond != null)
523             tree.cond = translate(tree.cond, syms.booleanType);
524         tree.step = translate(tree.step, null);
525         tree.body = translate(tree.body);
526         result = tree;
527     }
528 
529     public void visitForeachLoop(JCEnhancedForLoop tree) {
530         tree.var = translate(tree.var, null);
531         Type iterableType = tree.expr.type;
532         tree.expr = translate(tree.expr, erasure(tree.expr.type));
533         if (types.elemtype(tree.expr.type) == null)
534             tree.expr.type = iterableType; // preserve type for Lower
535         tree.body = translate(tree.body);
536         result = tree;
537     }
538 
539     public void visitLambda(JCLambda tree) {
< prev index next >