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


C# Ast.IdentifierExpression类代码示例

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


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

示例1: add_Invocation

        //, AstExpression expression)
        public static InvocationExpression add_Invocation(this BlockStatement blockStatement, string typeName, string methodName, params object[] parameters)
        {
            if (methodName.valid().isFalse())
                return null;

            Expression memberExpression = null;
            if (typeName.valid())
                memberExpression = new MemberReferenceExpression(new IdentifierExpression(typeName), methodName);
            else
                memberExpression = new IdentifierExpression(methodName);

            var memberReference = new InvocationExpression(memberExpression);
            if (parameters != null)
            {
                var arguments = new List<Expression>();
                foreach (var parameter in parameters)
                    if (parameter is Expression)
                        arguments.add(parameter as Expression);
                    else
                        arguments.add(new PrimitiveExpression(parameter, parameter.str()));

                memberReference.Arguments = arguments;
            }

            blockStatement.append(memberReference.expressionStatement());

            return memberReference;
        }
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:29,代码来源:InvocationExpression_ExtensionMethods.cs

示例2: TrackedVisitIdentifierExpression

        public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
        {
            TypeDeclaration typeDeclaration = (TypeDeclaration) AstUtil.GetParentOfType(identifierExpression, typeof(TypeDeclaration));

            if (typeDeclaration != null && typeDeclaration.Parent is TypeDeclaration && !IsInvocation(identifierExpression))
            {
                IList parentFields = AstUtil.GetChildrenWithType(typeDeclaration.Parent, typeof(FieldDeclaration));
                IList innerFields = AstUtil.GetChildrenWithType(typeDeclaration, typeof(FieldDeclaration));
                FieldDeclaration field = new FieldDeclaration(null);

                field.Fields.Add(new VariableDeclaration(identifierExpression.Identifier));
                if (!ContainsField(innerFields, field, false) &&
                    !IdentifierDeclaredInParameter(identifierExpression) &&
                    ContainsField(parentFields, field, false))
                {
                    string parentTypeName = ((TypeDeclaration) typeDeclaration.Parent).Name;
                    AddInstanceField(typeDeclaration, parentTypeName);
                    IdentifierExpression ins = new IdentifierExpression(parentTypeName);
                    FieldReferenceExpression fieldReferenceExpression = new FieldReferenceExpression(ins, identifierExpression.Identifier);
                    fieldReferenceExpression.Parent = identifierExpression.Parent;

                    ReplaceCurrentNode(fieldReferenceExpression);
                }
            }
            return base.TrackedVisitIdentifierExpression(identifierExpression, data);
        }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:26,代码来源:InnerClassTransformer.cs

示例3: VisitIdentifierExpression

		public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
		{
			if (nameComparer.Equals(identifierExpression.Identifier, from)) {
				identifierExpression.Identifier = to;
			}
			return base.VisitIdentifierExpression(identifierExpression, data);
		}
开发者ID:XQuantumForceX,项目名称:Reflexil,代码行数:7,代码来源:RenameIdentifierVisitor.cs

示例4: TrackedVisitIdentifierExpression

        public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
        {
            if (identifierExpression.Parent is InvocationExpression)
                return null;
            IList staticTypes = new ArrayList();

            staticTypes.Add("java.lang.String");
            staticTypes.Add("java.lang.Object");

            string type = GetStaticFullName(identifierExpression.Identifier, identifierExpression);
            if (type != null)
            {
                if (!staticTypes.Contains(type) && CodeBase.Mappings.Contains(type))
                {
                    string mappedType = CodeBase.Mappings[type].Target;
                    TypeReferenceExpression rpe = new TypeReferenceExpression(mappedType);
                    rpe.Parent = identifierExpression.Parent;
                    ReplaceCurrentNode(rpe);
                }
                else if (CodeBase.Types.Contains(type))
                {
                    if (!UsedTypes.Contains(type))
                        UsedTypes.Add(type);
                }
            }
            return null;
        }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:27,代码来源:TypeMapper.cs

示例5: add_MemberReference

 //, AstExpression expression)
 public static MemberReferenceExpression add_MemberReference(this BlockStatement blockStatement, string memberName, string className)
 {
     var identifier = new IdentifierExpression(memberName);
     var memberReference = new MemberReferenceExpression(identifier, className);
     blockStatement.append(memberReference.expressionStatement());
     return memberReference;
 }
开发者ID:pusp,项目名称:o2platform,代码行数:8,代码来源:MemberReferenceExpression_ExtensionMethods.cs

示例6: VisitIdentifierExpression

 public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
 {
     if (Compare(identifierExpression))
     {
         identifiers.Add(identifierExpression);
     }
     return base.VisitIdentifierExpression(identifierExpression, data);
 }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:8,代码来源:FindSpecificCatchClauses.cs

示例7: VisitIdentifierExpression

 public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
 {
     if (RenameTable.ContainsKey(identifierExpression.Identifier))
     {
         identifierExpression.Identifier = RenameTable[identifierExpression.Identifier];
     }
     return null;
 }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:8,代码来源:RenameLocalVariableRefactoring.cs

示例8: TrackedVisitIdentifierExpression

 public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
 {
     if (identifierExpression.Identifier == "System")
     {
         TypeReferenceExpression typeReferenceExpression = new TypeReferenceExpression("java.lang.System");
         ReplaceCurrentNode(typeReferenceExpression);
     }
     return base.TrackedVisitIdentifierExpression(identifierExpression, data);
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:9,代码来源:SystemFieldsTransformer.cs

示例9: TrackedVisitIdentifierExpression

 public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
 {
     if (data != null && data is string)
     {
         string identifier = identifierExpression.Identifier;
         if (identifier == (string) data)
             ReplaceCurrentNode(new IdentifierExpression("value"));
     }
     return base.TrackedVisitIdentifierExpression(identifierExpression, data);
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:10,代码来源:AccessorRefactoring.cs

示例10: parameterPosition

 public static int parameterPosition(this ObjectCreateExpression objectCreateExpression, IdentifierExpression identifierExpression)
 {
     if (objectCreateExpression != null && identifierExpression != null)
         for (int i = 0; i < objectCreateExpression.Parameters.Count; i++)								// for each arguments
             foreach (var iNode in objectCreateExpression.Parameters[i].iNodes<IdentifierExpression>())	// get the IdentifierExpression
                 if (iNode == identifierExpression)													// and compare the values
                     return i;
     "in ObjectCreateExpression.parameterPosition could not find provided IdentifierExpression as a current parameter".error();
     return -1;
 }
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:10,代码来源:ObjectCreateExpression_ExtensionMethod.cs

示例11: TrackedVisitIdentifierExpression

 public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
 {
     if (similarTypes.Contains(identifierExpression.Identifier))
     {
         string fullTypeName = (string) similarTypes[identifierExpression.Identifier];
         TypeReferenceExpression typeReferenceExpression = new TypeReferenceExpression(fullTypeName);
         ReplaceCurrentNode(typeReferenceExpression);
     }
     return base.TrackedVisitIdentifierExpression(identifierExpression, data);
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:10,代码来源:SameProjectAndExternalTypeNameTransformer.cs

示例12: VisitIdentifierExpression

 public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
 {
     string name = identifierExpression.Identifier;
     foreach (VariableDeclaration var in fields) {
         if (var.Name == name && !IsLocal(name)) {
             identifierExpression.Identifier = prefix + name;
             break;
         }
     }
     return base.VisitIdentifierExpression(identifierExpression, data);
 }
开发者ID:pusp,项目名称:o2platform,代码行数:11,代码来源:PrefixFieldsVisitor.cs

示例13: IdentifierOnlyInvocation

		public void IdentifierOnlyInvocation()
		{
			// InitializeComponents();
			IdentifierExpression identifier = new IdentifierExpression("InitializeComponents");
			InvocationExpression invocation = new InvocationExpression(identifier, new List<Expression>());
			object output = invocation.AcceptVisitor(new CodeDomVisitor(), null);
			Assert.IsTrue(output is CodeMethodInvokeExpression);
			CodeMethodInvokeExpression mie = (CodeMethodInvokeExpression)output;
			Assert.AreEqual("InitializeComponents", mie.Method.MethodName);
			Assert.IsTrue(mie.Method.TargetObject is CodeThisReferenceExpression);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:11,代码来源:InvocationExpressionTest.cs

示例14: TrackedVisitIdentifierExpression

 public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
 {
     if (!IsMethodInvocation(identifierExpression))
     {
         TypeDeclaration typeDeclaration = (TypeDeclaration) AstUtil.GetParentOfType(identifierExpression, typeof(TypeDeclaration));
         string fullName = GetFullName(typeDeclaration);
         string key = fullName + "." + identifierExpression.Identifier;
         if (CodeBase.References.Contains(key))
             identifierExpression.Identifier = (string) CodeBase.References[key];
     }
     return base.TrackedVisitIdentifierExpression(identifierExpression, data);
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:12,代码来源:SameFieldAndMethodUsagesTransformer.cs

示例15: CreateGetClassMethodInvocation

 private InvocationExpression CreateGetClassMethodInvocation(TypeOfExpression typeOfExpression)
 {
     FieldReferenceExpression argument = new FieldReferenceExpression(typeOfExpression, "AssemblyQualifiedName");
     typeOfExpression.Parent = argument;
     List<Expression> arguments = new List<Expression>();
     arguments.Add(argument);
     IdentifierExpression methodIdentifier = new IdentifierExpression("java.lang.Class");
     FieldReferenceExpression methodReference = new FieldReferenceExpression(methodIdentifier, "forName");
     InvocationExpression invocationExpression = new InvocationExpression(methodReference, arguments);
     argument.Parent = invocationExpression;
     methodReference.Parent = invocationExpression;
     return invocationExpression;
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:13,代码来源:DotClassTransformer.cs


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