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


C# LocalVariableDeclaration.GetTypeForVariable方法代码示例

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


在下文中一共展示了LocalVariableDeclaration.GetTypeForVariable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VisitLocalVariableDeclaration

		public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
		{
			for (int i = 0; i < localVariableDeclaration.Variables.Count; ++i) {
				VariableDeclaration varDecl = (VariableDeclaration)localVariableDeclaration.Variables[i];
				
				AddVariable(localVariableDeclaration.GetTypeForVariable(i),
				            varDecl.Name,
				            localVariableDeclaration.StartLocation,
				            CurrentEndLocation,
				            (localVariableDeclaration.Modifier & Modifiers.Const) == Modifiers.Const,
				            false, varDecl.Initializer, null, false, localVariableDeclaration.SemicolonPosition);
			}
			return base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
		}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:14,代码来源:LookupTableVisitor.cs

示例2: VisitLocalVariableDeclaration

        public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
        {
            CodeVariableDeclarationStatement declStmt = null;

            for (int i = 0; i < localVariableDeclaration.Variables.Count; ++i) {
                CodeTypeReference type = ConvType(localVariableDeclaration.GetTypeForVariable(i) ?? new TypeReference("object"));
                VariableDeclaration var = (VariableDeclaration)localVariableDeclaration.Variables[i];
                if (!var.Initializer.IsNull) {
                    declStmt = new CodeVariableDeclarationStatement(type,
                                                                    var.Name,
                                                                    (CodeExpression)((INode)var.Initializer).AcceptVisitor(this, data));
                } else {
                    declStmt = new CodeVariableDeclarationStatement(type,
                                                                    var.Name);
                }
                variables.Add(declStmt);
                AddStmt(declStmt);
            }

            return declStmt;
        }
开发者ID:almazik,项目名称:ILSpy,代码行数:21,代码来源:CodeDOMOutputVisitor.cs

示例3: VisitLocalVariableDeclaration

		public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
		{
			for (int i = 0; i < localVariableDeclaration.Variables.Count; i++) {
				VariableDeclaration decl = localVariableDeclaration.Variables[i];
				if (AddDefaultValueInitializerToLocalVariableDeclarations &&
				    (localVariableDeclaration.Modifier & Modifiers.Static) == 0 &&
				    decl.FixedArrayInitialization.IsNull && decl.Initializer.IsNull) {
					TypeReference type = localVariableDeclaration.GetTypeForVariable(i);
					decl.Initializer = ExpressionBuilder.CreateDefaultValueForType(type);
				}
				if (decl.TypeReference.IsNull) {
					if (OptionInfer && !(decl.Initializer is PrimitiveExpression && (decl.Initializer as PrimitiveExpression).Value == null))
						decl.TypeReference = new TypeReference("var", true);
					else if (OptionStrict)
						decl.TypeReference = new TypeReference("System.Object", true);
					else
						decl.TypeReference = new TypeReference("dynamic", true);
				}
			}
			return base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:21,代码来源:VBNetConstructsConvertVisitor.cs

示例4: VisitLocalVariableDeclaration

 public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
 {
     if (AddDefaultValueInitializerToLocalVariableDeclarations) {
         for (int i = 0; i < localVariableDeclaration.Variables.Count; i++) {
             VariableDeclaration decl = localVariableDeclaration.Variables[i];
             if (decl.FixedArrayInitialization.IsNull && decl.Initializer.IsNull) {
                 TypeReference type = localVariableDeclaration.GetTypeForVariable(i);
                 decl.Initializer = ExpressionBuilder.CreateDefaultValueForType(type);
             }
         }
     }
     return base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
 }
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:13,代码来源:VBNetConstructsConvertVisitor.cs

示例5: VisitLocalVariableDeclaration

		public object VisitLocalVariableDeclaration(LocalVariableDeclaration lvd, object data)
		{
			ArrayList list = new ArrayList();
			for (int i = 0; i < lvd.Variables.Count; i++) {
				B.DeclarationStatement varDecl = new B.DeclarationStatement(GetLexicalInfo(lvd));
				varDecl.Declaration = new B.Declaration(GetLexicalInfo(lvd.Variables[i]), lvd.Variables[i].Name, ConvertTypeReference(lvd.GetTypeForVariable(i)));
				varDecl.Initializer = ConvertExpression(lvd.Variables[i].Initializer);
				list.Add(varDecl);
			}
			return list;
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:11,代码来源:ConvertVisitorStatements.cs


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