Rename method

This commit is contained in:
de4dot 2011-12-15 10:01:46 +01:00
parent c73459f1be
commit a3c9221410
3 changed files with 10 additions and 10 deletions

View File

@ -298,7 +298,7 @@ namespace de4dot.blocks {
ScopeBlock getScopeBlock(BaseBlock bb) { ScopeBlock getScopeBlock(BaseBlock bb) {
BlockState current = stateStack.Peek(); BlockState current = stateStack.Peek();
if (current.scopeBlock.isOurBlockBase(bb)) if (current.scopeBlock.isOurBaseBlock(bb))
return current.scopeBlock; return current.scopeBlock;
return (ScopeBlock)current.scopeBlock.toChild(bb); return (ScopeBlock)current.scopeBlock.toChild(bb);
} }

View File

@ -96,14 +96,14 @@ namespace de4dot.blocks {
bool isOneSourceInAnotherScopeBlock(Block block) { bool isOneSourceInAnotherScopeBlock(Block block) {
foreach (var source in block.Sources) { foreach (var source in block.Sources) {
if (!scopeBlock.isOurBlockBase(source)) if (!scopeBlock.isOurBaseBlock(source))
return true; return true;
} }
return false; return false;
} }
void scanBaseBlock(BaseBlock bb, int stackStart) { void scanBaseBlock(BaseBlock bb, int stackStart) {
if (blockInfos.ContainsKey(bb) || !scopeBlock.isOurBlockBase(bb)) if (blockInfos.ContainsKey(bb) || !scopeBlock.isOurBaseBlock(bb))
return; return;
var blockInfo = new BlockInfo(bb, stackStart); var blockInfo = new BlockInfo(bb, stackStart);
@ -134,7 +134,7 @@ namespace de4dot.blocks {
} }
void addToNewList(BaseBlock bb) { void addToNewList(BaseBlock bb) {
if (inNewList.ContainsKey(bb) || !scopeBlock.isOurBlockBase(bb)) if (inNewList.ContainsKey(bb) || !scopeBlock.isOurBaseBlock(bb))
return; return;
inNewList[bb] = true; inNewList[bb] = true;
@ -145,7 +145,7 @@ namespace de4dot.blocks {
} }
else { else {
foreach (var source in block.Sources) { foreach (var source in block.Sources) {
if (scopeBlock.isOurBlockBase(source)) { if (scopeBlock.isOurBaseBlock(source)) {
addToNewList(source); // Make sure it's before this block addToNewList(source); // Make sure it's before this block
break; break;
} }

View File

@ -118,7 +118,7 @@ namespace de4dot.blocks {
continue; // Not dead continue; // Not dead
if (block == baseBlocks[0]) if (block == baseBlocks[0])
continue; // It's the start of this block fence so must be present 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 continue; // Some other ScopeBlock owns it, eg. first instr of an exception handler
// It's a dead block we can delete! // 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; return bb != null && bb.Parent == this;
} }
@ -145,7 +145,7 @@ namespace de4dot.blocks {
for (int i = 0; i < blocks.Count; i++) { for (int i = 0; i < blocks.Count; i++) {
var block = blocks[i]; var block = blocks[i];
var target = block.getOnlyTarget(); var target = block.getOnlyTarget();
if (!isOurBlockBase(target)) if (!isOurBaseBlock(target))
continue; // Only merge blocks we own! continue; // Only merge blocks we own!
if (!block.canMerge(target)) if (!block.canMerge(target))
continue; // Can't merge them! 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 // 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. // ScopeBlock that is a direct child, then return that ScopeBlock. Else return null.
public BaseBlock toChild(BaseBlock bb) { public BaseBlock toChild(BaseBlock bb) {
if (isOurBlockBase(bb)) if (isOurBaseBlock(bb))
return bb; return bb;
for (bb = bb.Parent; bb != null; bb = bb.Parent) { for (bb = bb.Parent; bb != null; bb = bb.Parent) {
var sb = bb as ScopeBlock; var sb = bb as ScopeBlock;
if (sb == null) if (sb == null)
throw new ApplicationException("Parent is not a ScopeBlock"); throw new ApplicationException("Parent is not a ScopeBlock");
if (isOurBlockBase(sb)) if (isOurBaseBlock(sb))
return sb; return sb;
} }