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

C# Ast.ReferenceExpression类代码示例

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

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



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

示例1: LiftReferenceExpression

		public void LiftReferenceExpression()
		{
			var referenceExpression = new ReferenceExpression("foo");
			var parameter = ParameterDeclaration.Lift(referenceExpression);
			Assert.AreEqual(referenceExpression.Name, parameter.Name);
			Assert.IsNull(parameter.Type);
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:7,代码来源:ParameterDeclarationTest.cs


示例2: OnMethodInvocationExpression

		/// <summary>
		/// This turn a call to TryGetParemeter('item') where item is a local variable
		/// into a WrapIfNull(item) method call.
		/// </summary>
		/// <param name="node">The node.</param>
		public override void OnMethodInvocationExpression(MethodInvocationExpression node)
		{
			var expression = node.Target as ReferenceExpression;
			if (expression == null || expression.Name != "TryGetParameter")
			{
				base.OnMethodInvocationExpression(node);
				return;
			}
			var name = ((StringLiteralExpression)node.Arguments[0]).Value;
			var entity = NameResolutionService.Resolve(name);
			if (entity == null)
			{
				base.OnMethodInvocationExpression(node);
				return;
			}
			var parentNode = node.ParentNode;
			var mie = CodeBuilder.CreateMethodInvocation(
				CodeBuilder.CreateSelfReference(_currentMethod.DeclaringType),
				wrapNullValue);

			var item = new ReferenceExpression(node.LexicalInfo, name);
			TypeSystemServices.Bind(item, entity);
			mie.Arguments.Add(item);
			parentNode.Replace(node, mie);
		}
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:30,代码来源:ReplaceUknownWithParameters.cs


示例3: OnReferenceExpression

 public override void OnReferenceExpression(ReferenceExpression node)
 {
     if (LookingFor(node))
     {
         Found(node);
     }
 }
开发者ID:paveltimofeev,项目名称:documentation,代码行数:7,代码来源:ReferenceFinder.cs


示例4: GeneratorExpressionTrees

 public GeneratorExpressionTrees(string parameter, ReferenceExpression parameterRef, NameResolutionService nameResolutionService, BooCodeBuilder codeBuilder)
 {
     _parameter = parameter;
     _parameterRef = parameterRef;
     _nameResolutionService = nameResolutionService;
     _codeBuilder = codeBuilder;
 }
开发者ID:BITechnologies,项目名称:boo,代码行数:7,代码来源:GeneratorExpressionTrees.cs


示例5: my

		public static Expression my(ReferenceExpression typeReference)
		{
			var myReference = new GenericReferenceExpression(typeReference.LexicalInfo);
			myReference.Target = AstUtil.CreateReferenceExpression(typeReference.LexicalInfo, "Boo.Lang.Environments.My");
			myReference.GenericArguments.Add(TypeReference.Lift(typeReference));
			return new MemberReferenceExpression(typeReference.LexicalInfo, myReference, "Instance");
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:7,代码来源:MyIdiom.cs


示例6: OnReferenceExpression

        public override void OnReferenceExpression(ReferenceExpression node)
        {
            var entity = NameResolutionService.Resolve(node.Name);
            if (entity != null)
            {
                base.OnReferenceExpression(node);
                return;
            }
            if (node.Name.StartsWith("@"))
            {
                ReplaceWithComponentReference(node, node.Name);
                return;
            }
            else if (node.ParentNode is ExpressionPair)
            {
                var pair = (ExpressionPair) node.ParentNode;
                var literal = CodeBuilder.CreateStringLiteral(node.Name);
                pair.Replace(node, literal);
                return;
            }
            else if (
                //search for the left side of a key in a hash literal expression
                node.ParentNode is ExpressionPair
                && ((ExpressionPair) node.ParentNode).First == node
                && node.ParentNode.ParentNode is HashLiteralExpression)
            {
                var parent = (ExpressionPair) node.ParentNode;
                var literal = CodeBuilder.CreateStringLiteral(node.Name);
                parent.First = literal;
                parent.Replace(node, literal);
                return;
            }

            base.OnReferenceExpression(node);
        }
开发者ID:oz-systems,项目名称:rhino-commons,代码行数:35,代码来源:TransformUnknownReferences.cs


示例7: TransformNodeName

        /// <summary>
        /// Sets the node name to pascal case.
        /// </summary>
        /// <param name="node">The node.</param>
        protected virtual void TransformNodeName(ReferenceExpression node)
        {
            var nameCharacters = node.Name.ToCharArray();

            nameCharacters[0] = char.ToUpperInvariant(nameCharacters[0]);

            node.Name = new string(nameCharacters);
        }
开发者ID:modulexcite,项目名称:Argh,代码行数:12,代码来源:CapitalisationCompilerStep.cs


示例8: OnReferenceExpression

        public override void OnReferenceExpression(ReferenceExpression node)
        {
            IAccessibleMember member = node.Entity as IAccessibleMember;
            if (null == member) return;

            if (_checker.IsAccessible(member)) return;
            Error(CompilerErrorFactory.UnaccessibleMember(node, member.FullName));
        }
开发者ID:boo,项目名称:boo-lang,代码行数:8,代码来源:CheckMembersProtectionLevel.cs


示例9: AmbiguousReference

 public static CompilerError AmbiguousReference(ReferenceExpression reference, System.Reflection.MemberInfo[] members)
 {
     return new CompilerError("BCE0004",
                               SafeLexicalInfo(reference),
                               reference.Name,
                               ToNameList(members)
                               );
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:8,代码来源:CompilerErrorFactory.cs


示例10: MakeReferenceExpression

		B.ReferenceExpression MakeReferenceExpression(string fullName)
		{
			string[] parts = fullName.Split('.');
			B.ReferenceExpression r = new B.ReferenceExpression(lastLexicalInfo, parts[0]);
			for (int i = 1; i < parts.Length; i++)
				r = new B.MemberReferenceExpression(lastLexicalInfo, r, parts[i]);
			return r;
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:8,代码来源:ConvertVisitorExpressions.cs


示例11: OnMethodInvocationExpression

        public override void OnMethodInvocationExpression(MethodInvocationExpression node)
        {
            if (node is MethodInvocationExpression && node.Target is GenericReferenceExpression)
            {
                var genericReferenceExpression = (GenericReferenceExpression)node.Target;
                if (genericReferenceExpression.Target is MemberReferenceExpression)
                {
                    var memberReferenceExpression = (MemberReferenceExpression)genericReferenceExpression.Target;
                    if (memberReferenceExpression.Target is MemberReferenceExpression)
                    {
                        var memberReferenceExpression2 = (MemberReferenceExpression)memberReferenceExpression.Target;
                        if (memberReferenceExpression2.Target is MemberReferenceExpression)
                        {
                            var memberReferenceExpression3 = (MemberReferenceExpression)memberReferenceExpression2.Target;
                            if (memberReferenceExpression3.Target is ReferenceExpression)
                            {
                                var referenceExpression = (ReferenceExpression)memberReferenceExpression3.Target;
                                if (referenceExpression.Name == "Boo" && memberReferenceExpression3.Name == "Lang" && memberReferenceExpression2.Name == "Builtins" && memberReferenceExpression.Name == "array" && 1 == ((ICollection)genericReferenceExpression.GenericArguments).Count)
                                {
                                    TypeReference node2 = genericReferenceExpression.GenericArguments[0];
                                    if (1 == ((ICollection)node.Arguments).Count && node.Arguments[0] is CastExpression)
                                    {
                                        var castExpression = (CastExpression)node.Arguments[0];
                                        Expression target = castExpression.Target;
                                        if (castExpression.Type is SimpleTypeReference)
                                        {
                                            var simpleTypeReference = (SimpleTypeReference)castExpression.Type;
                                            if (simpleTypeReference.Name == "int")
                                            {
                                                var methodInvocationExpression = new MethodInvocationExpression(LexicalInfo.Empty);
                                                var arg_255_0 = methodInvocationExpression;
                                                var genericReferenceExpression2 = new GenericReferenceExpression(LexicalInfo.Empty);
                                                GenericReferenceExpression arg_226_0 = genericReferenceExpression2;
                                                var referenceExpression2 = new ReferenceExpression(LexicalInfo.Empty);
                                                string text = referenceExpression2.Name = "array";
                                                Expression expression = arg_226_0.Target = referenceExpression2;
                                                TypeReferenceCollection typeReferenceCollection = genericReferenceExpression2.GenericArguments = TypeReferenceCollection.FromArray(new TypeReference[]
                                            {
                                                TypeReference.Lift(node2)
                                            });
                                                Expression expression2 = arg_255_0.Target = genericReferenceExpression2;
                                                ExpressionCollection expressionCollection = methodInvocationExpression.Arguments = ExpressionCollection.FromArray(new Expression[]
                                            {
                                                Expression.Lift(target)
                                            });
                                                ReplaceCurrentNode(methodInvocationExpression);
                                            }
                                        }

                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:paveltimofeev,项目名称:documentation,代码行数:57,代码来源:RenameArrayDeclaration.cs


示例12: OnReferenceExpression

        /// <summary>
        /// Called when we encounter a reference expression
        /// </summary>
        /// <param name="node">The node.</param>
        public override void OnReferenceExpression(ReferenceExpression node)
        {
            if (this.ShouldTransformNodeName(node))
            {
                this.TransformNodeName(node);
            }

            base.OnReferenceExpression(node);
        }
开发者ID:modulexcite,项目名称:Argh,代码行数:13,代码来源:CapitalisationCompilerStep.cs


示例13: WithExpander

 public WithExpander(ReferenceExpression instance)
 {
     this.instance = instance;
     /*
     foreach (var method in members.Where(m => m.EntityType == EntityType.Method))
     {
         keywords.Add(method.Name);
     }*/
 }
开发者ID:JulianBirch,项目名称:Solution-Transform,代码行数:9,代码来源:WithMacro.cs


示例14: OnReferenceExpression

 public override void OnReferenceExpression(ReferenceExpression node) {
     if (node.Name[0] == '_')
     {
         var result = new MemberReferenceExpression(node.LexicalInfo);
         result.Name = node.Name.Substring(1);
         result.Target = instance.CloneNode();
         ReplaceCurrentNode(result);
     }
 }
开发者ID:JulianBirch,项目名称:Solution-Transform,代码行数:9,代码来源:WithMacro.cs


示例15: OnReferenceExpression

 public override void OnReferenceExpression(ReferenceExpression node)
 {
     if (TypeInference.IsTypeLiteral(node))
     {
         TypeofExpression typeofExpression = new TypeofExpression(LexicalInfo.Empty);
         TypeReference typeReference = typeofExpression.Type = TypeReference.Lift(node);
         this.ReplaceCurrentNode(typeofExpression);
     }
 }
开发者ID:paveltimofeev,项目名称:documentation,代码行数:9,代码来源:CSharpTransformer.cs


示例16: build_with

        public static Expression build_with(ReferenceExpression builder, MethodInvocationExpression build, ReferenceExpression frameWorkVersion)
        {
            var targetName = builder.Name;

            return new MethodInvocationExpression(
                    new ReferenceExpression(targetName),
                    build.Arguments[0],
                    new StringLiteralExpression(frameWorkVersion.Name)
                );
        }
开发者ID:emmekappa,项目名称:horn_src,代码行数:10,代码来源:BooConfigReader.cs


示例17: LiftCastExpression

		public void LiftCastExpression()
		{
			var referenceExpression = new ReferenceExpression("foo");
			var typeReference = new SimpleTypeReference("T");
			Expression cast = new TryCastExpression(referenceExpression, typeReference);
			var parameter = ParameterDeclaration.Lift(cast);
			Assert.AreEqual(referenceExpression.Name, parameter.Name);
			Assert.IsTrue(typeReference.Matches(parameter.Type));
			Assert.AreNotSame(typeReference, parameter.Type);
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:10,代码来源:ParameterDeclarationTest.cs


示例18: TransformNodeName

 /// <summary>
 /// Sets the node name to pascal case.
 /// </summary>
 /// <param name="node">The node.</param>
 protected virtual void TransformNodeName(ReferenceExpression node)
 {
     string[] parts = node.Name.Split(new char[] { '_' },StringSplitOptions.RemoveEmptyEntries);
     StringBuilder name = new StringBuilder();
     foreach (string part in parts)
     {
         name.Append(char.ToUpperInvariant(part[0]))
             .Append(part.Substring(1));
     }
     node.Name = name.ToString();
 }
开发者ID:nigthwatch,项目名称:rhino-dsl,代码行数:15,代码来源:UnderscoreNamingConventionsToPascalCaseCompilerStep.cs


示例19: CreateReferenceExpression

 public static ReferenceExpression CreateReferenceExpression(string fullname)
 {
     string[] parts = fullname.Split('.');
     ReferenceExpression expression = new ReferenceExpression(parts[0]);
     expression.IsSynthetic = true;
     for (int i=1; i<parts.Length; ++i)
     {
         expression = new MemberReferenceExpression(expression, parts[i]);
         expression.IsSynthetic = true;
     }
     return expression;
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:12,代码来源:AstUtil.cs


示例20: OnReferenceExpression

        public override void OnReferenceExpression(ReferenceExpression node){
            if(checkAll(node)){
                return;
            }
            
            if(checkSubstitution(node)){
                return;
            }

            //else{
                base.OnReferenceExpression(node);
            //}
        }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:13,代码来源:TemplateBindVisitor.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Ast.ReturnStatement类代码示例发布时间:2022-05-24
下一篇:
C# Ast.ParameterDeclarationCollection类代码示例发布时间: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