public override void VisitAttributeMetaDeclaration(AttributeMetaDeclaration amd) { if (amd == null || amd.AttributeOrCondition == null || amd.AttributeOrCondition.Length == 0) { return; } if (caret > amd.Location && (!(amd is AttributeMetaDeclarationBlock) || amd.EndLocation > caret)) { foreach (var attr in amd.AttributeOrCondition) { if (attr is DeclarationCondition) { l.Add((DeclarationCondition)attr); } } } else if (amd.OptionalElseBlock != null && caret > amd.OptionalElseBlock.Location && amd.OptionalElseBlock.EndLocation > caret) { foreach (var attr in amd.AttributeOrCondition) { if (attr is DeclarationCondition) { l.Add(new NegatedDeclarationCondition((DeclarationCondition)attr)); } } } }
public static void EnumConditions(ConditionSet cs,IStatement stmt, IBlockNode block, ResolutionContext ctxt, CodeLocation caret) { var l = new MutableConditionFlagSet(); cs.LocalFlags = l; // If the current scope is a dedicated block.. (so NOT in a method but probably in an initializer or other static statement) if(block is DBlockNode) { // If so, get all (scoping) declaration conditions in the current block // and add them to the condition list var mblocks = ((DBlockNode)block).GetMetaBlockStack(caret, false, true); if(mblocks!=null && mblocks.Length!=0) foreach(var mb in mblocks) { var amd = mb as AttributeMetaDeclaration; if(amd!=null && amd.AttributeOrCondition!=null && amd.AttributeOrCondition.Length!=0) foreach(var attr in amd.AttributeOrCondition) if(attr is DeclarationCondition) l.Add((DeclarationCondition)attr); } } // Scan up the current statement when e.g. inside a method body while (stmt != null) { if (stmt is StatementCondition) l.Add(((StatementCondition)stmt).Condition); stmt = stmt.Parent; } // Go up the block hierarchy and add all conditions that belong to the respective nodes while (block != null) { var dn = block as DNode; if (dn!=null) { if(dn is DBlockNode) GetDoneVersionDebugSpecs(cs, l, dn as DBlockNode, ctxt); if(dn.Attributes!=null) foreach (var attr in dn.Attributes) if (attr is DeclarationCondition) l.Add(((DeclarationCondition)attr)); } block = block.Parent as IBlockNode; } }
public static void EnumConditions(ConditionSet cs, IStatement stmt, IBlockNode block, ResolutionContext ctxt, CodeLocation caret) { var l = new MutableConditionFlagSet(); cs.LocalFlags = l; // If the current scope is a dedicated block.. (so NOT in a method but probably in an initializer or other static statement) if (block is DBlockNode) { // If so, get all (scoping) declaration conditions in the current block // and add them to the condition list var mblocks = ((DBlockNode)block).GetMetaBlockStack(caret, false, true); foreach (var mb in mblocks) { var amd = mb as AttributeMetaDeclaration; if (amd != null && amd.AttributeOrCondition != null && amd.AttributeOrCondition.Length != 0) { foreach (var attr in amd.AttributeOrCondition) { if (attr is DeclarationCondition) { l.Add((DeclarationCondition)attr); } } } } } // Scan up the current statement when e.g. inside a method body while (stmt != null) { if (stmt is StatementCondition) { l.Add(((StatementCondition)stmt).Condition); } stmt = stmt.Parent; } // Go up the block hierarchy and add all conditions that belong to the respective nodes while (block != null) { var dn = block as DNode; if (dn != null) { if (dn is DBlockNode) { GetDoneVersionDebugSpecs(cs, l, dn as DBlockNode, ctxt); } if (dn.Attributes != null) { foreach (var attr in dn.Attributes) { if (attr is DeclarationCondition) { l.Add(((DeclarationCondition)attr)); } } } } block = block.Parent as IBlockNode; } }