private static void add_not_comp_members(definition_node dn, PCUWriter pw)
 {
     if (not_comp_members.ContainsKey(dn))
     {
         not_comp_members[dn].Add(pw);
     }
     else
     {
         List<PCUWriter> l=new List<PCUWriter>();
         l.Add(pw);
         not_comp_members.Add(dn, l);
     }
 }
		public void SavePCU(CompilationUnit Unit,string TagertFileName)
		{
//#if DEBUG
            try
            {
                if (Unit.SyntaxTree != null && Unit.SyntaxTree is SyntaxTree.unit_module)
                {
                    if (((SyntaxTree.unit_module)Unit.SyntaxTree).unit_name.HeaderKeyword == PascalABCCompiler.SyntaxTree.UnitHeaderKeyword.Library)
                        return;
                    foreach (SyntaxTree.compiler_directive cd in Unit.SyntaxTree.compiler_directives)
                        if (cd.Name.text.ToLower() == TreeConverter.compiler_string_consts.compiler_savepcu)
                            if (!Convert.ToBoolean(cd.Directive.text))
                                return;
                }
            }
            catch
            {
            }
//#endif
            PCUWriter writer=null;
            try
            {
#if DEBUG
                if (InternalDebug.PCUGenerate)
#endif
                if (compilerOptions.SavePCU)
                if ((Unit.SemanticTree as TreeRealization.common_unit_node).namespaces.Count > 1 && 
                    Unit.SyntaxTree!=null && 
                    Unit.State == UnitState.Compiled)
                {
                    writer = new PCUWriter(this, pr_ChangeState);
                    if (FileInSearchDirectory(TagertFileName))
                        TagertFileName = Path.ChangeExtension(TagertFileName, CompilerOptions.CompiledUnitExtension);
                    else
                    {
                        if(CompilerOptions.useOutputDirectory)
                            TagertFileName = Path.Combine(CompilerOptions.OutputDirectory, Path.GetFileName(Path.ChangeExtension(TagertFileName, CompilerOptions.CompiledUnitExtension)));
                        else
                            TagertFileName = Path.Combine(Path.GetDirectoryName(Unit.SyntaxTree.file_name), Path.GetFileName(Path.ChangeExtension(TagertFileName, CompilerOptions.CompiledUnitExtension)));
                    }
                    bool dbginfo = true;/*CompilerOptions.Debug*/
#if DEBUG
                    dbginfo = InternalDebug.IncludeDebugInfoInPCU;
#endif
                    writer.SaveSemanticTree(Unit, TagertFileName, dbginfo);
                    
                }
            }
            catch (Exception err)
            {
                //ErrorsList.Add(new Errors.CompilerInternalError(string.Format("Compiler.Compile[{0}]", Path.GetFileName(this.CurrentCompilationUnit.SyntaxTree.file_name)), err));
                OnChangeCompilerState(this, CompilerState.PCUWritingError, TagertFileName);
#if DEBUG
                if (!InternalDebug.SkipPCUErrors)
                    throw new Errors.CompilerInternalError(string.Format("Compiler.Compile[{0}]", Path.GetFileName(this.CurrentCompilationUnit.SyntaxTree.file_name)), err);
                writer.RemoveSelf();
#endif
            }
        }