コード例 #1
0
        // NOTE: no need to call WithUnsafeRegionIfNecessary, since the signature
        // is bound lazily using binders from a BinderFactory (which will already include an
        // UnsafeBinder, if necessary).
        private SourceUserDefinedConversionSymbol(
            SourceMemberContainerTypeSymbol containingType,
            string name,
            Location location,
            ConversionOperatorDeclarationSyntax syntax,
            DiagnosticBag diagnostics,
            bool isExpressionBodied) :
            base(
                MethodKind.Conversion,
                name,
                containingType,
                location,
                syntax.GetReference(),
                syntax.Body?.GetReference() ?? syntax.ExpressionBody?.GetReference(),
                syntax.Modifiers,
                diagnostics,
                isExpressionBodied)
        {
            CheckForBlockAndExpressionBody(
                syntax.Body, syntax.ExpressionBody, syntax, diagnostics);

            if (syntax.ParameterList.Parameters.Count != 1)
            {
                diagnostics.Add(ErrorCode.ERR_OvlUnaryOperatorExpected, syntax.ParameterList.GetLocation());
            }
        }
コード例 #2
0
 // NOTE: no need to call WithUnsafeRegionIfNecessary, since the signature
 // is bound lazily using binders from a BinderFactory (which will already include an
 // UnsafeBinder, if necessary).
 private SourceUserDefinedConversionSymbol(
     SourceMemberContainerTypeSymbol containingType,
     string name,
     Location location,
     ConversionOperatorDeclarationSyntax syntax,
     DiagnosticBag diagnostics) :
     base(
         MethodKind.Conversion,
         name,
         containingType,
         location,
         syntax.GetReference(),
         syntax.Body.GetReferenceOrNull(),
         syntax.Modifiers,
         diagnostics)
 {
 }
コード例 #3
0
 // NOTE: no need to call WithUnsafeRegionIfNecessary, since the signature
 // is bound lazily using binders from a BinderFactory (which will already include an
 // UnsafeBinder, if necessary).
 private SourceUserDefinedConversionSymbol(
     SourceMemberContainerTypeSymbol containingType,
     string name,
     Location location,
     ConversionOperatorDeclarationSyntax syntax,
     DiagnosticBag diagnostics) :
     base(
         MethodKind.Conversion,
         name,
         containingType,
         location,
         syntax.GetReference(),
         syntax.Body.GetReferenceOrNull(),
         syntax.Modifiers,
         diagnostics)
 {
 }