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

C# Ast.MemberReferenceExpression类代码示例

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

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



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

示例1: 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


示例2: OnMemberReferenceExpression

 public override void OnMemberReferenceExpression(MemberReferenceExpression node)
 {
     Write("MemberReferenceExpression(");
     BeginNode();
     WriteIndented("Target: "); Visit(node.Target); Write(", "); WriteLine();
     WriteIndented("Name: "); WriteString(node.Name);
     EndNode();
 }
开发者ID:stuman08,项目名称:boo,代码行数:8,代码来源:TreePrinterVisitor.cs


示例3: WrapStatementsInBlockIfNeeded

 public override void WrapStatementsInBlockIfNeeded(MemberReferenceExpression node, IUpdateCollector<LexicalInfo> updateCollector)
 {
     if (!this.IsInsideBlock(node))
     {
         Statement statement = BooExtensions.FindRootStatement(node);
         updateCollector.Insert(BooExtensions.SourcePosition(BooExtensions.FindExpressionRoot(statement)), "{ ", node.get_LexicalInfo(), null).InclusiveRange = false;
         updateCollector.Insert(new SourcePosition(statement.get_EndSourceLocation().get_Line(), statement.get_EndSourceLocation().get_Column() + 1), " }", node.get_LexicalInfo(), null);
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:9,代码来源:UnityScriptLanguageTraits.cs


示例4: OnMemberReferenceExpression

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

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


示例5: FixCondition

		private Expression FixCondition(Expression condition)
		{
			if (IsTryGetParameterInvocation(condition) == false)
				return condition;

			var isNull =
				new MemberReferenceExpression(condition, "_IsIgnoreNullReferencingNotNullObject_");
			return isNull;
		}
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:9,代码来源:FixTryGetParameterConditionalChecks.cs


示例6: 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


示例7: OnMemberReferenceExpression

		override public void OnMemberReferenceExpression(MemberReferenceExpression node)
		{
			var tern = ProcessTargets(node);
			if (tern != null)
			{
				ReplaceCurrentNode(tern);
				return;
			}
			base.OnMemberReferenceExpression(node);
		}
开发者ID:Rfvgyhn,项目名称:boo,代码行数:10,代码来源:SafeAccessOperator.cs


示例8: OnMemberReferenceExpression

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


示例9: OnMemberReferenceExpression

        public override void OnMemberReferenceExpression(MemberReferenceExpression node)
        {
            var name = node.ToString();

            if (name.StartsWith("@"))
            {
                ReplaceWithComponentReference(node, name);
                return;
            }

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


示例10: 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


示例11: ExpandImpl

        protected override Statement ExpandImpl(MacroStatement macro){
            if (macro.Arguments.Count == 0)
            {
                Context.Errors.Add(new CompilerError(macro.LexicalInfo,
                                                     "call macro requires at least one reference or string attribute for action name"));
            }
            var basis = new ReferenceExpression("Html");
            var method = new MemberReferenceExpression(basis, "RenderAction");
            var call = new MethodInvocationExpression(method);
            int i = 0;
            var result = new Block();
            foreach (Expression argument in macro.Arguments){
                i++;
                Expression exp = argument;
                if (!(exp is HashLiteralExpression)){
//action and contrller parameters
                    if (!(exp is NullLiteralExpression)){
                        exp = new StringLiteralExpression(argument.ToCodeString());
                    }
                    call.Arguments.Add(exp);
                }
                else{
                    string name = "__rd";
                    result.Add(
                        new DeclarationStatement(
                            new Declaration(name, null),
                            new MethodInvocationExpression(AstUtil.CreateReferenceExpression("RouteValueDictionary"))
                            )
                        );
                    var dict = argument as HashLiteralExpression;
                    foreach (ExpressionPair item in dict.Items){
                        result.Add(
                            new MethodInvocationExpression(
                                AstUtil.CreateReferenceExpression(name + ".Add"),
                                item.First,
                                item.Second
                                )
                            );
                    }
                    if (i == 2){
                        call.Arguments.Add(new NullLiteralExpression());
                    }
                    call.Arguments.Add(AstUtil.CreateReferenceExpression(name));
                }
            }
            result.Add(call);
            return result;
        }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:48,代码来源:CallMacro.cs


示例12: FixCondition

        private Expression FixCondition(Expression condition){
            if (IsTryGetParameterInvocation(condition) == false){
                return condition;
            }

            string name = ((ReferenceExpression) condition).Name.Substring(1);
            condition = new MethodInvocationExpression(
                new MemberReferenceExpression(new SuperLiteralExpression(), "TryGetParameter"),
                new StringLiteralExpression(name)
                );

            var isNull =
                new MemberReferenceExpression(condition, "_IsIgnoreNullReferencingNotNullObject_");

            return isNull;
        }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:16,代码来源:FixTryGetParameterConditionalChecks.cs


示例13: LeaveMemberReferenceExpression

    	public override void LeaveMemberReferenceExpression(MemberReferenceExpression node)
    	{
    		var property = node.Entity as IProperty;
    		if (property == null || node.IsTargetOfAssignment())
    			return;

    		var getter = CodeBuilder.CreatePropertyGet(node.Target, property);

    		// preserve duck typing...
    		if (property.IsDuckTyped)
    			ReplaceCurrentNode(
    				CodeBuilder.CreateCast(
    					TypeSystemServices.DuckType, getter));
    		else
    			ReplaceCurrentNode(getter);
    	}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:16,代码来源:ExpandPropertiesAndEvents.cs


示例14: OnMemberReferenceExpression

        public override void OnMemberReferenceExpression(MemberReferenceExpression node)
        {
            ReferenceExpression reference = node.Target as ReferenceExpression;

            if (reference != null && reference.Name.StartsWith("@"))
            {
                _component = reference;
            }
            else
            {
                _component = AstUtil.CreateMethodInvocationExpression(
                    AstUtil.CreateReferenceExpression(typeof(ComponentReference).FullName),
                    node.Target
                    );
            }

            _method = new StringLiteralExpression(node.Name);
            _found = true;
        }
开发者ID:JackWangCUMT,项目名称:rhino-tools,代码行数:19,代码来源:ComponentMethodVisitor.cs


示例15: AddResolvedNamedArgumentToEval

        protected override void AddResolvedNamedArgumentToEval(MethodInvocationExpression eval, ExpressionPair pair, ReferenceExpression instance)
        {
            if (!TypeSystemServices.IsQuackBuiltin(pair.First))
            {
                base.AddResolvedNamedArgumentToEval(eval, pair, instance);
                return;
            }

            MemberReferenceExpression memberRef = new MemberReferenceExpression(
                pair.First.LexicalInfo,
                instance.CloneNode(),
                ((ReferenceExpression)pair.First).Name);
            BindQuack(memberRef);

            eval.Arguments.Add(
                CodeBuilder.CreateAssignment(
                    pair.First.LexicalInfo,
                    memberRef,
                    pair.Second));
        }
开发者ID:Bombadil77,项目名称:boo,代码行数:20,代码来源:ProcessMethodBodiesWithDuckTyping.cs


示例16: LeaveMemberReferenceExpression

        public override void LeaveMemberReferenceExpression(MemberReferenceExpression node)
        {
            if (null == node.Entity) return;
            if (EntityType.Property != node.Entity.EntityType) return;
            if (AstUtil.IsLhsOfAssignment(node)) return;

            var property = (IProperty) node.Entity;
            MethodInvocationExpression getter = CodeBuilder.CreatePropertyGet(node.Target, property);

            // preserve duck typing...
            if (property.IsDuckTyped)
            {
                ReplaceCurrentNode(
                    CodeBuilder.CreateCast(
                        TypeSystemServices.DuckType, getter));
            }
            else
            {
                ReplaceCurrentNode(getter);
            }
        }
开发者ID:radiy,项目名称:boo,代码行数:21,代码来源:ExpandPropertiesAndEvents.cs


示例17: ResolveMember

        IEntity ResolveMember(MemberReferenceExpression node)
        {
            var entity = node.Entity;
            if (!ShouldRebindMember(entity))
                return entity;

            var ns = GetReferenceNamespace(node);
            var member = NameResolutionService.Resolve(ns, node.Name);
            if (null == member || !IsAccessible(member) || !IsApplicable(member, node))
            {
                var extension = TryToResolveMemberAsExtension(node);
                if (null != extension)
                    return extension;
            }

            if (null != member)
                return Disambiguate(node, member);

            MemberNotFound(node, ns);
            return null;
        }
开发者ID:stuman08,项目名称:boo,代码行数:21,代码来源:ProcessMethodBodies.cs


示例18: ProcessLenInvocation

        void ProcessLenInvocation(MethodInvocationExpression node)
        {
            if ((node.Arguments.Count < 1) || (node.Arguments.Count > 2))
            {
                Error(node, CompilerErrorFactory.MethodArgumentCount(node.Target, "len", node.Arguments.Count));
                return;
            }

            Expression resultingNode = null;

            Expression target = node.Arguments[0];
            IType type = GetExpressionType(target);
            bool isArray = IsAssignableFrom(TypeSystemServices.ArrayType, type);

            if ((!isArray) && (node.Arguments.Count != 1))
            {
                Error(node, CompilerErrorFactory.MethodArgumentCount(node.Target, "len", node.Arguments.Count));
            }
            if (TypeSystemServices.IsSystemObject(type))
            {
                resultingNode = CodeBuilder.CreateMethodInvocation(MethodCache.RuntimeServices_Len, target);
            }
            else if (TypeSystemServices.StringType == type)
            {
                resultingNode = CodeBuilder.CreateMethodInvocation(target, MethodCache.String_get_Length);
            }
            else if (isArray)
            {
                if (node.Arguments.Count == 1)
                    resultingNode = CodeBuilder.CreateMethodInvocation(target, MethodCache.Array_get_Length);
                else
                    resultingNode = CodeBuilder.CreateMethodInvocation(target, MethodCache.Array_GetLength, node.Arguments[1]);
            }
            else if (IsAssignableFrom(TypeSystemServices.ICollectionType, type))
            {
                resultingNode = CodeBuilder.CreateMethodInvocation(target, MethodCache.ICollection_get_Count);
            }
            else if (GenericsServices.HasConstructedType(type, TypeSystemServices.ICollectionGenericType))
            {
                resultingNode = new MemberReferenceExpression(node.LexicalInfo, target, "Count");
                Visit(resultingNode);
            }
            else
            {
                Error(CompilerErrorFactory.InvalidLen(target, type));
            }

            if (null != resultingNode)
            {
                node.ParentNode.Replace(node, resultingNode);
            }
        }
开发者ID:stuman08,项目名称:boo,代码行数:52,代码来源:ProcessMethodBodies.cs


示例19: MarkRelatedImportAsUsed

 private void MarkRelatedImportAsUsed(MemberReferenceExpression node)
 {
     string ns = null;
     foreach (var import in _currentModule.Imports)
     {
         if (ImportAnnotations.IsUsedImport(import)) continue;
         if (null == ns) ns = node.ToCodeString();
         if (import.Namespace == ns)
         {
             ImportAnnotations.MarkAsUsed(import);
             break;
         }
     }
 }
开发者ID:stuman08,项目名称:boo,代码行数:14,代码来源:ProcessMethodBodies.cs


示例20: IsBeingAssignedTo

 private bool IsBeingAssignedTo(MemberReferenceExpression node)
 {
     Node current = node;
     Node parent = current.ParentNode;
     BinaryExpression be = parent as BinaryExpression;
     while (null == be)
     {
         current = parent;
         parent = parent.ParentNode;
         if (parent == null || !(parent is Expression))
             return false;
         be = parent as BinaryExpression;
     }
     return be.Left == current;
 }
开发者ID:stuman08,项目名称:boo,代码行数:15,代码来源:ProcessMethodBodies.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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