Coverage Report - com.sun.tools.javafx.comp.BlockExprMemberEnter
 
Classes in this File Line Coverage Branch Coverage Complexity
BlockExprMemberEnter
60%
12/20
25%
2/8
0
BlockExprMemberEnter$1
100%
2/2
N/A
0
 
 1  
 /*
 2  
  * Copyright 1999-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.javac.code.Type;
 29  
 import com.sun.tools.javac.comp.AttrContext;
 30  
 import com.sun.tools.javac.comp.Env;
 31  
 import com.sun.tools.javafx.tree.JFXBlockExpression;
 32  
 import com.sun.tools.javac.util.*;
 33  
 import com.sun.tools.javac.tree.JCTree.*;
 34  
 import com.sun.tools.javac.comp.MemberEnter;
 35  
 import com.sun.tools.javac.tree.JCTree;
 36  
 
 37  
 
 38  
 import static com.sun.tools.javac.tree.JCTree.*;
 39  
 
 40  
 /** This is the second phase of Enter, in which classes are completed
 41  
  *  by entering their members into the class scope using
 42  
  *  MemberEnter.complete().  See Enter for an overview.
 43  
  *
 44  
  *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
 45  
  *  you write code that depends on this, you do so at your own risk.
 46  
  *  This code and its internal interfaces are subject to change or
 47  
  *  deletion without notice.</b>
 48  
  */
 49  12
 public class BlockExprMemberEnter extends MemberEnter {
 50  399
     boolean resolvingImport = false;
 51  
     public static MemberEnter instance0(Context context) {
 52  0
         MemberEnter instance = context.get(memberEnterKey);
 53  0
         if (instance == null)
 54  0
             instance = new BlockExprMemberEnter(context);
 55  0
         return instance;
 56  
     }
 57  
 
 58  
     public static void preRegister(final Context context) {
 59  798
         context.put(memberEnterKey, new Context.Factory<MemberEnter>() {
 60  
                public MemberEnter make() {
 61  399
                    return new BlockExprMemberEnter(context);
 62  
                }
 63  
         });
 64  399
     }
 65  
 
 66  
     protected BlockExprMemberEnter(Context context) {
 67  399
         super(context);
 68  399
     }
 69  
 
 70  
     public void visitBlockExpression(JFXBlockExpression tree) {
 71  0
         for (JCStatement stmt : tree.stats) {
 72  0
             stmt.accept(this);
 73  
         }
 74  0
         tree.value.accept(this);
 75  0
     }
 76  
 
 77  
     public Type attribImportType(JCTree tree, Env<AttrContext> env) {
 78  330
         assert completionEnabled;
 79  
         try {
 80  
             // To prevent deep recursion, suppress completion of some
 81  
             // types.
 82  330
             completionEnabled = false;
 83  330
             resolvingImport = true;
 84  330
             return attr.attribType(tree, env);
 85  
         } finally {
 86  330
             completionEnabled = true;
 87  330
             resolvingImport = false;
 88  
         }
 89  
     }
 90  
 }