diff --git a/blocks/CodeGenerator.cs b/blocks/CodeGenerator.cs index aec95b14..cd4ff32c 100644 --- a/blocks/CodeGenerator.cs +++ b/blocks/CodeGenerator.cs @@ -298,7 +298,7 @@ namespace de4dot.blocks { ScopeBlock getScopeBlock(BaseBlock bb) { BlockState current = stateStack.Peek(); - if (current.scopeBlock.isOurBlockBase(bb)) + if (current.scopeBlock.isOurBaseBlock(bb)) return current.scopeBlock; return (ScopeBlock)current.scopeBlock.toChild(bb); } diff --git a/blocks/ForwardScanOrder.cs b/blocks/ForwardScanOrder.cs index c8d3b498..f3915324 100644 --- a/blocks/ForwardScanOrder.cs +++ b/blocks/ForwardScanOrder.cs @@ -96,14 +96,14 @@ namespace de4dot.blocks { bool isOneSourceInAnotherScopeBlock(Block block) { foreach (var source in block.Sources) { - if (!scopeBlock.isOurBlockBase(source)) + if (!scopeBlock.isOurBaseBlock(source)) return true; } return false; } void scanBaseBlock(BaseBlock bb, int stackStart) { - if (blockInfos.ContainsKey(bb) || !scopeBlock.isOurBlockBase(bb)) + if (blockInfos.ContainsKey(bb) || !scopeBlock.isOurBaseBlock(bb)) return; var blockInfo = new BlockInfo(bb, stackStart); @@ -134,7 +134,7 @@ namespace de4dot.blocks { } void addToNewList(BaseBlock bb) { - if (inNewList.ContainsKey(bb) || !scopeBlock.isOurBlockBase(bb)) + if (inNewList.ContainsKey(bb) || !scopeBlock.isOurBaseBlock(bb)) return; inNewList[bb] = true; @@ -145,7 +145,7 @@ namespace de4dot.blocks { } else { foreach (var source in block.Sources) { - if (scopeBlock.isOurBlockBase(source)) { + if (scopeBlock.isOurBaseBlock(source)) { addToNewList(source); // Make sure it's before this block break; } diff --git a/blocks/ScopeBlock.cs b/blocks/ScopeBlock.cs index 2b0bb124..bb227e00 100644 --- a/blocks/ScopeBlock.cs +++ b/blocks/ScopeBlock.cs @@ -118,7 +118,7 @@ namespace de4dot.blocks { continue; // Not dead if (block == baseBlocks[0]) continue; // It's the start of this block fence so must be present - if (!isOurBlockBase(block)) + if (!isOurBaseBlock(block)) continue; // Some other ScopeBlock owns it, eg. first instr of an exception handler // It's a dead block we can delete! @@ -133,7 +133,7 @@ namespace de4dot.blocks { } } - public bool isOurBlockBase(BaseBlock bb) { + public bool isOurBaseBlock(BaseBlock bb) { return bb != null && bb.Parent == this; } @@ -145,7 +145,7 @@ namespace de4dot.blocks { for (int i = 0; i < blocks.Count; i++) { var block = blocks[i]; var target = block.getOnlyTarget(); - if (!isOurBlockBase(target)) + if (!isOurBaseBlock(target)) continue; // Only merge blocks we own! if (!block.canMerge(target)) continue; // Can't merge them! @@ -171,14 +171,14 @@ namespace de4dot.blocks { // If bb is in baseBlocks (a direct child), return bb. If bb is a BaseBlock in a // ScopeBlock that is a direct child, then return that ScopeBlock. Else return null. public BaseBlock toChild(BaseBlock bb) { - if (isOurBlockBase(bb)) + if (isOurBaseBlock(bb)) return bb; for (bb = bb.Parent; bb != null; bb = bb.Parent) { var sb = bb as ScopeBlock; if (sb == null) throw new ApplicationException("Parent is not a ScopeBlock"); - if (isOurBlockBase(sb)) + if (isOurBaseBlock(sb)) return sb; }