Exemplo n.º 1
0
			public override void VisitConstructorDeclaration (ConstructorDeclaration constructorDeclaration)
			{
				base.VisitConstructorDeclaration (constructorDeclaration);

				if (constructorDeclaration.Body.IsNull)
					return;

				var hasInits = constructorDeclaration.GetParent<TypeDeclaration> ().Members.OfType<FieldDeclaration> ().Any (x => x.Variables.Any (y => !y.Initializer.IsNull));
				if (!hasInits)
					return;

				var supers = constructorDeclaration.Body.Descendants.OfType<InvocationExpression> ().Where (
					x => x.Target is BaseReferenceExpression).Select (x => x.GetParent<Statement> ()).ToList ();

				foreach (var s in supers) {
					s.Remove ();
				}

				if (supers.Count > 0) {
					constructorDeclaration.Body.Statements.InsertBefore (
						constructorDeclaration.Body.Statements.FirstOrNullObject (),
						supers [0]);
				}
			}