官术网_书友最值得收藏!

  • Roslyn Cookbook
  • Manish Vasani
  • 123字
  • 2021-07-15 17:07:33

Creating a method body analyzer to analyze whole method and report issues

A stateful method body or code block analyzer registers action callbacks that require whole method body analysis to report issues about the method declaration or executable code. These analyzers generally need to initialize some mutable state at the start of the analysis, which is updated while analyzing the method body, and the final state is used to report diagnostics.

In this section, we will create a code block analyzer that flags unused method parameters. For example, it will not flag param1 and param2 as unused, but will flag param3 and param4.

void M(int param1, ref int param2, int param3, params int[] param4)
{
int local1 = param1;
param2 = 0;
}
主站蜘蛛池模板: 宜州市| 井冈山市| 尚义县| 青岛市| 玉龙| 祥云县| 黄山市| 托里县| 九寨沟县| 宁德市| 汾阳市| 岗巴县| 五大连池市| 扎赉特旗| 马尔康县| 泾源县| 辽中县| 林州市| 龙门县| 田东县| 惠水县| 疏勒县| 沙湾县| 屯门区| 寿阳县| 泊头市| 武乡县| 延吉市| 湖南省| 平舆县| 黑山县| 青海省| 兴和县| 邵阳县| 阳城县| 凌云县| 瑞安市| 两当县| 济阳县| 新和县| 华安县|