private static bool MacroDefinitionContainsMacroApplication(TypeDefinition definition, MacroStatement statement) { return statement.GetAncestors<TypeDefinition>().Any(ancestor => ancestor == definition); }
IEntity ResolveMacroExtensionType(MacroStatement node, IMethod extension) { if (null == extension) return null; IType extendedMacroType = GetExtendedMacroType(extension); if (null == extendedMacroType) return null; //ok now check if extension is correctly nested under parent foreach (MacroStatement parent in node.GetAncestors<MacroStatement>()) if (ResolveMacroName(parent) == extendedMacroType) return GetExtensionMacroType(extension); return null; }
private bool MacroDefinitionContainsMacroApplication(TypeDefinition definition, MacroStatement statement) { foreach (TypeDefinition ancestor in statement.GetAncestors<TypeDefinition>()) if (ancestor == definition) return true; return false; }