// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) deadcode 
// Source File Name:   JavadocEnter.java

package com.sun.tools.javadoc;

import com.sun.tools.javac.v8.code.Symbol;
import com.sun.tools.javac.v8.comp.Enter;
import com.sun.tools.javac.v8.comp.Env;
import com.sun.tools.javac.v8.tree.Tree;
import com.sun.tools.javac.v8.util.*;

// Referenced classes of package com.sun.tools.javadoc:
//            DocEnv, Messager

public class JavadocEnter extends Enter
{
    class JavadocMemberEnter extends com.sun.tools.javac.v8.comp.Enter.MemberEnter
    {

        public void visitMethodDef(com.sun.tools.javac.v8.tree.Tree.MethodDef methoddef)
        {
            visitMethodDef(methoddef);
            if(methoddef.sym == null || methoddef.sym.kind != 16)
                return;
            String s = (String)env.toplevel.docComments.get(methoddef);
            ListBuffer listbuffer = new ListBuffer();
            for(List list = methoddef.params; list.nonEmpty(); list = list.tail)
                listbuffer.append(((com.sun.tools.javac.v8.tree.Tree.VarDef)list.head).name);

            if(methoddef.sym.isConstructor())
                docenv.makeConstructorDoc(methoddef.sym, s, listbuffer.toList(), methoddef);
            else
                docenv.makeMethodDoc(methoddef.sym, s, listbuffer.toList(), methoddef);
        }

        public void visitVarDef(com.sun.tools.javac.v8.tree.Tree.VarDef vardef)
        {
            visitVarDef(vardef);
            if(vardef.sym == null || vardef.sym.kind != 4)
            {
                return;
            } else
            {
                String s = (String)env.toplevel.docComments.get(vardef);
                docenv.makeFieldDoc(vardef.sym, s, vardef);
                return;
            }
        }

        JavadocMemberEnter()
        {
            MemberEnter(JavadocEnter.this);
        }
    }


    protected void duplicateClass(int i, com.sun.tools.javac.v8.code.Symbol.ClassSymbol classsymbol)
    {
    }

    public void visitClassDef(com.sun.tools.javac.v8.tree.Tree.ClassDef classdef)
    {
        visitClassDef(classdef);
        if(classdef.sym != null && classdef.sym.kind == 2)
        {
            if(classdef.sym == null)
                return;
            String s = (String)env.toplevel.docComments.get(classdef);
            com.sun.tools.javac.v8.code.Symbol.ClassSymbol classsymbol = classdef.sym;
            docenv.makeClassDoc(classsymbol, s, classdef);
        }
    }

    private JavadocEnter(Context context)
    {
        Enter(context);
        context.put(javadocEnterKey, this);
        messager = Messager.instance0(context);
        super.phase2 = new JavadocMemberEnter();
        docenv = DocEnv.instance(context);
    }

    public void main(List list)
    {
        int i = messager.nerrors;
        main(list);
        messager.nwarnings += messager.nerrors - i;
        messager.nerrors = i;
    }

    public static JavadocEnter instance0(Context context)
    {
        JavadocEnter javadocenter = (JavadocEnter)context.get(javadocEnterKey);
        if(javadocenter == null)
            javadocenter = new JavadocEnter(context);
        return javadocenter;
    }

    private static final com.sun.tools.javac.v8.util.Context.Key javadocEnterKey = new Key();
    private final Messager messager;
    private final DocEnv docenv;


}
