Coverage Report - com.sun.tools.javafx.comp.BlockExprGen
 
Classes in this File Line Coverage Branch Coverage Complexity
BlockExprGen
79%
19/24
50%
5/10
0
BlockExprGen$1
100%
2/2
N/A
0
 
 1  
 /*
 2  
  * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
 3  
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  
  *
 5  
  * This code is free software; you can redistribute it and/or modify it
 6  
  * under the terms of the GNU General Public License version 2 only, as
 7  
  * published by the Free Software Foundation.  Sun designates this
 8  
  * particular file as subject to the "Classpath" exception as provided
 9  
  * by Sun in the LICENSE file that accompanied this code.
 10  
  *
 11  
  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  
  * version 2 for more details (a copy is included in the LICENSE file that
 15  
  * accompanied this code).
 16  
  *
 17  
  * You should have received a copy of the GNU General Public License version
 18  
  * 2 along with this work; if not, write to the Free Software Foundation,
 19  
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  
  *
 21  
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 22  
  * CA 95054 USA or visit www.sun.com if you need additional information or
 23  
  * have any questions.
 24  
  */
 25  
 
 26  
 package com.sun.tools.javafx.comp;
 27  
 
 28  
 import com.sun.tools.javafx.tree.*;
 29  
 import com.sun.tools.javac.jvm.*;
 30  
 import com.sun.tools.javac.comp.*;
 31  
 import com.sun.tools.javac.util.*;
 32  
 import com.sun.tools.javac.tree.*;
 33  
 
 34  
 /**
 35  
  *
 36  
  * @author bothner
 37  
  */
 38  
 public class BlockExprGen extends Gen {
 39  
 
 40  
     public static void preRegister(final Context context) {
 41  399
         context.put(genKey, new Context.Factory<Gen>() {
 42  
             public Gen make() {
 43  399
                 return new BlockExprGen(context);
 44  
             }
 45  
         });
 46  399
     }
 47  
 
 48  
     public BlockExprGen(Context context) {
 49  399
         super(context);
 50  399
     }
 51  
     
 52  
     public static BlockExprGen instance(Context context) {
 53  0
         BlockExprGen instance = (BlockExprGen) context.get(genKey);
 54  0
         if (instance == null)
 55  0
             instance = new BlockExprGen(context);
 56  0
         return instance;
 57  
     }
 58  
   public void visitBlockExpression(JFXBlockExpression tree) {
 59  
       // super.visitBlock(tree, tree.stats, tree.value, tree.endpos);
 60  1165
       int limit = code.nextreg;
 61  1165
       Env<GenContext> localEnv = env.dup(tree, new GenContext());
 62  1165
       genStats(tree.stats, localEnv);
 63  1165
       if (tree.value != null) {
 64  1165
           tree.value.accept(this);
 65  1165
           if (result instanceof Items.LocalItem
 66  
                   /* && we're about to exit result's scope -- FIXME */) {
 67  586
               result = result.load();
 68  
           }
 69  
       }
 70  
       // End the scope of all block-local variables in variable info.
 71  1165
       if (env.tree.getTag() != JCTree.METHODDEF) {
 72  1165
           code.statBegin(tree.endpos);
 73  1165
           code.endScopes(limit);
 74  1165
           code.pendingStatPos = Position.NOPOS;
 75  
       }
 76  1165
   }
 77  
   
 78  
   @Override
 79  
   public void visitTree(JCTree tree) {
 80  1165
          if (tree instanceof JFXBlockExpression)
 81  1165
              visitBlockExpression((JFXBlockExpression) tree);
 82  
          else
 83  0
              super.visitTree(tree);
 84  1165
   }
 85  
 }