示例#1
0
 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));
         }
     }
 }
示例#2
0
        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));
                }
            }
        }