Esempio n. 1
0
        private void ComputeParameters()
        {
            if (_lazyParametersAndDiagnostics != null)
            {
                return;
            }

            var         diagnostics = DiagnosticBag.GetInstance();
            SyntaxToken arglistToken;

            foreach (var param in _syntax.ParameterList.Parameters)
            {
                ReportAnyAttributes(diagnostics, param.AttributeLists);
            }

            var parameters = ParameterHelpers.MakeParameters(
                _binder,
                this,
                _syntax.ParameterList,
                arglistToken: out arglistToken,
                diagnostics: diagnostics,
                allowRefOrOut: true,
                allowThis: true,
                beStrict: true);

            var isVararg = (arglistToken.Kind() == SyntaxKind.ArgListKeyword);

            if (IsAsync && diagnostics.IsEmptyWithoutResolution)
            {
                SourceMemberMethodSymbol.ReportAsyncParameterErrors(parameters, diagnostics, this.Locations[0]);
            }
            var value = new ParametersAndDiagnostics(parameters, isVararg, diagnostics.ToReadOnlyAndFree());

            Interlocked.CompareExchange(ref _lazyParametersAndDiagnostics, value, null);
        }
Esempio n. 2
0
        private void ComputeParameters()
        {
            if (!_parameters.IsDefault)
            {
                return;
            }
            var         diagnostics = DiagnosticBag.GetInstance();
            SyntaxToken arglistToken;

            _parameters = ParameterHelpers.MakeParameters(_binder, this, _syntax.ParameterList, true, out arglistToken, diagnostics, true);
            _isVararg   = (arglistToken.Kind() == SyntaxKind.ArgListKeyword);
            if (diagnostics.IsEmptyWithoutResolution)
            {
                SourceMemberMethodSymbol.ReportAsyncParameterErrors(this, diagnostics, this.Locations[0]);
            }
            AddDiagnostics(diagnostics.ToReadOnlyAndFree());
        }
Esempio n. 3
0
        private void ComputeParameters()
        {
            if (_lazyParameters != null)
            {
                return;
            }

            SyntaxToken arglistToken;
            var         diagnostics = DiagnosticBag.GetInstance();

            var parameters = ParameterHelpers.MakeParameters(
                _binder,
                this,
                _syntax.ParameterList,
                arglistToken: out arglistToken,
                allowRefOrOut: true,
                allowThis: true,
                diagnostics: diagnostics);

            var isVararg = arglistToken.Kind() == SyntaxKind.ArgListKeyword;

            if (isVararg)
            {
                diagnostics.Add(ErrorCode.ERR_IllegalVarArgs, arglistToken.GetLocation());
            }

            if (IsAsync)
            {
                SourceMemberMethodSymbol.ReportAsyncParameterErrors(parameters, diagnostics, this.Locations[0]);
            }

            lock (_declarationDiagnostics)
            {
                if (_lazyParameters != null)
                {
                    diagnostics.Free();
                    return;
                }

                _declarationDiagnostics.AddRangeAndFree(diagnostics);
                _lazyIsVarArg   = isVararg;
                _lazyParameters = parameters;
            }
        }