void CheckUnusedLocals(Method node) { foreach (Local local in node.Locals) { InternalLocal entity = (InternalLocal)local.Entity; if (!entity.IsPrivateScope && !entity.IsUsed) { Warnings.Add(CompilerWarningFactory.UnusedLocalVariable(local, local.Name)); } } }
void CheckUnusedLocals(Method node) { foreach (Local local in node.Locals) { // _ is a commonly accepted dummy variable for unused items if (local.Name == "_") { continue; } InternalLocal entity = (InternalLocal)local.Entity; if (!entity.IsPrivateScope && !entity.IsUsed) { Warnings.Add(CompilerWarningFactory.UnusedLocalVariable(local, local.Name)); } } }