コード例 #1
0
            protected override ReadOnlyArray<ParameterSymbol> MakeParameters(
                Binder binder,
                DelegateDeclarationSyntax syntax,
                DiagnosticBag diagnostics)
            {
                var delegateBinder = binder as DelegateBinder;
                var parameters = ArrayBuilder<ParameterSymbol>.GetInstance();
                int ordinal = 0;
                foreach (SourceParameterSymbol p in delegateBinder.invoke.Parameters)
                {
                    if (p.RefKind != RefKind.None)
                    {
                        var synthesizedParam = new SourceClonedParameterSymbol(originalParam: p, newOwner: this, newOrdinal: ordinal++, suppressOptional: true);
                        parameters.Add(synthesizedParam);
                    }
                }

                parameters.Add(new SynthesizedParameterSymbol(this, binder.GetSpecialType(SpecialType.System_IAsyncResult, diagnostics, syntax), ordinal++, RefKind.None, "result"));
                return parameters.ToReadOnlyAndFree();
            }
コード例 #2
0
            protected override ReadOnlyArray<ParameterSymbol> MakeParameters(
                Binder binder,
                DelegateDeclarationSyntax syntax,
                DiagnosticBag diagnostics)
            {
                var delegateBinder = binder as DelegateBinder;
                var parameters = ArrayBuilder<ParameterSymbol>.GetInstance();
                foreach (SourceParameterSymbol p in delegateBinder.invoke.Parameters)
                {
                    var synthesizedParam = new SourceClonedParameterSymbol(originalParam: p, newOwner: this, newOrdinal: p.Ordinal, suppressOptional: true);
                    parameters.Add(synthesizedParam);
                }

                int paramCount = delegateBinder.invoke.Parameters.Count;
                parameters.Add(new SynthesizedParameterSymbol(this, binder.GetSpecialType(SpecialType.System_AsyncCallback, diagnostics, syntax), paramCount, RefKind.None, "callback"));
                parameters.Add(new SynthesizedParameterSymbol(this, binder.GetSpecialType(SpecialType.System_Object, diagnostics, syntax), paramCount + 1, RefKind.None, "object"));

                return parameters.ToReadOnlyAndFree();
            }