/// <summary> /// Returns zero or more local variable definitions that are local to the given scope. /// </summary> public IEnumerable <ILocalDefinition> GetVariablesInScope(ILocalScope scope) { PdbLocalScope /*?*/ pdbLocalScope = scope as PdbLocalScope; if (pdbLocalScope == null) { yield break; } uint index = 0; foreach (ILocalDefinition localDefinition in pdbLocalScope.methodBody.LocalVariables) { if (localDefinition.IsConstant) { continue; } foreach (PdbSlot slot in pdbLocalScope.pdbScope.slots) { if ((slot.flags & 1) != 0) { continue; } if (slot.slot == index) { yield return(localDefinition); break; } } index++; } }
/// <summary> /// Returns zero or more local constant definitions that are local to the given scope. /// </summary> public IEnumerable <ILocalDefinition> GetConstantsInScope(ILocalScope scope) { PdbLocalScope /*?*/ pdbLocalScope = scope as PdbLocalScope; if (pdbLocalScope == null) { yield break; } foreach (PdbConstant constant in pdbLocalScope.pdbScope.constants) { yield return(new PdbLocalConstant(constant, this.host, pdbLocalScope.methodBody.MethodDefinition)); } }