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


C# IMethodSymbol.GetMemberName方法代码示例

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


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

示例1: CreateObject

        public JsExpression CreateObject(JsExpression containingType, IMethodSymbol constructor, params JsExpression[] arguments)
        {
            var constructorReference = containingType.Member("prototype").Member(constructor.GetMemberName());

            if (constructor.IsBuiltIn())
            {
                // If the constructor is built-in, then we don't want it invoked at all, since it's just a shim for the built-in
                // version.  Therefore, just call the types constructor passing in the arguments as usual for a normal JS new.
                return Js.New(containingType, arguments);
            }
            else
            {
                // Object creation gets transformed into:
                // new T(T.prototype.ctor, arg1, arg2, arg3...)
                return constructorReference.Member(SpecialNames.New).Invoke(arguments);
            }
        }
开发者ID:x335,项目名称:WootzJs,代码行数:17,代码来源:Idioms.cs

示例2: InvokeStatic

        public JsInvocationExpression InvokeStatic(IMethodSymbol method, params JsExpression[] args)
        {
            args = method.TypeArguments.Select(x => TypeAndResolve(x)).Concat(args).ToArray();

            JsExpression target;
            if (Equals(method.ContainingType, Context.Instance.SpecialFunctions))
                target = Js.Reference(method.GetMemberName());
            else
                target = Type(method.ContainingType).Member(method.GetMemberName());

            return target.Invoke(args);
        }
开发者ID:x335,项目名称:WootzJs,代码行数:12,代码来源:Idioms.cs

示例3: GetMethodFunction

 public JsExpression GetMethodFunction(IMethodSymbol method, bool forceUnconstructedScope = false)
 {
     // Handle type arguments in the containing type
     JsExpression typeReference = Type(method.ContainingType, forceUnconstructedScope);
     var target = method.IsStatic ? typeReference : typeReference.Member("prototype");
     return target.Member(method.GetMemberName());            
 }
开发者ID:x335,项目名称:WootzJs,代码行数:7,代码来源:Idioms.cs

示例4: Invoke

 public JsInvocationExpression Invoke(JsExpression target, IMethodSymbol method, params JsExpression[] arguments)
 {
     return target.Member(method.GetMemberName()).Invoke(arguments);
 }
开发者ID:x335,项目名称:WootzJs,代码行数:4,代码来源:Idioms.cs

示例5: InvokeMethodAs

 public JsInvocationExpression InvokeMethodAs(IMethodSymbol method, JsExpression @this, params JsExpression[] arguments)
 {
     var containingMember = Type(method.ContainingType);
     if (!method.IsStatic)
         containingMember = containingMember.Member("prototype");
     return containingMember.Member(method.GetMemberName()).Member("call")
         .Invoke(new[] { @this }.Concat(arguments).ToArray());
 }
开发者ID:x335,项目名称:WootzJs,代码行数:8,代码来源:Idioms.cs

示例6: CreateMethodInfo

        private JsExpression CreateMethodInfo(IMethodSymbol method, bool constructor = false)
        {
            JsExpression methodAttributes;
            switch (method.DeclaredAccessibility)
            {
                case Accessibility.Public:
                    methodAttributes = GetEnumValue(Context.Instance.MethodAttributesPublic);
                    break;
                case Accessibility.Internal:
                    methodAttributes = GetEnumValue(Context.Instance.MethodAttributesAssembly);
                    break;
                case Accessibility.Private:
                    methodAttributes = GetEnumValue(Context.Instance.MethodAttributesPrivate);
                    break;
                case Accessibility.Protected:
                    methodAttributes = GetEnumValue(Context.Instance.MethodAttributesFamily);
                    break;
                case Accessibility.ProtectedOrInternal:
                    methodAttributes = GetEnumValue(Context.Instance.MethodAttributesFamORAssem);
                    break;
                default:
                    throw new Exception();
            }
            if (method.IsStatic)
            {
                methodAttributes = EnumBitwise(SyntaxKind.BitwiseOrExpression, Context.Instance.MethodAttributes, 
                    methodAttributes, GetEnumValue(Context.Instance.MethodAttributesStatic));
            }

            var returnType = method.ReturnType;

            JsExpression info = constructor ?
                CreateObject(Context.Instance.ConstructorInfoConstructor,
                    Js.Primitive(method.GetMemberName()),
                    GetMethodFunction(method, true),
                    CreateParameterInfos(method.Parameters.ToArray()),
                    methodAttributes,
                    CreateAttributes(method)) :
                CreateObject(Context.Instance.MethodInfoConstructor,
                    Js.Primitive(method.MetadataName),
                    GetMethodFunction(method, true),
                    CreateParameterInfos(method.Parameters.ToArray()),
                    Type(returnType),
                    methodAttributes,
                    CreateAttributes(method));

            if (method.TypeParameters.Any())
            {
                var block = new JsBlockStatement();
                foreach (var typeParameter in method.TypeParameters)
                {
                    block.Local(
                        typeParameter.Name, 
                        Js.Reference(SpecialNames.DefineTypeParameter).Invoke(
                            Js.Reference(SpecialNames.Assembly),
                            Js.Primitive(typeParameter.Name), 
                            Type(typeParameter.BaseType ?? Context.Instance.ObjectType, true)));
                }
                block.Return(info);
                info = Wrap(block);
            }

            return info;
        }
开发者ID:x335,项目名称:WootzJs,代码行数:64,代码来源:Idioms.cs

示例7: MapInterfaceMethod

 public JsStatement MapInterfaceMethod(JsExpression assignee, IMethodSymbol interfaceMethod, JsExpression implementation)
 {
     return assignee.Member(interfaceMethod.GetMemberName()).Assign(implementation).Express();
 }
开发者ID:x335,项目名称:WootzJs,代码行数:4,代码来源:Idioms.cs

示例8: CreateInterfaceMethod

 public JsStatement CreateInterfaceMethod(IMethodSymbol method)
 {
     return Js.This().Member(method.GetMemberName()).Invoke(method.Parameters.Select(x => Js.Reference(JsNames.EscapeIfReservedWord(x.Name))).ToArray()).Return();
 }
开发者ID:MarkStega,项目名称:WootzJs,代码行数:4,代码来源:Idioms.cs


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