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


C# Symbols.ParameterSymbol类代码示例

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


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

示例1: SubstitutedParameterSymbol

 private SubstitutedParameterSymbol(Symbol containingSymbol, TypeMap map, ParameterSymbol originalParameter) :
     base(originalParameter)
 {
     Debug.Assert(originalParameter.IsDefinition);
     _containingSymbol = containingSymbol;
     _mapOrType = map;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:7,代码来源:SubstitutedParameterSymbol.cs

示例2: DisplayClassInstanceFromParameter

 internal DisplayClassInstanceFromParameter(ParameterSymbol parameter)
 {
     Debug.Assert((object)parameter != null);
     Debug.Assert(parameter.Name.EndsWith("this", StringComparison.Ordinal) ||
         GeneratedNames.GetKind(parameter.Name) == GeneratedNameKind.TransparentIdentifier);
     this.Parameter = parameter;
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:DisplayClassInstance.cs

示例3: Rewrite

 internal static BoundNode Rewrite(
     ParameterSymbol targetMethodThisParameter,
     Conversions conversions,
     ImmutableDictionary<string, DisplayClassVariable> displayClassVariables,
     BoundNode node,
     DiagnosticBag diagnostics)
 {
     var rewriter = new CapturedVariableRewriter(targetMethodThisParameter, conversions, displayClassVariables, diagnostics);
     return rewriter.Visit(node);
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:10,代码来源:CapturedVariableRewriter.cs

示例4: CapturedVariableRewriter

 private CapturedVariableRewriter(
     ParameterSymbol targetMethodThisParameter,
     Conversions conversions,
     ImmutableDictionary<string, DisplayClassVariable> displayClassVariables,
     DiagnosticBag diagnostics)
 {
     _targetMethodThisParameter = targetMethodThisParameter;
     _conversions = conversions;
     _displayClassVariables = displayClassVariables;
     _diagnostics = diagnostics;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:11,代码来源:CapturedVariableRewriter.cs

示例5: TryGetThisParameter

        internal override bool TryGetThisParameter(out ParameterSymbol thisParameter)
        {
            Debug.Assert(!IsStatic);

            if ((object)_lazyThisParameter == null)
            {
                Interlocked.CompareExchange(ref _lazyThisParameter, new ThisParameterSymbol(this), null);
            }

            thisParameter = _lazyThisParameter;
            return true;
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:12,代码来源:SynthesizedInstanceMethodSymbol.cs

示例6: TryGetThisParameter

        internal override bool TryGetThisParameter(out ParameterSymbol thisParameter)
        {
            if (IsStatic)
            {
                thisParameter = null;
                return true;
            }

            if ((object)lazyThisParameter == null)
            {
                Interlocked.CompareExchange(ref lazyThisParameter, new ThisParameterSymbol(this), null);
            }

            thisParameter = lazyThisParameter;
            return true;
        }
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:16,代码来源:SynthesizedInstanceMethodSymbol.cs

示例7: AnonymousTypeConstructorSymbol

 internal AnonymousTypeConstructorSymbol(NamedTypeSymbol container, ImmutableArray<AnonymousTypePropertySymbol> properties)
     : base(container, WellKnownMemberNames.InstanceConstructorName)
 {
     // Create constructor parameters
     int fieldsCount = properties.Length;
     if (fieldsCount > 0)
     {
         ParameterSymbol[] paramsArr = new ParameterSymbol[fieldsCount];
         for (int index = 0; index < fieldsCount; index++)
         {
             PropertySymbol property = properties[index];
             paramsArr[index] = new SynthesizedParameterSymbol(this, property.Type, index, RefKind.None, property.Name);
         }
         _parameters = paramsArr.AsImmutableOrNull();
     }
     else
     {
         _parameters = ImmutableArray<ParameterSymbol>.Empty;
     }
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:20,代码来源:AnonymousType.ConstructorSymbol.cs

示例8: VerifyParamArrayAttribute

        internal static void VerifyParamArrayAttribute(ParameterSymbol parameter, SourceModuleSymbol module, bool expected = true, OutputKind outputKind = OutputKind.ConsoleApplication)
        {
            Assert.Equal(expected, parameter.IsParams);

            var emitModule = new PEAssemblyBuilder(module.ContainingSourceAssembly, null, outputKind, GetDefaultModulePropertiesForSerialization(), SpecializedCollections.EmptyEnumerable<ResourceDescription>());
            var paramArrayAttributeCtor = (MethodSymbol)emitModule.Compilation.GetWellKnownTypeMember(WellKnownMember.System_ParamArrayAttribute__ctor);
            bool found = false;

            var context = new EmitContext(emitModule, null, new DiagnosticBag());

            foreach (Microsoft.Cci.ICustomAttribute attr in parameter.GetSynthesizedAttributes())
            {
                if (paramArrayAttributeCtor == (MethodSymbol)attr.Constructor(context))
                {
                    Assert.False(found, "Multiple ParamArrayAttribute");
                    found = true;
                }
            }

            Assert.Equal(expected, found);
            context.Diagnostics.Verify();
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:22,代码来源:WellKnownAttributesTestBase.cs

示例9: RetargetParameters

        private ImmutableArray<ParameterSymbol> RetargetParameters()
        {
            var list = this.underlyingMethod.Parameters;
            int count = list.Length;

            if (count == 0)
            {
                return ImmutableArray<ParameterSymbol>.Empty;
            }
            else
            {
                ParameterSymbol[] parameters = new ParameterSymbol[count];

                for (int i = 0; i < count; i++)
                {
                    parameters[i] = new RetargetingMethodParameterSymbol(this, list[i]);
                }

                return parameters.AsImmutableOrNull();
            }
        }
开发者ID:riversky,项目名称:roslyn,代码行数:21,代码来源:RetargetingMethodSymbol.cs

示例10: EnterParameter

 protected override void EnterParameter(ParameterSymbol parameter)
 {
     // parameters are NOT intitially assigned here - if that is a problem, then
     // the parameters must be captured.
     GetOrCreateSlot(parameter);
 }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:6,代码来源:IteratorAndAsyncCaptureWalker.cs

示例11: CanBeOptional

        private static bool CanBeOptional(ParameterSymbol parameter, bool isMethodGroupConversion)
        {
            // NOTE: Section 6.6 will be slightly updated:
            //
            //   - The candidate methods considered are only those methods that are applicable in their
            //     normal form (§7.5.3.1), and do not omit any optional parameters. Thus, candidate methods
            //     are ignored if they are applicable only in their expanded form, or if one or more of their
            //     optional parameters do not have a corresponding parameter in the targeted delegate type.
            //   
            // Therefore, no parameters are optional when performing method group conversion.  Alternatively,
            // we could eliminate methods based on the number of arguments, but then we wouldn't be able to
            // fall back on them if no other candidates were available.

            var refKind = parameter.RefKind;
            return !isMethodGroupConversion && parameter.IsOptional &&
                (refKind == RefKind.None ||
                 (refKind == RefKind.Ref && parameter.ContainingSymbol.ContainingType.IsComImport));
        }
开发者ID:GeertVL,项目名称:roslyn,代码行数:18,代码来源:OverloadResolution_ArgsToParameters.cs

示例12: CopyParameter

 private static ParameterSymbol CopyParameter(ParameterSymbol parameter, MethodSymbol owner)
 {
     return new SynthesizedParameterSymbol(
         owner,
         parameter.Type,
         parameter.Ordinal,
         parameter.RefKind,
         GeneratedNames.LambdaCopyParameterName(parameter)); // Make sure nothing binds to this.
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:9,代码来源:LambdaSymbol.cs

示例13: ReportUnassignedOutParameter

 protected override void ReportUnassignedOutParameter(ParameterSymbol parameter, CSharpSyntaxNode node, Location location)
 {
     if (!dataFlowsOut.Contains(parameter) && (node == null || node is ReturnStatementSyntax))
     {
         dataFlowsOut.Add(parameter);
     }
     base.ReportUnassignedOutParameter(parameter, node, location);
 }
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:8,代码来源:DataFlowsOutWalker.cs

示例14: ParameterTypeInformation

        public ParameterTypeInformation(ParameterSymbol underlyingParameter)
        {
            Debug.Assert((object)underlyingParameter != null);

            this.UnderlyingParameter = underlyingParameter;
        }
开发者ID:pheede,项目名称:roslyn,代码行数:6,代码来源:ParameterTypeInformation.cs

示例15: GetParamArrayArgument

        private static TypedConstant GetParamArrayArgument(ParameterSymbol parameter, ImmutableArray<TypedConstant> constructorArgsArray, int argumentsCount, int argsConsumedCount, Conversions conversions)
        {
            Debug.Assert(argsConsumedCount <= argumentsCount);

            int paramArrayArgCount = argumentsCount - argsConsumedCount;
            if (paramArrayArgCount == 0)
            {
                return new TypedConstant(parameter.Type, ImmutableArray<TypedConstant>.Empty);
            }

            // If there's exactly one argument and it's an array of an appropriate type, then just return it.
            if (paramArrayArgCount == 1 && constructorArgsArray[argsConsumedCount].Kind == TypedConstantKind.Array)
            {
                TypeSymbol argumentType = (TypeSymbol)constructorArgsArray[argsConsumedCount].Type;

                // Easy out (i.e. don't both classifying conversion).
                if (argumentType == parameter.Type)
                {
                    return constructorArgsArray[argsConsumedCount];
                }

                HashSet<DiagnosticInfo> useSiteDiagnostics = null; // ignoring, since already bound argument and parameter
                Conversion conversion = conversions.ClassifyConversion(argumentType, parameter.Type, ref useSiteDiagnostics, builtinOnly: true);

                // NOTE: Won't always succeed, even though we've performed overload resolution.
                // For example, passing int[] to params object[] actually treats the int[] as an element of the object[].
                if (conversion.IsValid && conversion.Kind == ConversionKind.ImplicitReference)
                {
                    return constructorArgsArray[argsConsumedCount];
                }
            }

            Debug.Assert(!constructorArgsArray.IsDefault);
            Debug.Assert(argsConsumedCount <= constructorArgsArray.Length);

            var values = new TypedConstant[paramArrayArgCount];

            for (int i = 0; i < paramArrayArgCount; i++)
            {
                values[i] = constructorArgsArray[argsConsumedCount++];
            }

            return new TypedConstant(parameter.Type, values.AsImmutableOrNull());
        }
开发者ID:RoryVL,项目名称:roslyn,代码行数:44,代码来源:Binder_Attributes.cs


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