• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IdentifierExpression类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ArgumentReferenceEmitter

        internal ArgumentReferenceEmitter(IdentifierExpression identifierExpression, ParameterDefinition parameterDefinition, ILGenerator ilGenerator, IOpCodeIndexer instructionsIndexer)
            : base(ilGenerator, instructionsIndexer) {

            _parameterDefinition = parameterDefinition;
            _identifierExpression = identifierExpression;
            Type = parameterDefinition.ParameterType.GetActualType();
        }
开发者ID:sagifogel,项目名称:NJection.LambdaConverter,代码行数:7,代码来源:ArgumentReferenceEmitter.cs


示例2: VisitIdentifierExpression

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


示例3: BuildExpression

        public string BuildExpression(Dictionary<string, Expression> selectExpressions)
        {
            var anonymousTypeCreateExpression = new AnonymousTypeCreateExpression();
            var crrv = new ChangeRootReferenceVisitor(FromIdentifier);
            foreach (var curExpr in selectExpressions.OrderBy(x => x.Key))
            {
                curExpr.Value.AcceptVisitor(crrv);
                anonymousTypeCreateExpression.Initializers.Add(
                    new AssignmentExpression(new IdentifierExpression(curExpr.Key), curExpr.Value.Clone()));
            }
            if (FromExpression == null)
                FromExpression = new IdentifierExpression();

            var queryExpr = new QueryExpression
            {
                Clauses =
                {
                    new QueryFromClause
                    {
                        Identifier = "doc",
                        Expression = FromExpression.Clone()
                    },
                    new QuerySelectClause
                    {
                        Expression = anonymousTypeCreateExpression.Clone()
                    }
                }
            };
            FromIdentifier = "doc";

            var printer = new StringWriter();
            var printerVisitor = new CSharpOutputVisitor(printer, FormattingOptionsFactory.CreateSharpDevelop());
            queryExpr.AcceptVisitor(printerVisitor);
            return printer.GetStringBuilder().ToString();
        }
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:35,代码来源:IndexData.cs


示例4: GenerateFieldDeclaration

		static AstNode GenerateFieldDeclaration (RefactoringContext context, IdentifierExpression identifier)
		{
			return new FieldDeclaration () {
				ReturnType = GuessType (context, identifier),
				Variables = { new VariableInitializer (identifier.Identifier) }
			};
		}
开发者ID:tapenjoyGame,项目名称:ILSpy,代码行数:7,代码来源:CreateField.cs


示例5: GetLocal

		public override DVariable GetLocal(string LocalName, IdentifierExpression id = null)
		{
			foreach (var kv in Locals)
				if (kv.Key.Name == LocalName)
					return kv.Key;
			return null;
		}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:7,代码来源:InterpretationContext.cs


示例6: IdentifierExpressionProducesIdentifier

        public void IdentifierExpressionProducesIdentifier()
        {
            var id = new IdentifierExpression("test");

            Assert.AreEqual("test", id.Name);
            Assert.AreEqual("test", id.ToString(false));
        }
开发者ID:DaveVdE,项目名称:adamjsgenerator,代码行数:7,代码来源:IdentifierExpressionTests.cs


示例7: E

        ISemantic E(IdentifierExpression id, bool ImplicitlyExecute = true)
        {
            if (id.IsIdentifier)
            {
                var o = GetOverloads(id, ctxt);

                if (eval)
                {
                    if (o == null || o.Length == 0)
                    {
                        EvalError(id, "Symbol could not be found");
                        return null;
                    }

                    return TryDoCTFEOrGetValueRefs(o, id, ImplicitlyExecute);
                }
                else
                {
                    ctxt.CheckForSingleResult(o, id);
                    if (o != null)
                        if (o.Length == 1)
                            return o[0];
                        else if (o.Length > 1)
                            return new InternalOverloadValue(o);
                    return null;
                }
            }
            else
                return EvaluateLiteral(id);
        }
开发者ID:DinrusGroup,项目名称:DRC,代码行数:30,代码来源:Evaluation.Identifiers.cs


示例8: ReplaceStringLiteralsWithVariables

        public static string ReplaceStringLiteralsWithVariables(string text, IEnumerable<string> macros, Func<int, int, string, string, string> onReplace)
        {
            var setting = new CompilerSettings();
            foreach (var macro in macros) setting.ConditionalSymbols.Add(macro);

            var tree = SyntaxTree.Parse(text, string.Empty, setting);
            tree.Freeze();

            var doc = new StringBuilderDocument(text);
            using (var editor = new DocumentScript(doc, FormattingOptionsFactory.CreateAllman(), TextEditorOptions.Default)) {
                var originDoc = editor.OriginalDocument;

                foreach (var node in tree.Descendants.OfType<PrimitiveExpression>().Where(e => e.Value is string)) {
                    var line = originDoc.GetLineByNumber(node.StartLocation.Line);
                    var result = onReplace(node.StartLocation.Line, node.StartLocation.Column, originDoc.GetText(line), node.Value as string);
                    if (result != null) {
                        var names = result.Split('.');
                        Expression exp = new IdentifierExpression(names.First());
                        foreach (var name in names.Skip(1)) exp = exp.Member(name);

                        editor.Replace(node, exp);
                    }
                }
            }

            return doc.Text;
        }
开发者ID:GHScan,项目名称:DailyProjects,代码行数:27,代码来源:NRefactoryTool.cs


示例9: Run

		public void Run (RefactoringContext context)
		{
			var foreachStatement = GetForeachStatement (context);
			
			var result = context.ResolveType (foreachStatement.InExpression);
			var countProperty = GetCountProperty (result);
			
			var initializer = new VariableDeclarationStatement (new PrimitiveType ("int"), "i", new PrimitiveExpression (0));
			var id1 = new IdentifierExpression ("i");
			var id2 = id1.Clone ();
			var id3 = id1.Clone ();
			
			var forStatement = new ForStatement () {
				Initializers = { initializer },
				Condition = new BinaryOperatorExpression (id1, BinaryOperatorType.LessThan, new MemberReferenceExpression (foreachStatement.InExpression.Clone (), countProperty)),
				Iterators = { new ExpressionStatement (new UnaryOperatorExpression (UnaryOperatorType.PostIncrement, id2)) },
				EmbeddedStatement = new BlockStatement {
					new VariableDeclarationStatement (foreachStatement.VariableType.Clone (), foreachStatement.VariableName, new IndexerExpression (foreachStatement.InExpression.Clone (), id3))
				}
			};
			
			if (foreachStatement.EmbeddedStatement is BlockStatement) {
				foreach (var child in ((BlockStatement)foreachStatement.EmbeddedStatement).Statements) {
					forStatement.EmbeddedStatement.AddChild (child.Clone (), BlockStatement.StatementRole);
				}
			} else {
				forStatement.EmbeddedStatement.AddChild (foreachStatement.EmbeddedStatement.Clone (), BlockStatement.StatementRole);
			}
			
			using (var script = context.StartScript ()) {
				script.Replace (foreachStatement, forStatement);
				script.Link (initializer.Variables.First ().NameToken, id1, id2, id3);
			}
		}
开发者ID:hduregger,项目名称:monodevelop,代码行数:34,代码来源:ConvertForeachToFor.cs


示例10: CreateFromExpression

		CodeAction CreateFromExpression(RefactoringContext context, Expression expression)
		{
			var resolveResult = context.Resolve(expression);
			if (resolveResult.IsError)
				return null;
			
			return new CodeAction(context.TranslateString("Extract method"), script => {
				string methodName = "NewMethod";
				var method = new MethodDeclaration() {
					ReturnType = context.CreateShortType(resolveResult.Type),
					Name = methodName,
					Body = new BlockStatement() {
						new ReturnStatement(expression.Clone())
					}
				};
				if (!StaticVisitor.UsesNotStaticMember(context, expression))
					method.Modifiers |= Modifiers.Static;
				var task = script.InsertWithCursor(context.TranslateString("Extract method"), Script.InsertPosition.Before, method);

				Action<Task> replaceStatements = delegate {
					var target = new IdentifierExpression(methodName);
					script.Replace(expression, new InvocationExpression(target));
					script.Link(target, method.NameToken);
				};

				if (task.IsCompleted) {
					replaceStatements (null);
				} else {
					task.ContinueWith (replaceStatements, TaskScheduler.FromCurrentSynchronizationContext ());
				}
			});
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:32,代码来源:ExtractMethodAction.cs


示例11: PPPragmaNode

        public PPPragmaNode(IdentifierExpression identifier, NodeCollection<ConstantExpression> value, PragmaAction action)
            : base(identifier.RelatedToken)
		{
			this.identifier = identifier;
            this.value = value;
            this.Action = action;
		}
开发者ID:debreuil,项目名称:CSharpParser,代码行数:7,代码来源:PPPragmaNode.cs


示例12: LocalDeclarationStatement

        public LocalDeclarationStatement(IType type, IdentifierExpression identifier, ExpressionNode rightSide)
            : base(identifier.RelatedToken)
		{
			this.type = type;
            this.identifiers.Expressions.Add(identifier);
			this.rightSide = rightSide;
		}
开发者ID:mintberry,项目名称:stackrecaller,代码行数:7,代码来源:LocalDeclarationStatement.cs


示例13: Run

		public void Run (RefactoringContext context)
		{
			var property = context.GetNode<PropertyDeclaration> ();
			
			string backingStoreName = context.GetNameProposal (property.Name);
			
			// create field
			var backingStore = new FieldDeclaration ();
			backingStore.ReturnType = property.ReturnType.Clone ();
			
			var initializer = new VariableInitializer (backingStoreName);
			backingStore.Variables.Add (initializer);
			
			// create new property & implement the get/set bodies
			var newProperty = (PropertyDeclaration)property.Clone ();
			var id1 = new IdentifierExpression (backingStoreName);
			var id2 = new IdentifierExpression (backingStoreName);
			newProperty.Getter.Body = new BlockStatement () {
				new ReturnStatement (id1)
			};
			newProperty.Setter.Body = new BlockStatement () {
				new ExpressionStatement (new AssignmentExpression (id2, AssignmentOperatorType.Assign, new IdentifierExpression ("value")))
			};
			
			using (var script = context.StartScript ()) {
				script.Replace (property, newProperty);
				script.InsertBefore (property, backingStore);
				script.Link (initializer, id1, id2);
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:30,代码来源:CreateBackingStore.cs


示例14: Visit

        public ISymbolValue Visit(IdentifierExpression id)
        {
            var ImplicitlyExecute = this.ImplicitlyExecute;
            this.ImplicitlyExecute = true;

            if (id.IsIdentifier)
            {
                var o = ExpressionTypeEvaluation.EvaluateTypes(id, ctxt);

                if (o == null || o.Length == 0)
                {
                    EvalError(id, "Symbol could not be found");
                    return null;
                }

                return TryDoCTFEOrGetValueRefs(o, id, ImplicitlyExecute);
            }

            byte tt;
            switch (id.Format)
            {
                case Parser.LiteralFormat.CharLiteral:
                    var tk = id.Subformat == LiteralSubformat.Utf32 ? DTokens.Dchar :
                        id.Subformat == LiteralSubformat.Utf16 ? DTokens.Wchar :
                        DTokens.Char;

                    return new PrimitiveValue(tk, Convert.ToDecimal((int)(char)id.Value), id);

                case LiteralFormat.FloatingPoint | LiteralFormat.Scalar:
                    var im = id.Subformat.HasFlag(LiteralSubformat.Imaginary);

                    tt = im ? DTokens.Idouble : DTokens.Double;

                    if (id.Subformat.HasFlag(LiteralSubformat.Float))
                        tt = im ? DTokens.Ifloat : DTokens.Float;
                    else if (id.Subformat.HasFlag(LiteralSubformat.Real))
                        tt = im ? DTokens.Ireal : DTokens.Real;

                    var v = Convert.ToDecimal(id.Value);

                    return new PrimitiveValue(tt, im ? 0 : v, id, im ? v : 0);

                case LiteralFormat.Scalar:
                    var unsigned = id.Subformat.HasFlag(LiteralSubformat.Unsigned);

                    if (id.Subformat.HasFlag(LiteralSubformat.Long))
                        tt = unsigned ? DTokens.Ulong : DTokens.Long;
                    else
                        tt = unsigned ? DTokens.Uint : DTokens.Int;

                    return new PrimitiveValue(tt, Convert.ToDecimal(id.Value), id);

                case Parser.LiteralFormat.StringLiteral:
                case Parser.LiteralFormat.VerbatimStringLiteral:
                    return new ArrayValue(GetStringType(id.Subformat), id);
                default:
                    return null;
            }
        }
开发者ID:rainers,项目名称:D_Parser,代码行数:59,代码来源:Evaluation.Identifiers.cs


示例15: ArrayValue

 /// <summary>
 /// String constructor.
 /// Given result stores both type and idenfitierexpression whose Value is used as content
 /// </summary>
 public ArrayValue(ArrayType stringLiteralResult, IdentifierExpression stringLiteral=null)
     : base(ExpressionValueType.Array, stringLiteralResult, stringLiteral)
 {
     if (stringLiteralResult.DeclarationOrExpressionBase is IdentifierExpression)
         StringValue = ((IdentifierExpression)stringLiteralResult.DeclarationOrExpressionBase).Value as string;
     else
         StringValue = stringLiteral.Value as string;
 }
开发者ID:gavin-norman,项目名称:Mono-D,代码行数:12,代码来源:ExpressionValues.cs


示例16: CastAndInvoke

        public void CastAndInvoke()
        {
            Expression expr = new IdentifierExpression("a")
                .CastTo(new PrimitiveType("string"))
                .Member("Length");

            Assert.AreEqual("((string)a).Length", InsertRequired(expr));
            Assert.AreEqual("((string)a).Length", InsertReadable(expr));
        }
开发者ID:richardschneider,项目名称:ILSpy,代码行数:9,代码来源:InsertParenthesesVisitorTests.cs


示例17: VisitIdentifierExpression

		public override void VisitIdentifierExpression(IdentifierExpression identifierExpression)
		{
			if (startLocation.IsEmpty || startLocation <= identifierExpression.StartLocation && identifierExpression.EndLocation <= endLocation) {
				var result = context.Resolve(identifierExpression);
				var local = result as LocalResolveResult;
				if (local != null && !UsedVariables.Contains(local.Variable))
					UsedVariables.Add(local.Variable);
			}
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:9,代码来源:VariableLookupVisitor.cs


示例18: VisitIdentifierExpression

			public override void VisitIdentifierExpression(IdentifierExpression identifierExpression)
			{
				if (!IsTargetOfInvocation(identifierExpression)) {
					var mgr = ctx.Resolve (identifierExpression) as MethodGroupResolveResult;
					if (mgr != null)
						UsedMethods.AddRange (mgr.Methods);
				}
				base.VisitIdentifierExpression(identifierExpression);
			}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:9,代码来源:ParameterNotUsedIssue.cs


示例19: VisitIdentifierExpression

        public override void VisitIdentifierExpression(IdentifierExpression identifierExpression)
        {
            base.VisitIdentifierExpression (identifierExpression);

            int length = identifierExpression.EndLocation.Column - identifierExpression.StartLocation.Column;
            int offset = identifierExpression.StartLocation.Column - 1;

            ReplaceType (identifierExpression.Identifier, offset, length);
        }
开发者ID:0xb1dd1e,项目名称:debugger-libs,代码行数:9,代码来源:NRefactoryExpressionResolverVisitor.cs


示例20: GeneratePropertyDeclaration

		AstNode GeneratePropertyDeclaration (RefactoringContext context, IdentifierExpression identifier)
		{
			return new PropertyDeclaration () {
				ReturnType = CreateField.GuessType (context, identifier),
				Name = identifier.Identifier,
				Getter = new Accessor (),
				Setter = new Accessor ()
			};
		}
开发者ID:tapenjoyGame,项目名称:ILSpy,代码行数:9,代码来源:CreateProperty.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IdentifierTerminal类代码示例发布时间:2022-05-24
下一篇:
C# Identifier类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap