示例#1
0
		ConstructorDeclaration CreateConstructor(MethodDefinition methodDef)
		{
			// Create mapping - used in debugger
			MemberMapping methodMapping = methodDef.CreateCodeMapping(this.CodeMappings);
			
			ConstructorDeclaration astMethod = new ConstructorDeclaration();
			astMethod.AddAnnotation(methodDef);
			astMethod.Modifiers = ConvertModifiers(methodDef);
			if (methodDef.IsStatic) {
				// don't show visibility for static ctors
				astMethod.Modifiers &= ~Modifiers.VisibilityMask;
			}
			astMethod.Name = CleanName(methodDef.DeclaringType.Name);
			astMethod.Parameters.AddRange(MakeParameters(methodDef));
			astMethod.Body = CreateMethodBody(methodDef, astMethod.Parameters);
			ConvertAttributes(astMethod, methodDef);
			astMethod.WithAnnotation(methodMapping);
			return astMethod;
		}