当前位置: 首页>>代码示例>>C#>>正文


C# Ast.ConstructorDeclaration类代码示例

本文整理汇总了C#中ICSharpCode.NRefactory.Ast.ConstructorDeclaration的典型用法代码示例。如果您正苦于以下问题:C# ConstructorDeclaration类的具体用法?C# ConstructorDeclaration怎么用?C# ConstructorDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConstructorDeclaration类属于ICSharpCode.NRefactory.Ast命名空间,在下文中一共展示了ConstructorDeclaration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: add_Ctor_

 public static CompilationUnit add_Ctor_(this CompilationUnit compilationUnit, string @namespace, string typeName, ConstructorDeclaration constructorDeclaration)
 {
     var myNamespace = compilationUnit.add_Namespace(@namespace);
     var type = myNamespace.add_Type(typeName);
     type.add_Ctor(constructorDeclaration);
     return compilationUnit;
 }
开发者ID:pusp,项目名称:o2platform,代码行数:7,代码来源:ConstructorDeclaration_ExtensionMethods.cs

示例2: TrackedVisitConstructorDeclaration

        public override object TrackedVisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
        {
            const string initializerBlock = "InitializerBlock";
            if (constructorDeclaration.Name == initializerBlock)
            {
                TypeDeclaration type = (TypeDeclaration) constructorDeclaration.Parent;
                string initName = "Init" + type.Name;
                MethodDeclaration initMethod = GetInitMethod(type);
                initMethod.Body.Children.AddRange(constructorDeclaration.Body.Children);
                Expression initInvocation = new InvocationExpression(new IdentifierExpression(initName));
                ExpressionStatement initInvocationStatement = new ExpressionStatement(initInvocation);

                IList constructors = AstUtil.GetChildrenWithType(type, typeof(ConstructorDeclaration));
                if (constructors.Count > 1)
                {
                    foreach (ConstructorDeclaration constructor in constructors)
                    {
                        if (constructor.Name != initializerBlock && !HasInitInvocation(constructor))
                            constructor.Body.Children.Insert(0, initInvocationStatement);
                    }
                }
                else if (((ConstructorDeclaration) constructors[0]).Name == initializerBlock)
                {
                    ConstructorDeclaration constructor = new ConstructorDeclaration(type.Name, Modifiers.Public, null, null);
                    constructor.Body = new BlockStatement();
                    constructor.Body.AddChild(initInvocationStatement);
                    type.AddChild(constructor);
                }
                RemoveCurrentNode();
            }
            return base.TrackedVisitConstructorDeclaration(constructorDeclaration, data);
        }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:32,代码来源:InitializerBlockTransformer.cs

示例3: VisitConstructorDeclaration

 public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
 {
     if (this.CheckNode(constructorDeclaration)) {
         return null;
     }
     return base.VisitConstructorDeclaration(constructorDeclaration, data);
 }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:7,代码来源:MemberFindAstVisitor.cs

示例4: TrackedVisitConstructorDeclaration

 public override object TrackedVisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
 {
     if (ShouldStubMember(constructorDeclaration.Name))
         return base.TrackedVisitConstructorDeclaration(constructorDeclaration, data);
     else
         return null;
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:7,代码来源:StubTransformer.cs

示例5: VisitConstructorDeclaration

            public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
            {
                if (constructorDeclaration.ConstructorInitializer.ConstructorInitializerType == ConstructorInitializerType.Base)
                    UnlockWith(constructorDeclaration);

                return base.VisitConstructorDeclaration(constructorDeclaration, data);
            }
开发者ID:timdams,项目名称:strokes,代码行数:7,代码来源:CreateBaseConstructorInitAchievement.cs

示例6: VisitConstructorDeclaration

		public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
		{
			Push();
			object result = base.VisitConstructorDeclaration(constructorDeclaration, data);
			Pop();
			return result;
		}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:7,代码来源:PrefixFieldsVisitor.cs

示例7: VisitConstructorDeclaration

 public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
 {
     collectingUsedLabels = true;
     base.VisitConstructorDeclaration(constructorDeclaration, data);
     collectingUsedLabels = false;
     base.VisitConstructorDeclaration(constructorDeclaration, data);
     return null;
 }
开发者ID:almazik,项目名称:ILSpy,代码行数:8,代码来源:RemoveDeadLabels.cs

示例8: VisitConstructorDeclaration

 public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
 {
     if (currentDependencyRelation != null)
     {
         currentDependencyRelation.RecordConstructor(constructorDeclaration);
     }
     return base.VisitConstructorDeclaration(constructorDeclaration, data);
 }
开发者ID:modulexcite,项目名称:magic-1,代码行数:8,代码来源:DependencyFinder.cs

示例9: TransformQueryToClass

		private void TransformQueryToClass()
		{
			
			CSharpSafeName = "Index_"+ Regex.Replace(Name, @"[^\w\d]", "_");
			var type = new TypeDeclaration(Modifiers.Public, new List<AttributeSection>())
			{
				BaseTypes =
					{
						new TypeReference("AbstractViewGenerator")
					},
				Name = CSharpSafeName,
				Type = ClassType.Class
			};

			var ctor = new ConstructorDeclaration(CSharpSafeName,
			                                      Modifiers.Public,
			                                      new List<ParameterDeclarationExpression>(), null);
			type.Children.Add(ctor);
			ctor.Body = new BlockStatement();
		
			// this.ViewText = "96E65595-1C9E-4BFB-A0E5-80BF2D6FC185"; // Will be replaced later
			ctor.Body.AddChild(new ExpressionStatement(
			                   	new AssignmentExpression(
			                   		new MemberReferenceExpression(new ThisReferenceExpression(), "ViewText"),
			                   		AssignmentOperatorType.Assign,
			                   		new PrimitiveExpression(mapReduceTextToken, mapReduceTextToken))));

			foreach (var map in indexDefinition.Maps)
			{
				HandleMapFunction(ctor, map);
			}

			HandleTransformResults(ctor);

			HandleReduceDefintion(ctor);

		    AddAdditionalInformation(ctor);

			CompiledQueryText = QueryParsingUtils.GenerateText(type, extensions);
			var sb = new StringBuilder("@\"");
			foreach (var map in indexDefinition.Maps)
			{
				sb.AppendLine(map.Replace("\"", "\"\""));
			}
			if (indexDefinition.Reduce != null)
			{
				sb.AppendLine(indexDefinition.Reduce.Replace("\"", "\"\"")).AppendLine();
			}

			if (indexDefinition.TransformResults != null)
			{
				sb.AppendLine(indexDefinition.TransformResults.Replace("\"", "\"\"")).AppendLine();
			}

			sb.Append("\"");
			CompiledQueryText = CompiledQueryText.Replace("\"" + mapReduceTextToken + "\"",
			                                              sb.ToString());
		}
开发者ID:neiz,项目名称:ravendb,代码行数:58,代码来源:DynamicViewCompiler.cs

示例10: VisitConstructorDeclaration

		public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
		{
			if ((constructorDeclaration.Body.StartLocation < new Location(startColumn + 1, startLine + 1)) &&
			    (constructorDeclaration.Body.EndLocation > new Location(endColumn + 1, endLine + 1))) {
				this.member = constructorDeclaration;
			}
			
			return base.VisitConstructorDeclaration(constructorDeclaration, data);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:9,代码来源:FindMemberVisitor.cs

示例11: VisitConstructorDeclaration

		public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
		{
			if ((constructorDeclaration.Body.StartLocation < start) &&
			    (constructorDeclaration.Body.EndLocation > end)) {
				this.member = constructorDeclaration;
			}
			
			return base.VisitConstructorDeclaration(constructorDeclaration, data);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:9,代码来源:FindMemberVisitor.cs

示例12: GetConstructor

 private ConstructorDeclaration GetConstructor(ExpressionStatement expression, TypeDeclaration typeDeclaration)
 {
     ConstructorDeclaration constructorDeclaration;
     constructorDeclaration = new ConstructorDeclaration(typeDeclaration.Name, Modifiers.Public, null, null);
     constructorDeclaration.Body = new BlockStatement();
     constructorDeclaration.Body.Children.Add(expression);
     typeDeclaration.Children.Add(constructorDeclaration);
     return constructorDeclaration;
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:9,代码来源:FieldInitializerTransformer.cs

示例13: TrackedVisitConstructorDeclaration

 public override object TrackedVisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
 {
     TypeDeclaration typeDeclaration = (TypeDeclaration) constructorDeclaration.Parent;
     if (IsDerivedFrom(typeDeclaration, "junit.framework.TestCase"))
     {
         if (constructorDeclaration.Parameters.Count > 0)
             RemoveCurrentNode();
     }
     return null;
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:10,代码来源:TestCaseTransformer.cs

示例14: VisitTypeDeclaration

		public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
		{
			base.VisitTypeDeclaration(typeDeclaration, data); // visit methods
			typeDeclaration.Attributes.Clear();
			typeDeclaration.BaseTypes.Clear();
			
			// add constructor accepting the wrapped object and the field holding the object
			FieldDeclaration fd = new FieldDeclaration(null, // no attributes
			                                           new TypeReference(typeDeclaration.Name),
			                                           Modifiers.Private);
			fd.Fields.Add(new VariableDeclaration("wrappedObject"));
			typeDeclaration.AddChild(fd);
			
			typeDeclaration.Name += "Wrapper";
			if (typeDeclaration.Type == ClassType.Interface) {
				typeDeclaration.Type = ClassType.Class;
				typeDeclaration.Name = typeDeclaration.Name.Substring(1);
			}
			ConstructorDeclaration cd = new ConstructorDeclaration(typeDeclaration.Name,
			                                                       Modifiers.Public,
			                                                       new List<ParameterDeclarationExpression>(),
			                                                       null);
			cd.Parameters.Add(new ParameterDeclarationExpression(fd.TypeReference,
			                                                     "wrappedObject"));
			// this.wrappedObject = wrappedObject;
			Expression fieldReference = new MemberReferenceExpression(new ThisReferenceExpression(),
			                                                         "wrappedObject");
			Expression assignment = new AssignmentExpression(fieldReference,
			                                                 AssignmentOperatorType.Assign,
			                                                 new IdentifierExpression("wrappedObject"));
			cd.Body = new BlockStatement();
			cd.Body.AddChild(new ExpressionStatement(assignment));
			typeDeclaration.AddChild(cd);
			
			for (int i = 0; i < typeDeclaration.Children.Count; i++) {
				object child = typeDeclaration.Children[i];
				if (child is MethodDeclaration) {
					MethodDeclaration method = (MethodDeclaration)child;
					if (method.Parameters.Count == 0 &&
					    (method.Name.StartsWith("Is") || method.Name.StartsWith("Get")))
					{
						// replace the method with a property
						PropertyDeclaration prop = new PropertyDeclaration(method.Modifier,
						                                                   method.Attributes,
						                                                   method.Name,
						                                                   null);
						prop.TypeReference = method.TypeReference;
						prop.GetRegion = new PropertyGetRegion(method.Body, null);
						typeDeclaration.Children[i] = prop;
					}
				}
			}
			
			return null;
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:55,代码来源:WrapperGeneratorVisitor.cs

示例15: add_Ctor

        public static ConstructorDeclaration add_Ctor(this TypeDeclaration typeDeclaration)
        {
            var name = "";
            var modifier = Modifiers.Public;
            var _parameters = new List<ParameterDeclarationExpression>();
            var _attributes = new List<AttributeSection>();

            var ctorDeclaration = new ConstructorDeclaration(name, modifier, _parameters, _attributes);
            ctorDeclaration.Body = new BlockStatement();
            typeDeclaration.add_Ctor(ctorDeclaration);
            return ctorDeclaration;
        }
开发者ID:njmube,项目名称:FluentSharp,代码行数:12,代码来源:ConstructorDeclaration_ExtensionMethods.cs


注:本文中的ICSharpCode.NRefactory.Ast.ConstructorDeclaration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。