示例#1
0
文件: Graph.cs 项目: DragonXYZ/cilpe
        public static Block FindCommonParent(Block a, Block b)
        {
            Block result = a;

            while (! (result == null || result == b || b.IsChildTo(result)))
                result = result.Parent;

            return result;
        }
示例#2
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 public bool IsChildTo(Block block)
 {
     return (Parent == block) || (Parent != null ? Parent.IsChildTo(block) : false);
 }
示例#3
0
文件: Graph.cs 项目: DragonXYZ/cilpe
        protected Node(int nextCount)
        {
            parent = null;
            options = new OptionsHash();

            prevArray = new NodeArray();
            prevIndexes = new ArrayList();
            nextArray = new NextNodeArray(this,nextCount);
        }
示例#4
0
文件: Graph.cs 项目: DragonXYZ/cilpe
        protected internal virtual void setParent(Block parent)
        {
            if (this.parent != null)
                this.parent.removeChild(this);

            this.parent = parent;

            if (parent != null)
                parent.addChild(this);
        }
示例#5
0
文件: Graph.cs 项目: DragonXYZ/cilpe
        protected internal override void setParent(Block parent)
        {
            if (parent == null)
                ResetNextArray(0);
            else if (! (parent is MethodBodyBlock) && ! (parent is FinallyBlock) &&
                ! (parent is FilterBlock))
                ResetNextArray(1);

            base.setParent(parent);
        }
示例#6
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 protected internal override void setParent(Block parent)
 {
     base.setParent(parent);
     setVarByIndex();
 }
示例#7
0
文件: Spec.cs 项目: DragonXYZ/cilpe
 public DummyNode(Block parent)
     : base()
 {
     this.setParent(parent);
 }
示例#8
0
        protected void SiftBlocks(Block node, object data)
        {
            BasicBlock basicBlock = data as BasicBlock;
            basicBlock.AddNode(node);

            if (node is ProtectedBlock)
            {
                foreach (EHBlock block in (node as ProtectedBlock))
                {
                    if (block.Options.ContainsOption(BasicBlock.BASIC_BLOCK_OPTION))
                        basicBlock.AddLink(block.Options[BasicBlock.BASIC_BLOCK_OPTION] as BasicBlock);
                    else
                    {
                        BasicBlock newBlock = createBasicBlock();
                        basicBlock.AddLink(newBlock);
                        AddTask(block,newBlock);
                    }
                }
            }
            else if (node is UserFilteredBlock)
            {
                FilterBlock block = (node as UserFilteredBlock).Filter;

                if (block.Options.ContainsOption(BasicBlock.BASIC_BLOCK_OPTION))
                    basicBlock.AddLink(block.Options[BasicBlock.BASIC_BLOCK_OPTION] as BasicBlock);
                else
                {
                    BasicBlock newBlock = createBasicBlock();
                    basicBlock.AddLink(newBlock);
                    AddTask(block,newBlock);
                }
            }

            if (node.Next.Options.ContainsOption(BasicBlock.BASIC_BLOCK_OPTION))
                basicBlock.AddNextBasicBlock(node.Next.Options[BasicBlock.BASIC_BLOCK_OPTION] as BasicBlock);
            else
            {
                BasicBlock nextBlock = createBasicBlock();
                basicBlock.AddNextBasicBlock(nextBlock);
                AddTask(node.Next,nextBlock);
            }
        }
示例#9
0
 protected internal override void VisitProtectedBlock(ProtectedBlock node, object data)
 {
     generator.BeginExceptionBlock();
     currentBlock = node;
     tasks.Suspend();
     AddTask(node.Next,null);
 }
示例#10
0
 protected internal override void VisitMethodBodyBlock(MethodBodyBlock node, object data)
 {
     currentBlock = node;
     AddTask(node.Next,null);
 }
示例#11
0
 protected internal override void VisitFinallyBlock(FinallyBlock node, object data)
 {
     generator.BeginFinallyBlock();
     currentBlock = node;
     tasks.Suspend();
     AddTask(node.Next,null);
 }
示例#12
0
 protected internal override void VisitCatchBlock(CatchBlock node, object data)
 {
     generator.BeginCatchBlock(node.Type);
     currentBlock = node;
     tasks.Suspend();
     AddTask(node.Next,null);
 }
示例#13
0
 internal void OnResume()
 {
     if(currentBlock is ProtectedBlock)
     {
         ProtectedBlock node = currentBlock as ProtectedBlock;
         for(int i = node.Count - 1; i>=0; i--)
             AddTask(node[i],null);
     }
     else if(currentBlock is EHBlock)
     {
         EHBlock block = currentBlock as EHBlock;
         if(block.TryBlock[block.TryBlock.Count - 1] == block)
         { // The last handler
             generator.EndExceptionBlock();
     tasks.TryResume();
         }
     }
     else
         throw new EmissionException();
     currentBlock = currentBlock.Parent;
 }