public static SourceUserDefinedConversionSymbol CreateUserDefinedConversionSymbol( SourceMemberContainerTypeSymbol containingType, Binder bodyBinder, ConversionOperatorDeclarationSyntax syntax, bool isNullableAnalysisEnabled, BindingDiagnosticBag diagnostics) { // Dev11 includes the explicit/implicit keyword, but we don't have a good way to include // Narrowing/Widening in VB and we want the languages to be consistent. var location = syntax.Type.Location; string name = OperatorFacts.OperatorNameFromDeclaration(syntax); if (name == WellKnownMemberNames.CheckedExplicitConversionName) { MessageID.IDS_FeatureCheckedUserDefinedOperators.CheckFeatureAvailability(diagnostics, syntax, syntax.CheckedKeyword.GetLocation()); } else if (syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword)) { diagnostics.Add(ErrorCode.ERR_ImplicitConversionOperatorCantBeChecked, syntax.CheckedKeyword.GetLocation()); } var interfaceSpecifier = syntax.ExplicitInterfaceSpecifier; TypeSymbol explicitInterfaceType; name = ExplicitInterfaceHelpers.GetMemberNameAndInterfaceSymbol(bodyBinder, interfaceSpecifier, name, diagnostics, out explicitInterfaceType, aliasQualifierOpt: out _); var methodKind = interfaceSpecifier == null ? MethodKind.Conversion : MethodKind.ExplicitInterfaceImplementation; return(new SourceUserDefinedConversionSymbol( methodKind, containingType, explicitInterfaceType, name, location, syntax, isNullableAnalysisEnabled, diagnostics)); }
public static SourceUserDefinedConversionSymbol CreateUserDefinedConversionSymbol( SourceMemberContainerTypeSymbol containingType, Binder bodyBinder, ConversionOperatorDeclarationSyntax syntax, bool isNullableAnalysisEnabled, BindingDiagnosticBag diagnostics) { // Dev11 includes the explicit/implicit keyword, but we don't have a good way to include // Narrowing/Widening in VB and we want the languages to be consistent. var location = syntax.Type.Location; string name = OperatorFacts.OperatorNameFromDeclaration(syntax); var interfaceSpecifier = syntax.ExplicitInterfaceSpecifier; TypeSymbol explicitInterfaceType; name = ExplicitInterfaceHelpers.GetMemberNameAndInterfaceSymbol(bodyBinder, interfaceSpecifier, name, diagnostics, out explicitInterfaceType, aliasQualifierOpt: out _); var methodKind = interfaceSpecifier == null ? MethodKind.Conversion : MethodKind.ExplicitInterfaceImplementation; return(new SourceUserDefinedConversionSymbol( methodKind, containingType, explicitInterfaceType, name, location, syntax, isNullableAnalysisEnabled, diagnostics)); }
public static SourceUserDefinedOperatorSymbol CreateUserDefinedOperatorSymbol( SourceMemberContainerTypeSymbol containingType, Binder bodyBinder, OperatorDeclarationSyntax syntax, bool isNullableAnalysisEnabled, BindingDiagnosticBag diagnostics) { var location = syntax.OperatorToken.GetLocation(); string name = OperatorFacts.OperatorNameFromDeclaration(syntax); if (SyntaxFacts.IsCheckedOperator(name)) { MessageID.IDS_FeatureCheckedUserDefinedOperators.CheckFeatureAvailability(diagnostics, syntax, syntax.CheckedKeyword.GetLocation()); } else if (!syntax.OperatorToken.IsMissing && syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword)) { diagnostics.Add(ErrorCode.ERR_OperatorCantBeChecked, syntax.CheckedKeyword.GetLocation(), SyntaxFacts.GetText(SyntaxFacts.GetOperatorKind(name))); } var interfaceSpecifier = syntax.ExplicitInterfaceSpecifier; TypeSymbol explicitInterfaceType; name = ExplicitInterfaceHelpers.GetMemberNameAndInterfaceSymbol(bodyBinder, interfaceSpecifier, name, diagnostics, out explicitInterfaceType, aliasQualifierOpt: out _); var methodKind = interfaceSpecifier == null ? MethodKind.UserDefinedOperator : MethodKind.ExplicitInterfaceImplementation; return(new SourceUserDefinedOperatorSymbol( methodKind, containingType, explicitInterfaceType, name, location, syntax, isNullableAnalysisEnabled, diagnostics)); }
public static SourceUserDefinedOperatorSymbol CreateUserDefinedOperatorSymbol( SourceMemberContainerTypeSymbol containingType, OperatorDeclarationSyntax syntax, DiagnosticBag diagnostics) { var location = syntax.OperatorToken.GetLocation(); string name = OperatorFacts.OperatorNameFromDeclaration(syntax); return(new SourceUserDefinedOperatorSymbol( containingType, name, location, syntax, diagnostics)); }
public static SourceUserDefinedOperatorSymbol CreateUserDefinedOperatorSymbol( // @MattWindsor91 (Concept-C# 2017) // See base class for comment on why this type has been relaxed. NamedTypeSymbol containingType, OperatorDeclarationSyntax syntax, DiagnosticBag diagnostics) { var location = syntax.OperatorToken.GetLocation(); string name = OperatorFacts.OperatorNameFromDeclaration(syntax); return(new SourceUserDefinedOperatorSymbol( containingType, name, location, syntax, diagnostics, syntax.Body == null && syntax.ExpressionBody != null)); }
public static SourceUserDefinedOperatorSymbol CreateUserDefinedOperatorSymbol( SourceMemberContainerTypeSymbol containingType, Binder bodyBinder, OperatorDeclarationSyntax syntax, bool isNullableAnalysisEnabled, BindingDiagnosticBag diagnostics) { var location = syntax.OperatorToken.GetLocation(); string name = OperatorFacts.OperatorNameFromDeclaration(syntax); var interfaceSpecifier = syntax.ExplicitInterfaceSpecifier; TypeSymbol explicitInterfaceType; name = ExplicitInterfaceHelpers.GetMemberNameAndInterfaceSymbol(bodyBinder, interfaceSpecifier, name, diagnostics, out explicitInterfaceType, aliasQualifierOpt: out _); var methodKind = interfaceSpecifier == null ? MethodKind.UserDefinedOperator : MethodKind.ExplicitInterfaceImplementation; return(new SourceUserDefinedOperatorSymbol( methodKind, containingType, explicitInterfaceType, name, location, syntax, isNullableAnalysisEnabled, diagnostics)); }