4 instantiations of TypedConstant
Microsoft.CodeAnalysis (4)
MetadataReader\MetadataDecoder.cs (4)
2146return new TypedConstant(type, TypedConstantKind.Error, null); 2150return new TypedConstant(type, array); 2157return new TypedConstant(type, TypedConstantKind.Error, null); 2160return new TypedConstant(type, kind, value);
501 references to TypedConstant
ConfigurationSchemaGenerator (3)
ConfigSchemaGenerator.cs (3)
64ImmutableArray<TypedConstant> args = attribute.ConstructorArguments; 79var exclusionPathsArg = args[2]; 87ImmutableArray<TypedConstant> args = attribute.ConstructorArguments;
ILLink.RoslynAnalyzer (3)
COMAnalyzer.cs (1)
63 marshalAsAttribute.ConstructorArguments.Length >= 1 && marshalAsAttribute.ConstructorArguments[0] is TypedConstant typedConstant &&
DataFlow\LocalDataFlowVisitor.cs (1)
761 var attributeArgument = attributeData.ConstructorArguments[0];
ISymbolExtensions.cs (1)
84 if (featureGuardAttribute.ConstructorArguments is [TypedConstant { Value: INamedTypeSymbol featureType }])
Microsoft.Analyzers.Extra (3)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (3)
238private static TypedConstant? GetLogMethodAttributeParameter( 240ImmutableArray<TypedConstant> constructorArguments, 247foreach (var ctorArg in constructorArguments)
Microsoft.AspNetCore.App.Analyzers (3)
RouteEmbeddedLanguage\Infrastructure\RoutePatternParametersDetector.cs (1)
55var routeParameterNameConstant = namedArgument.Value;
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (1)
357var argument = attribute.ConstructorArguments[0];
src\Shared\RoslynUtils\SymbolExtensions.cs (1)
210var routeParameterNameConstant = namedArgument.Value;
Microsoft.AspNetCore.Http.RequestDelegateGenerator (2)
src\Shared\RoslynUtils\SymbolExtensions.cs (1)
210var routeParameterNameConstant = namedArgument.Value;
StaticRouteHandlerModel\EndpointParameter.cs (1)
158var constructorArgument = keyedServicesAttribute.ConstructorArguments.FirstOrDefault();
Microsoft.AspNetCore.Mvc.Analyzers (2)
TopLevelParameterNameAnalyzer.cs (2)
162var namedArgumentValue = namedArgument.Value; 185var namedArgumentValue = namedArgument.Value;
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
SymbolApiResponseMetadataProvider.cs (2)
192var namedArgumentValue = namedArgument.Value; 219var argument = attribute.ConstructorArguments[i];
Microsoft.CodeAnalysis (63)
Emit\NoPia\CommonEmbeddedParameter.cs (2)
93ImmutableArray<TypedConstant> constructorArguments; 94ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments;
Emit\NoPia\CommonEmbeddedType.cs (2)
111ImmutableArray<TypedConstant> constructorArguments; 112ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments;
Emit\NoPia\EmbeddedTypesManager.cs (4)
159internal abstract TAttributeData CreateSynthesizedAttribute(WellKnownMember constructor, ImmutableArray<TypedConstant> constructorArguments, ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments, TSyntaxNode syntaxNodeOpt, DiagnosticBag diagnostics); 160internal abstract bool TryGetAttributeArguments(TAttributeData attrData, out ImmutableArray<TypedConstant> constructorArguments, out ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments, TSyntaxNode syntaxNodeOpt, DiagnosticBag diagnostics);
MetadataReader\MetadataDecoder.cs (23)
108(KeyValuePair<string, TypedConstant> nameValuePair, bool isProperty, SerializationTypeCode typeCode, SerializationTypeCode elementTypeCode) DecodeCustomAttributeNamedArgumentOrThrow(ref BlobReader argReader); 1402private TypedConstant DecodeCustomAttributeFixedArgumentOrThrow(ITypeSymbolInternal type, ref BlobReader argReader) 1437private TypedConstant DecodeCustomAttributeElementOrThrow(ref BlobReader argReader, SerializationTypeCode typeCode, TypeSymbol type) 1457private TypedConstant DecodeCustomAttributeElementArrayOrThrow(ref BlobReader argReader, SerializationTypeCode elementTypeCode, TypeSymbol elementType, TypeSymbol arrayType) 1460TypedConstant[] values; 1468values = Array.Empty<TypedConstant>(); 1472values = new TypedConstant[count]; 1484private TypedConstant DecodeCustomAttributePrimitiveElementOrThrow(ref BlobReader argReader, SerializationTypeCode typeCode, TypeSymbol type) 1554public (KeyValuePair<string, TypedConstant> nameValuePair, bool isProperty, SerializationTypeCode typeCode, SerializationTypeCode elementTypeCode) DecodeCustomAttributeNamedArgumentOrThrow(ref BlobReader argReader) 1577TypedConstant value = typeCode == SerializationTypeCode.SZArray 1581return (new KeyValuePair<string, TypedConstant>(name, value), kind == CustomAttributeNamedArgumentKind.Property, typeCode, elementTypeCode); 1622out TypedConstant[] positionalArgs, 1623out KeyValuePair<string, TypedConstant>[] namedArgs) 1627positionalArgs = Array.Empty<TypedConstant>(); 1628namedArgs = Array.Empty<KeyValuePair<string, TypedConstant>>(); 1649positionalArgs = new TypedConstant[paramCount]; 1662namedArgs = new KeyValuePair<string, TypedConstant>[namedParamCount]; 1674positionalArgs = Array.Empty<TypedConstant>(); 1675namedArgs = Array.Empty<KeyValuePair<String, TypedConstant>>(); 2142private static TypedConstant CreateArrayTypedConstant(TypeSymbol type, ImmutableArray<TypedConstant> array) 2153private static TypedConstant CreateTypedConstant(TypeSymbol type, TypedConstantKind kind, object value) 2163private static TypedConstant CreateTypedConstant(TypeSymbol type, TypedConstantKind kind, bool value)
MetadataReader\PEModule.cs (3)
1359(KeyValuePair<string, TypedConstant> nameValuePair, bool isProperty, SerializationTypeCode typeCode, SerializationTypeCode elementTypeCode) namedArgValues = 1392Func<string, TypedConstant, bool, (bool IsCallConvs, ImmutableHashSet<INamedTypeSymbolInternal>? CallConvs)> unmanagedCallersOnlyDecoder) 1517(KeyValuePair<string, TypedConstant> nameValuePair, bool isProperty, SerializationTypeCode typeCode, SerializationTypeCode elementTypeCode) namedArgValues =
Symbols\Attributes\CommonAttributeData.cs (10)
42public ImmutableArray<TypedConstant> ConstructorArguments { get { return CommonConstructorArguments; } } 43protected internal abstract ImmutableArray<TypedConstant> CommonConstructorArguments { get; } 48public ImmutableArray<KeyValuePair<string, TypedConstant>> NamedArguments { get { return CommonNamedArguments; } } 49protected internal abstract ImmutableArray<KeyValuePair<string, TypedConstant>> CommonNamedArguments { get; } 170private static T? DecodeNamedArgument<T>(ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments, string name, SpecialType specialType, T? defaultValue = default) 176private static int IndexOfNamedArgument(ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments, string name) 205ImmutableArray<TypedConstant> args = this.CommonConstructorArguments; 305ImmutableArray<TypedConstant> args = this.CommonConstructorArguments; 555internal static AttributeUsageInfo DecodeAttributeUsageAttribute(TypedConstant positionalArg, ImmutableArray<KeyValuePair<string, TypedConstant>> namedArgs)
Symbols\Attributes\CommonAttributeDataComparer.cs (3)
52private static int GetHashCodeForConstructorArguments(ImmutableArray<TypedConstant> constructorArguments) 56foreach (var arg in constructorArguments) 64private static int GetHashCodeForNamedArguments(ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments)
Symbols\Attributes\UnmanagedCallersOnlyAttributeData.cs (1)
33internal static bool IsCallConvsTypedConstant(string key, bool isField, in TypedConstant value)
Symbols\TypedConstant.cs (9)
17public readonly struct TypedConstant : IEquatable<TypedConstant> 25Debug.Assert(kind == TypedConstantKind.Array || !(value is ImmutableArray<TypedConstant>)); 34internal TypedConstant(ITypeSymbolInternal type, ImmutableArray<TypedConstant> array) 107/// The value for a <see cref="TypedConstant"/> array. 111public ImmutableArray<TypedConstant> Values 125return (ImmutableArray<TypedConstant>)_value!; 202return obj is TypedConstant && Equals((TypedConstant)obj); 205public bool Equals(TypedConstant other)
Symbols\TypedConstantValue.cs (6)
15/// Represents a simple value or a read-only array of <see cref="TypedConstant"/>. 29internal TypedConstantValue(ImmutableArray<TypedConstant> array) 45public ImmutableArray<TypedConstant> Array 49return _value == null ? default(ImmutableArray<TypedConstant>) : (ImmutableArray<TypedConstant>)_value; 57Debug.Assert(!(_value is ImmutableArray<TypedConstant>));
Microsoft.CodeAnalysis.CodeStyle.Fixes (8)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (2)
409ImmutableArray<TypedConstant> constructorArguments = default, 410ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments = default)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAttributeData.cs (6)
14ImmutableArray<TypedConstant> constructorArguments, 15ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments) : AttributeData 17private readonly ImmutableArray<TypedConstant> _constructorArguments = constructorArguments.NullToEmpty(); 18private readonly ImmutableArray<KeyValuePair<string, TypedConstant>> _namedArguments = namedArguments.NullToEmpty(); 22protected override ImmutableArray<TypedConstant> CommonConstructorArguments => _constructorArguments; 23protected override ImmutableArray<KeyValuePair<string, TypedConstant>> CommonNamedArguments => _namedArguments;
Microsoft.CodeAnalysis.CSharp (182)
Binder\Binder_Attributes.cs (30)
311ImmutableArray<TypedConstant> rewrittenArguments; 696private ImmutableArray<TypedConstant> GetRewrittenAttributeConstructorArguments( 698ImmutableArray<TypedConstant> constructorArgsArray, 713var reorderedArguments = new TypedConstant[parameterCount]; 719TypedConstant reorderedArgument = constructorArgsArray[i]; 761public ImmutableArray<TypedConstant> VisitArguments(ImmutableArray<BoundExpression> arguments, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool parentHasErrors = false) 763var validatedArguments = ImmutableArray<TypedConstant>.Empty; 768var builder = ArrayBuilder<TypedConstant>.GetInstance(numArguments); 782public ImmutableArray<KeyValuePair<string, TypedConstant>> VisitNamedArguments(ImmutableArray<BoundAssignmentOperator> arguments, BindingDiagnosticBag diagnostics, ref bool attrHasErrors) 784ArrayBuilder<KeyValuePair<string, TypedConstant>>? builder = null; 793builder = ArrayBuilder<KeyValuePair<string, TypedConstant>>.GetInstance(); 802return ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty; 808private KeyValuePair<String, TypedConstant>? VisitNamedArgument(BoundAssignmentOperator assignment, BindingDiagnosticBag diagnostics, ref bool attrHasErrors) 810KeyValuePair<String, TypedConstant>? visitedArgument = null; 816visitedArgument = new KeyValuePair<String, TypedConstant>(fa.FieldSymbol.Name, VisitExpression(assignment.Right, diagnostics, ref attrHasErrors, assignment.HasAnyErrors)); 821visitedArgument = new KeyValuePair<String, TypedConstant>(pa.PropertySymbol.Name, VisitExpression(assignment.Right, diagnostics, ref attrHasErrors, assignment.HasAnyErrors)); 835private TypedConstant VisitExpression(BoundExpression node, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors) 845private TypedConstant VisitExpression(BoundExpression node, TypedConstantKind typedConstantKind, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors) 875private TypedConstant VisitArrayCollectionExpression(TypeSymbol type, BoundCollectionExpression collection, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors) 879var builder = ArrayBuilder<TypedConstant>.GetInstance(elements.Length); 887private TypedConstant VisitCollectionExpressionElement(BoundNode node, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors) 898private TypedConstant VisitConversion(BoundConversion node, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors) 935private static TypedConstant VisitTypeOfExpression(BoundTypeOfOperator node, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors) 971private TypedConstant VisitArrayCreation(BoundArrayCreation node, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors) 984ImmutableArray<TypedConstant> initializer; 989initializer = ImmutableArray<TypedConstant>.Empty; 995initializer = ImmutableArray<TypedConstant>.Empty; 1012private static TypedConstant CreateTypedConstant(BoundExpression node, TypedConstantKind typedConstantKind, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors, 1013object? simpleValue = null, ImmutableArray<TypedConstant> arrayValue = default(ImmutableArray<TypedConstant>))
Compiler\ClsComplianceChecker.cs (3)
603foreach (TypedConstant argument in attribute.ConstructorArguments) 620TypedConstant argument = pair.Value; 1208ImmutableArray<TypedConstant> args = data.CommonConstructorArguments;
Emitter\Model\AttributeDataAdapter.cs (5)
28foreach (var argument in commonArgs) 99private Cci.IMetadataExpression CreateMetadataExpression(TypedConstant argument, EmitContext context) 119private MetadataCreateArray CreateMetadataArray(TypedConstant argument, EmitContext context) 143private static MetadataTypeOf CreateType(TypedConstant argument, EmitContext context) 159private Cci.IMetadataNamedArgument CreateMetadataNamedArgument(string name, TypedConstant argument, EmitContext context)
Emitter\Model\PEAssemblyBuilder.cs (24)
203ImmutableArray<TypedConstant>.Empty, 204ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 207internal override SynthesizedAttributeData SynthesizeNullableAttribute(WellKnownMember member, ImmutableArray<TypedConstant> arguments) 216ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 222internal override SynthesizedAttributeData SynthesizeNullableContextAttribute(ImmutableArray<TypedConstant> arguments) 230ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 236internal override SynthesizedAttributeData SynthesizeNullablePublicOnlyAttribute(ImmutableArray<TypedConstant> arguments) 244ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 250internal override SynthesizedAttributeData SynthesizeNativeIntegerAttribute(WellKnownMember member, ImmutableArray<TypedConstant> arguments) 259ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 272ImmutableArray<TypedConstant>.Empty, 273ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 279internal override SynthesizedAttributeData SynthesizeRefSafetyRulesAttribute(ImmutableArray<TypedConstant> arguments) 287ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 300ImmutableArray<TypedConstant>.Empty, 301ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 314ImmutableArray<TypedConstant>.Empty, 315ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 328ImmutableArray<TypedConstant>.Empty, 329ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 342ImmutableArray<TypedConstant>.Empty, 343ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 356ImmutableArray<TypedConstant>.Empty, 357ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty);
Emitter\Model\PEModuleBuilder.cs (6)
1605internal virtual SynthesizedAttributeData SynthesizeNullableAttribute(WellKnownMember member, ImmutableArray<TypedConstant> arguments) 1625internal virtual SynthesizedAttributeData SynthesizeNullableContextAttribute(ImmutableArray<TypedConstant> arguments) 1658attribute = SynthesizeNativeIntegerAttribute(WellKnownMember.System_Runtime_CompilerServices_NativeIntegerAttribute__ctor, ImmutableArray<TypedConstant>.Empty); 1674internal virtual SynthesizedAttributeData SynthesizeNativeIntegerAttribute(WellKnownMember member, ImmutableArray<TypedConstant> arguments) 1705internal virtual SynthesizedAttributeData SynthesizeRefSafetyRulesAttribute(ImmutableArray<TypedConstant> arguments) 1719internal virtual SynthesizedAttributeData SynthesizeNullablePublicOnlyAttribute(ImmutableArray<TypedConstant> arguments)
Emitter\NoPia\EmbeddedType.cs (3)
263return SynthesizedAttributeData.Create(TypeManager.ModuleBeingBuilt.Compilation, ctor, ImmutableArray<TypedConstant>.Empty, ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 283ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty);
Emitter\NoPia\EmbeddedTypesManager.cs (7)
124internal override CSharpAttributeData CreateSynthesizedAttribute(WellKnownMember constructor, ImmutableArray<TypedConstant> constructorArguments, ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments, SyntaxNode syntaxNodeOpt, DiagnosticBag diagnostics) 139ImmutableArray.Create<TypedConstant>(constructorArguments[0], constructorArguments[0]), 140ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 149ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 156internal override bool TryGetAttributeArguments(CSharpAttributeData attrData, out ImmutableArray<TypedConstant> constructorArguments, out ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments, SyntaxNode syntaxNodeOpt, DiagnosticBag diagnostics)
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.TemplateSymbol.cs (1)
221namedArguments: ImmutableArray.Create(new KeyValuePair<WellKnownMember, TypedConstant>(
Symbols\Attributes\AttributeData.cs (8)
55public new IEnumerable<TypedConstant> ConstructorArguments 63public new IEnumerable<KeyValuePair<string, TypedConstant>> NamedArguments 154foreach (var constructorArgument in this.CommonConstructorArguments) 368TypedConstant firstArg = ctorArgs.First(); 382private DeclarativeSecurityAction DecodeSecurityAction(TypedConstant typedValue, Symbol targetSymbol, AttributeSyntax? nodeOpt, BindingDiagnosticBag diagnostics, out bool hasErrors) 470private static Location GetSecurityAttributeActionSyntaxLocation(AttributeSyntax? nodeOpt, TypedConstant typedValue, out object displayString) 576TypedConstant ctorArgument = this.CommonConstructorArguments[0]; 601TypedConstant ctorArgument = this.CommonConstructorArguments[0];
Symbols\Attributes\PEAttributeData.cs (8)
23private ImmutableArray<TypedConstant> _lazyConstructorArguments; 24private ImmutableArray<KeyValuePair<string, TypedConstant>> _lazyNamedArguments; 56protected internal override ImmutableArray<TypedConstant> CommonConstructorArguments 65protected internal override ImmutableArray<KeyValuePair<string, TypedConstant>> CommonNamedArguments 102TypedConstant[]? lazyConstructorArguments = null; 103KeyValuePair<string, TypedConstant>[]? lazyNamedArguments = null; 113ImmutableArray.Create<TypedConstant>(lazyConstructorArguments)); 116ImmutableArray.Create<KeyValuePair<string, TypedConstant>>(lazyNamedArguments));
Symbols\Attributes\RetargetingAttributeData.cs (6)
20private readonly ImmutableArray<TypedConstant> _constructorArguments; 21private readonly ImmutableArray<KeyValuePair<string, TypedConstant>> _namedArguments; 27ImmutableArray<TypedConstant> constructorArguments, 28ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments) 42protected internal override ImmutableArray<TypedConstant> CommonConstructorArguments => _constructorArguments; 43protected internal override ImmutableArray<KeyValuePair<string, TypedConstant>> CommonNamedArguments => _namedArguments;
Symbols\Attributes\SourceAttributeData.cs (10)
23private readonly ImmutableArray<TypedConstant> _constructorArguments; 25private readonly ImmutableArray<KeyValuePair<string, TypedConstant>> _namedArguments; 35ImmutableArray<TypedConstant> constructorArguments, 37ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments, 67constructorArguments: ImmutableArray<TypedConstant>.Empty, 69namedArguments: ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty, 80ImmutableArray<TypedConstant> constructorArguments, 82ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments, 202protected internal sealed override ImmutableArray<TypedConstant> CommonConstructorArguments 207protected internal sealed override ImmutableArray<KeyValuePair<string, TypedConstant>> CommonNamedArguments
Symbols\Compilation_WellKnownMembers.cs (15)
390ImmutableArray<TypedConstant> arguments = default, 391ImmutableArray<KeyValuePair<WellKnownMember, TypedConstant>> namedArguments = default, 405arguments = ImmutableArray<TypedConstant>.Empty; 408ImmutableArray<KeyValuePair<string, TypedConstant>> namedStringArguments; 411namedStringArguments = ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty; 415var builder = new ArrayBuilder<KeyValuePair<string, TypedConstant>>(namedArguments.Length); 427builder.Add(new KeyValuePair<string, TypedConstant>( 452arguments: ImmutableArray<TypedConstant>.Empty, 453namedArguments: ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 481var ticks = new TypedConstant(GetSpecialType(SpecialType.System_Int64), TypedConstantKind.Primitive, value.Ticks); 763var typedConstantDebugMode = new TypedConstant(debuggingModesType, TypedConstantKind.Enum, constantVal); 818new KeyValuePair<WellKnownMember, TypedConstant>(WellKnownMember.System_AttributeUsageAttribute__AllowMultiple, new TypedConstant(boolType, TypedConstantKind.Primitive, allowMultiple)), 819new KeyValuePair<WellKnownMember, TypedConstant>(WellKnownMember.System_AttributeUsageAttribute__Inherited, new TypedConstant(boolType, TypedConstantKind.Primitive, inherited))); 838public static ImmutableArray<TypedConstant> Encode(TypeSymbol type, TypeSymbol stringType) 889internal static ImmutableArray<TypedConstant> Encode(TypeSymbol type, RefKind refKind, int customModifiersCount, TypeSymbol booleanType)
Symbols\MethodSymbol.cs (2)
991TypedConstant value, 1010foreach (var callConvTypedConstant in value.Values)
Symbols\Retargeting\RetargetingSymbolTranslator.cs (19)
1178ImmutableArray<TypedConstant> oldAttributeCtorArguments = oldAttributeData.CommonConstructorArguments; 1179ImmutableArray<TypedConstant> newAttributeCtorArguments = RetargetAttributeConstructorArguments(oldAttributeCtorArguments); 1181ImmutableArray<KeyValuePair<string, TypedConstant>> oldAttributeNamedArguments = oldAttributeData.CommonNamedArguments; 1182ImmutableArray<KeyValuePair<string, TypedConstant>> newAttributeNamedArguments = RetargetAttributeNamedArguments(oldAttributeNamedArguments); 1195private ImmutableArray<TypedConstant> RetargetAttributeConstructorArguments(ImmutableArray<TypedConstant> constructorArguments) 1197ImmutableArray<TypedConstant> retargetedArguments = constructorArguments; 1202var newArguments = ArrayBuilder<TypedConstant>.GetInstance(constructorArguments.Length); 1204foreach (TypedConstant oldArgument in constructorArguments) 1206TypedConstant retargetedArgument = RetargetTypedConstant(oldArgument, ref argumentsHaveChanged); 1221private TypedConstant RetargetTypedConstant(TypedConstant oldConstant, ref bool typedConstantChanged) 1264private ImmutableArray<KeyValuePair<string, TypedConstant>> RetargetAttributeNamedArguments(ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments) 1271var newArguments = ArrayBuilder<KeyValuePair<string, TypedConstant>>.GetInstance(namedArguments.Length); 1273foreach (KeyValuePair<string, TypedConstant> oldArgument in namedArguments) 1275TypedConstant oldConstant = oldArgument.Value; 1277TypedConstant newConstant = RetargetTypedConstant(oldConstant, ref typedConstantChanged); 1281newArguments.Add(new KeyValuePair<string, TypedConstant>(oldArgument.Key, newConstant));
Symbols\Source\SourceAssemblySymbol.cs (9)
1828var typedConstantRequestMinimum = new TypedConstant(securityActionType, TypedConstantKind.Enum, constantValue); 1834var typedConstantTrue = new TypedConstant(boolType, TypedConstantKind.Primitive, value: true); 1839ImmutableArray.Create(new KeyValuePair<WellKnownMember, TypedConstant>( 1972var typedConstantNoStringInterning = new TypedConstant(int32Type, TypedConstantKind.Primitive, Cci.Constants.CompilationRelaxations_NoStringInterning); 1991var typedConstantTrue = new TypedConstant(boolType, TypedConstantKind.Primitive, value: true); 1995ImmutableArray<TypedConstant>.Empty, 1996ImmutableArray.Create(new KeyValuePair<WellKnownMember, TypedConstant>( 2025var typedConstant = new TypedConstant(stringType, TypedConstantKind.Primitive, _compilation.Options.CryptoKeyContainer); 2035var typedConstant = new TypedConstant(stringType, TypedConstantKind.Primitive, _compilation.Options.CryptoKeyFile);
Symbols\Source\SourceComplexParameterSymbol.cs (4)
978var arg = attribute.CommonConstructorArguments[0]; 1261TypedConstant constructorArgument = arguments.Attribute.CommonConstructorArguments[0]; 1293foreach (var nestedArgument in constructorArgument.Values) 1324(int Ordinal, ParameterSymbol? Parameter)? decodeName(TypedConstant constant, ref DecodeWellKnownAttributeArguments<AttributeSyntax, CSharpAttributeData, AttributeLocation> arguments)
Symbols\Source\SourceFixedFieldSymbol.cs (3)
47var item1 = new TypedConstant(systemType, TypedConstantKind.Type, ((PointerTypeSymbol)this.Type).PointedAtType); 48var item2 = new TypedConstant(intType, TypedConstantKind.Primitive, this.FixedSize); 51ImmutableArray.Create<TypedConstant>(item1, item2)));
Symbols\Source\SourceMemberMethodSymbol.cs (1)
1044var arg = new TypedConstant(compilation.GetWellKnownType(WellKnownType.System_Type),
Symbols\Source\SourceNamedTypeSymbol.cs (2)
1335TypedConstant argument = attribute.CommonConstructorArguments[0]; 1712var defaultMemberNameConstant = new TypedConstant(compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, defaultMemberName);
Symbols\Source\SynthesizedAttributeData.cs (10)
17public static SynthesizedAttributeData Create(CSharpCompilation compilation, MethodSymbol wellKnownMember, ImmutableArray<TypedConstant> arguments, ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments) 31private readonly ImmutableArray<TypedConstant> _arguments; 32private readonly ImmutableArray<KeyValuePair<string, TypedConstant>> _namedArguments; 34internal FromMethodAndArguments(CSharpCompilation compilation, MethodSymbol wellKnownMember, ImmutableArray<TypedConstant> arguments, ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments) 49protected internal override ImmutableArray<TypedConstant> CommonConstructorArguments => _arguments; 50protected internal override ImmutableArray<KeyValuePair<string, TypedConstant>> CommonNamedArguments => _namedArguments; 79protected internal override ImmutableArray<TypedConstant> CommonConstructorArguments => _original.CommonConstructorArguments; 80protected internal override ImmutableArray<KeyValuePair<string, TypedConstant>> CommonNamedArguments => _original.CommonNamedArguments;
Symbols\Synthesized\SynthesizedInlineArrayTypeSymbol.cs (1)
201namedArguments: ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty));
Symbols\TypedConstantExtensions.cs (4)
18public static string ToCSharpString(this TypedConstant constant) 47private static string DisplayEnumConstant(TypedConstant constant) 67private static string DisplayUnsignedEnumConstant(TypedConstant constant, SpecialType specialType, ulong constantToDecode, string typeName) 146private static string DisplaySignedEnumConstant(TypedConstant constant, SpecialType specialType, long constantToDecode, string typeName)
Symbols\TypeSymbolExtensions.cs (1)
294var typedConstantKind = TypedConstant.GetTypedConstantKind(type, compilation);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (1)
26SyntaxGenerator generator, TypedConstant typedConstant)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (5)
Attributes\AttributeTests_Dynamic.cs (3)
540TypedConstant argument = dynamicAttribute.CommonConstructorArguments.Single(); 543ImmutableArray<TypedConstant> actualTransformFlags = argument.Values; 548TypedConstant actualTransformFlag = actualTransformFlags[i];
Attributes\AttributeTests_Synthesized.cs (1)
1968namedArguments: ImmutableArray.Create(new KeyValuePair<WellKnownMember, TypedConstant>(
Attributes\AttributeTests_Tuples.cs (1)
645private static string TypedConstantString(TypedConstant constant)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (11)
Symbols\Metadata\PE\LoadingAttributes.cs (1)
570private static void CheckNamedArg(KeyValuePair<string, string> expected, KeyValuePair<string, TypedConstant> actual)
Symbols\TypedConstantTests.cs (10)
44TypedConstant common = new TypedConstant(_systemType, TypedConstantKind.Type, _namedType); 45TypedConstant lang = (TypedConstant)common; 46TypedConstant common2 = lang; 56TypedConstant commonArray = new TypedConstant(_arrayType, 59TypedConstant langArray = (TypedConstant)commonArray; 60TypedConstant commonArray2 = langArray; 74EqualityTesting.AssertEqual(default(TypedConstant), default(TypedConstant));
Microsoft.CodeAnalysis.CSharp.Test.Utilities (7)
Extensions.cs (5)
405var arg = attr.CommonConstructorArguments[i]; 414var arg = namedArg.Value; 422internal static bool IsEqual(TypedConstant arg, object expected) 537private static bool AreEqual(ImmutableArray<TypedConstant> tc, object o) 558var c = tc[i];
TestAttributesVisitor.cs (2)
175static void printValues(StringBuilder builder, ImmutableArray<TypedConstant> values) 187static void printValue(StringBuilder builder, TypedConstant value)
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (2)
Metadata\WinMdDumpTest.cs (2)
288private static void AppendConstant(StringBuilder result, TypedConstant constant) 296foreach (var item in constant.Values)
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
3376public override SyntaxNode TypedConstantExpression(TypedConstant value)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (1)
26SyntaxGenerator generator, TypedConstant typedConstant)
Microsoft.CodeAnalysis.Features (1)
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
488var argument = attribute.ConstructorArguments[0];
Microsoft.CodeAnalysis.UnitTests (2)
CommonTypedConstantTests.cs (2)
39EqualityTesting.AssertEqual(default(TypedConstant), default(TypedConstant));
Microsoft.CodeAnalysis.VisualBasic (109)
Binding\Binder_Attributes.vb (23)
79Dim args As ImmutableArray(Of TypedConstant) = visitor.VisitPositionalArguments(boundAttribute.ConstructorArguments, diagnostics) 80Dim namedArgs As ImmutableArray(Of KeyValuePair(Of String, TypedConstant)) = visitor.VisitNamedArguments(boundAttribute.NamedArguments, diagnostics) 684Public Function VisitPositionalArguments(arguments As ImmutableArray(Of BoundExpression), diag As BindingDiagnosticBag) As ImmutableArray(Of TypedConstant) 688Private Function VisitArguments(arguments As ImmutableArray(Of BoundExpression), diag As BindingDiagnosticBag) As ImmutableArray(Of TypedConstant) 689Dim builder As ArrayBuilder(Of TypedConstant) = Nothing 692builder = ArrayBuilder(Of TypedConstant).GetInstance() 698Return ImmutableArray(Of TypedConstant).Empty 704Public Function VisitNamedArguments(arguments As ImmutableArray(Of BoundExpression), diag As BindingDiagnosticBag) As ImmutableArray(Of KeyValuePair(Of String, TypedConstant)) 705Dim builder As ArrayBuilder(Of KeyValuePair(Of String, TypedConstant)) = Nothing 712builder = ArrayBuilder(Of KeyValuePair(Of String, TypedConstant)).GetInstance() 720Return ImmutableArray(Of KeyValuePair(Of String, TypedConstant)).Empty 726Private Function VisitNamedArgument(argument As BoundExpression, diag As BindingDiagnosticBag) As Nullable(Of KeyValuePair(Of String, TypedConstant)) 734Return New KeyValuePair(Of String, TypedConstant)(left.FieldSymbol.Name, VisitExpression(assignment.Right, diag)) 738Return New KeyValuePair(Of String, TypedConstant)(left.PropertySymbol.Name, VisitExpression(assignment.Right, diag)) 746Public Function VisitExpression(node As BoundExpression, diagBag As BindingDiagnosticBag) As TypedConstant 829Private Function VisitGetType(node As BoundGetType, diagBag As BindingDiagnosticBag) As TypedConstant 851Private Function VisitArrayCreation(node As BoundArrayCreation, diag As BindingDiagnosticBag) As TypedConstant 854Dim values As ImmutableArray(Of TypedConstant) = Nothing 879Private Shared Function CreateTypedConstant(type As ArrayTypeSymbol, array As ImmutableArray(Of TypedConstant)) As TypedConstant 883Private Function CreateTypedConstant(type As TypeSymbol, value As Object) As TypedConstant 884Dim kind = TypedConstant.GetTypedConstantKind(type, _binder.Compilation) 894Private Function CreateErrorTypedConstant(type As TypeSymbol) As TypedConstant
Compilation\ClsComplianceChecker.vb (1)
777Dim args As ImmutableArray(Of TypedConstant) = attributeData.CommonConstructorArguments
Emit\AttributeDataAdapter.vb (4)
65Private Function CreateMetadataExpression(argument As TypedConstant, context As EmitContext) As Cci.IMetadataExpression 80Private Function CreateMetadataArray(argument As TypedConstant, context As EmitContext) As MetadataCreateArray 103Private Function CreateType(argument As TypedConstant, context As EmitContext) As MetadataTypeOf 118Private Function CreateMetadataNamedArgument(name As String, argument As TypedConstant, context As EmitContext) As Cci.IMetadataNamedArgument
Emit\NoPia\EmbeddedType.vb (3)
205Return New SynthesizedAttributeData(TypeManager.ModuleBeingBuilt.Compilation, ctor, ImmutableArray(Of TypedConstant).Empty, ImmutableArray(Of KeyValuePair(Of String, TypedConstant)).Empty) 222ImmutableArray(Of KeyValuePair(Of String, TypedConstant)).Empty)
Emit\NoPia\EmbeddedTypesManager.vb (6)
88Friend Overrides Function CreateSynthesizedAttribute(constructor As WellKnownMember, constructorArguments As ImmutableArray(Of TypedConstant), namedArguments As ImmutableArray(Of KeyValuePair(Of String, TypedConstant)), syntaxNodeOpt As SyntaxNode, diagnostics As DiagnosticBag) As VisualBasicAttributeData 101ImmutableArray(Of KeyValuePair(Of String, TypedConstant)).Empty) 110ImmutableArray(Of KeyValuePair(Of String, TypedConstant)).Empty) 118Friend Overrides Function TryGetAttributeArguments(attrData As VisualBasicAttributeData, ByRef constructorArguments As ImmutableArray(Of TypedConstant), ByRef namedArguments As ImmutableArray(Of KeyValuePair(Of String, TypedConstant)), syntaxNodeOpt As SyntaxNode, diagnostics As DiagnosticBag) As Boolean
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousDelegate_TemplateSymbol.vb (1)
184ImmutableArray.Create(New KeyValuePair(Of WellKnownMember, TypedConstant)(
Symbols\Attributes\AttributeData.vb (7)
46Public Shadows ReadOnly Property ConstructorArguments As IEnumerable(Of TypedConstant) 55Public Shadows ReadOnly Property NamedArguments As IEnumerable(Of KeyValuePair(Of String, TypedConstant)) 233Dim firstArg As TypedConstant = Me.CommonConstructorArguments.FirstOrDefault() 278typedValue As TypedConstant, 437Dim ctorArgument As TypedConstant = Me.CommonConstructorArguments(0) 464Dim ctorArgument As TypedConstant = Me.CommonConstructorArguments(0) 482Dim ctorArgument As TypedConstant = Me.CommonConstructorArguments(0)
Symbols\Attributes\PEAttributeData.vb (8)
26Private _lazyConstructorArguments As TypedConstant() 27Private _lazyNamedArguments As KeyValuePair(Of String, TypedConstant)() 72Protected Overrides ReadOnly Property CommonConstructorArguments As ImmutableArray(Of TypedConstant) 85Protected Overrides ReadOnly Property CommonNamedArguments As ImmutableArray(Of KeyValuePair(Of String, TypedConstant)) 125Dim constructorArgs As TypedConstant() = Nothing 126Dim namedArgs As KeyValuePair(Of String, TypedConstant)() = Nothing 134Interlocked.CompareExchange(Of KeyValuePair(Of String, TypedConstant)())( 139Interlocked.CompareExchange(Of TypedConstant())(
Symbols\Attributes\RetargetingAttributeData.vb (6)
22Private ReadOnly _constructorArguments As ImmutableArray(Of TypedConstant) 23Private ReadOnly _namedArguments As ImmutableArray(Of KeyValuePair(Of String, TypedConstant)) 28ByVal constructorArguments As ImmutableArray(Of TypedConstant), 29ByVal namedArguments As ImmutableArray(Of KeyValuePair(Of String, TypedConstant))) 58Protected Overrides ReadOnly Property CommonConstructorArguments As ImmutableArray(Of TypedConstant) 64Protected Overrides ReadOnly Property CommonNamedArguments As ImmutableArray(Of KeyValuePair(Of String, TypedConstant))
Symbols\Attributes\SourceAttributeData.vb (7)
25Private ReadOnly _constructorArguments As ImmutableArray(Of TypedConstant) 26Private ReadOnly _namedArguments As ImmutableArray(Of KeyValuePair(Of String, TypedConstant)) 35ByVal constructorArgs As ImmutableArray(Of TypedConstant), 36ByVal namedArgs As ImmutableArray(Of KeyValuePair(Of String, TypedConstant)), 48Me._namedArguments = If(namedArgs.IsDefault, ImmutableArray.Create(Of KeyValuePair(Of String, TypedConstant))(), namedArgs) 71Protected Overrides ReadOnly Property CommonConstructorArguments As ImmutableArray(Of TypedConstant) 77Protected Overrides ReadOnly Property CommonNamedArguments As ImmutableArray(Of KeyValuePair(Of String, TypedConstant))
Symbols\Retargeting\RetargetingSymbolTranslator.vb (14)
701Private Function RetargetAttributeConstructorArguments(constructorArguments As ImmutableArray(Of TypedConstant)) As ImmutableArray(Of TypedConstant) 706Dim newArguments = ArrayBuilder(Of TypedConstant).GetInstance(constructorArguments.Length) 708For Each oldArgument As TypedConstant In constructorArguments 709Dim retargetedArgument As TypedConstant = RetargetTypedConstant(oldArgument, argumentsHaveChanged) 723Private Function RetargetTypedConstant(oldConstant As TypedConstant, ByRef typedConstantChanged As Boolean) As TypedConstant 755Private Function RetargetAttributeNamedArguments(namedArguments As ImmutableArray(Of KeyValuePair(Of String, TypedConstant))) As ImmutableArray(Of KeyValuePair(Of String, TypedConstant)) 760Dim newArguments = ArrayBuilder(Of KeyValuePair(Of String, TypedConstant)).GetInstance(namedArguments.Length) 762For Each oldArgument As KeyValuePair(Of String, TypedConstant) In namedArguments 763Dim oldConstant As TypedConstant = oldArgument.Value 765Dim newConstant As TypedConstant = RetargetTypedConstant(oldConstant, typedConstantChanged) 768newArguments.Add(New KeyValuePair(Of String, TypedConstant)(oldArgument.Key, newConstant))
Symbols\Source\SourceAssemblySymbol.vb (2)
1572ImmutableArray(Of TypedConstant).Empty, 1573ImmutableArray.Create(New KeyValuePair(Of WellKnownMember, TypedConstant)(
Symbols\Source\SourceNamedTypeSymbol.vb (1)
2218Dim argument As TypedConstant = attrData.CommonConstructorArguments(0)
Symbols\Source\SourceNamedTypeSymbol_ComClass.vb (3)
38Dim args As ImmutableArray(Of TypedConstant) = attrData.CommonConstructorArguments 310Dim typedValue As TypedConstant = attrData(comVisible).CommonConstructorArguments(0) 484Dim typedValue As TypedConstant = attrData(dispIdIndex).CommonConstructorArguments(0)
Symbols\SynthesizedSymbols\SynthesizedAttributeData.vb (10)
21Private ReadOnly _constructorArguments As ImmutableArray(Of TypedConstant) 22Private ReadOnly _namedArguments As ImmutableArray(Of KeyValuePair(Of String, TypedConstant)) 26arguments As ImmutableArray(Of TypedConstant), 27namedArgs As ImmutableArray(Of KeyValuePair(Of String, TypedConstant))) 45Optional arguments As ImmutableArray(Of TypedConstant) = Nothing, 46Optional namedArguments As ImmutableArray(Of KeyValuePair(Of String, TypedConstant)) = Nothing) As SynthesizedAttributeData 58arguments = ImmutableArray(Of TypedConstant).Empty 62namedArguments = ImmutableArray(Of KeyValuePair(Of String, TypedConstant)).Empty 87Protected Overrides ReadOnly Property CommonConstructorArguments As ImmutableArray(Of TypedConstant) 93Protected Overrides ReadOnly Property CommonNamedArguments As ImmutableArray(Of KeyValuePair(Of String, TypedConstant))
Symbols\TypedConstant.vb (4)
28Public Function ToVisualBasicString(constant As TypedConstant) As String 50Private Function DisplayEnumConstant(constant As TypedConstant) As String 66Private Function DisplayUnsignedEnumConstant(constant As TypedConstant, splType As SpecialType, ByVal constantToDecode As ULong, ByVal typeName As String) As String 130Private Function DisplaySignedEnumConstant(constant As TypedConstant, ByVal splType As SpecialType, ByVal constantToDecode As Long, ByVal typeName As String) As String
Symbols\WellKnownMembers.vb (9)
154Optional arguments As ImmutableArray(Of TypedConstant) = Nothing, 155Optional namedArguments As ImmutableArray(Of KeyValuePair(Of WellKnownMember, TypedConstant)) = Nothing, 166arguments = ImmutableArray(Of TypedConstant).Empty 169Dim namedStringArguments As ImmutableArray(Of KeyValuePair(Of String, TypedConstant)) 171namedStringArguments = ImmutableArray(Of KeyValuePair(Of String, TypedConstant)).Empty 173Dim builder = New ArrayBuilder(Of KeyValuePair(Of String, TypedConstant))(namedArguments.Length) 181builder.Add(New KeyValuePair(Of String, TypedConstant)(wellKnownMember.Name, arg.Value)) 707Dim names As ImmutableArray(Of TypedConstant) = TupleNamesEncoder.Encode(type, stringType) 728Public Shared Function Encode(type As TypeSymbol, stringType As TypeSymbol) As ImmutableArray(Of TypedConstant)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.vb (1)
18Public Function GenerateExpression(generator As SyntaxGenerator, typedConstant As TypedConstant) As ExpressionSyntax
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (2)
Attributes\AttributeTests_Synthesized.vb (1)
1827namedArguments:=ImmutableArray.Create(New KeyValuePair(Of WellKnownMember, TypedConstant)(
Attributes\AttributeTests_Tuples.vb (1)
442Private Shared Function TypedConstantString(constant As TypedConstant) As String
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (9)
SymbolsTests\TypedConstantTests.vb (9)
35Dim common As TypedConstant = New TypedConstant(_systemType, TypedConstantKind.Type, _namedType) 36Dim lang As TypedConstant = CType(common, TypedConstant) 37Dim common2 As TypedConstant = lang 47Dim commonArray As TypedConstant = New TypedConstant(_arrayType, 49Dim langArray As TypedConstant = CType(commonArray, TypedConstant) 50Dim commonArray2 As TypedConstant = langArray 60Assert.Equal(common2, CType(lang, TypedConstant))
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
Extensions.vb (2)
178Private Function IsEqual(Of T)(ByVal arg As TypedConstant, ByVal expected As T) As Boolean 278Private Function AreEqual(tc As ImmutableArray(Of TypedConstant), o As Object) As Boolean
Microsoft.CodeAnalysis.VisualBasic.Workspaces (2)
CodeGeneration\VisualBasicSyntaxGenerator.vb (1)
154Public Overrides Function TypedConstantExpression(value As TypedConstant) As SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.vb (1)
18Public Function GenerateExpression(generator As SyntaxGenerator, typedConstant As TypedConstant) As ExpressionSyntax
Microsoft.CodeAnalysis.Workspaces (10)
Editing\SyntaxGenerator.cs (1)
1807public abstract SyntaxNode TypedConstantExpression(TypedConstant value);
FindSymbols\FindReferences\DependentProjectsFinder.cs (1)
288var typeNameConstant = attr.ConstructorArguments.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (2)
409ImmutableArray<TypedConstant> constructorArguments = default, 410ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments = default)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAttributeData.cs (6)
14ImmutableArray<TypedConstant> constructorArguments, 15ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments) : AttributeData 17private readonly ImmutableArray<TypedConstant> _constructorArguments = constructorArguments.NullToEmpty(); 18private readonly ImmutableArray<KeyValuePair<string, TypedConstant>> _namedArguments = namedArguments.NullToEmpty(); 22protected override ImmutableArray<TypedConstant> CommonConstructorArguments => _constructorArguments; 23protected override ImmutableArray<KeyValuePair<string, TypedConstant>> CommonNamedArguments => _namedArguments;
Microsoft.Extensions.Logging.Generators (6)
LoggerMessageGenerator.Parser.cs (6)
138foreach (TypedConstant typedConstant in attributeData.ConstructorArguments) 147ImmutableArray<TypedConstant> items = attributeData.ConstructorArguments; 193foreach (KeyValuePair<string, TypedConstant> namedArgument in attributeData.NamedArguments) 195TypedConstant typedConstant = namedArgument.Value; 203TypedConstant value = namedArgument.Value; 854private static object GetItem(TypedConstant arg) => arg.Kind == TypedConstantKind.Array ? arg.Values : arg.Value;
Microsoft.Extensions.Options.SourceGeneration (3)
Parser.cs (3)
504ImmutableArray<TypedConstant> arguments = attribute.ConstructorArguments; 508TypedConstant argument = arguments[i]; 778private string GetArrayArgumentExpression(ImmutableArray<Microsoft.CodeAnalysis.TypedConstant> value, bool isParams)
Microsoft.Gen.Logging (1)
Parsing\AttributeProcessors.cs (1)
41foreach (var a in attr.ConstructorArguments)
Microsoft.Gen.Logging.Unit.Tests (4)
LogParserUtilitiesTests.cs (4)
178.SetupGet<ImmutableArray<KeyValuePair<string, TypedConstant>>>("CommonNamedArguments") 179.Returns(ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty); 183.SetupGet<ImmutableArray<TypedConstant>>("CommonConstructorArguments") 184.Returns(ImmutableArray<TypedConstant>.Empty);
Microsoft.Gen.Metrics (6)
Parser.cs (6)
298foreach (var arg in attribute.ConstructorArguments) 305foreach (var item in arg.Values) 425KeyValuePair<string, TypedConstant> namedArg; 426var ctorArg = methodAttribute.ConstructorArguments[0]; 607TypedConstant constructorArg, 608KeyValuePair<string, TypedConstant> namedArgument,
Microsoft.Gen.MetricsReports (6)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (6)
298foreach (var arg in attribute.ConstructorArguments) 305foreach (var item in arg.Values) 425KeyValuePair<string, TypedConstant> namedArg; 426var ctorArg = methodAttribute.ConstructorArguments[0]; 607TypedConstant constructorArg, 608KeyValuePair<string, TypedConstant> namedArgument,
Microsoft.Interop.ComInterfaceGenerator (8)
Analyzers\GeneratedComInterfaceAttributeAnalyzer.cs (1)
56TypedConstant ctorArg0 = comInterfaceAttribute.ConstructorArguments[0];
GeneratedComInterfaceAttributeData.cs (1)
66if (args.TryGetValue(nameof(Options), out var options))
VirtualMethodPointerStubGenerator.cs (2)
299foreach (KeyValuePair<string, TypedConstant> arg in unmanagedCallConvAttribute.NamedArguments) 303foreach (TypedConstant callConv in arg.Value.Values)
VtableIndexStubGenerator.cs (4)
150if (namedArguments.TryGetValue(nameof(VirtualMethodIndexCompilationData.Direction), out TypedConstant directionValue)) 160if (namedArguments.TryGetValue(nameof(VirtualMethodIndexCompilationData.ImplicitThisParameter), out TypedConstant implicitThisValue)) 168if (namedArguments.TryGetValue(nameof(VirtualMethodIndexCompilationData.ExceptionMarshalling), out TypedConstant exceptionMarshallingValue)) 179if (namedArguments.TryGetValue(nameof(VirtualMethodIndexCompilationData.ExceptionMarshallingCustomType), out TypedConstant exceptionMarshallingCustomTypeValue))
Microsoft.Interop.LibraryImportGenerator (4)
LibraryImportGenerator.cs (4)
125foreach (KeyValuePair<string, TypedConstant> arg in unmanagedCallConvAttribute.NamedArguments) 130foreach (TypedConstant callConv in arg.Value.Values) 200ImmutableDictionary<string, TypedConstant> namedArguments = ImmutableDictionary.CreateRange(attrData.NamedArguments); 203if (namedArguments.TryGetValue(nameof(LibraryImportCompilationData.EntryPoint), out TypedConstant entryPointValue))
Microsoft.Interop.LibraryImportGenerator.Downlevel (2)
DownlevelLibraryImportGenerator.cs (2)
142ImmutableDictionary<string, TypedConstant> namedArguments = ImmutableDictionary.CreateRange(attrData.NamedArguments); 145if (namedArguments.TryGetValue(nameof(LibraryImportCompilationData.EntryPoint), out TypedConstant entryPointValue))
Microsoft.Interop.SourceGeneration (11)
InteropAttributeData.cs (4)
55public static T WithValuesFromNamedArguments<T>(this T t, ImmutableDictionary<string, TypedConstant> namedArguments) where T : InteropAttributeCompilationData 62if (namedArguments.TryGetValue(nameof(InteropAttributeCompilationData.SetLastError), out TypedConstant setLastErrorValue)) 71if (namedArguments.TryGetValue(nameof(InteropAttributeCompilationData.StringMarshalling), out TypedConstant stringMarshallingValue)) 82if (namedArguments.TryGetValue(nameof(InteropAttributeCompilationData.StringMarshallingCustomType), out TypedConstant stringMarshallingCustomTypeValue))
MarshalAsParser.cs (4)
135ImmutableDictionary<string, TypedConstant> namedArguments = ImmutableDictionary.CreateRange(attributeData.NamedArguments); 137if (namedArguments.TryGetValue(nameof(MarshalAsAttribute.SizeConst), out TypedConstant sizeConstArg)) 141if (namedArguments.TryGetValue(nameof(MarshalAsAttribute.SizeParamIndex), out TypedConstant sizeParamIndexArg)) 169foreach (KeyValuePair<string, TypedConstant> namedArg in attributeData.NamedArguments)
MarshalUsingAttributeParser.cs (3)
66ImmutableDictionary<string, TypedConstant> namedArgs = ImmutableDictionary.CreateRange(attributeData.NamedArguments); 68int elementIndirectionDepth = namedArgs.TryGetValue(ManualTypeMarshallingHelper.MarshalUsingProperties.ElementIndirectionDepth, out TypedConstant value) ? (int)value.Value! : 0; 76foreach (KeyValuePair<string, TypedConstant> arg in attributeData.NamedArguments)
Mvc.Api.Analyzers.Test (2)
DeclaredApiResponseMetadataTest.cs (2)
161protected override ImmutableArray<TypedConstant> CommonConstructorArguments => throw new System.NotImplementedException(); 163protected override ImmutableArray<KeyValuePair<string, TypedConstant>> CommonNamedArguments => throw new System.NotImplementedException();
System.Private.CoreLib.Generators (2)
EventSourceGenerator.Parser.cs (2)
49ImmutableArray<KeyValuePair<string, TypedConstant>> args = attribute.NamedArguments; 50foreach (KeyValuePair<string, TypedConstant> arg in args)
System.Text.Json.SourceGeneration (8)
JsonSourceGenerator.Parser.cs (8)
297foreach (KeyValuePair<string, TypedConstant> namedArg in attributeData.NamedArguments) 311foreach (TypedConstant element in namedArg.Value.Values) 464foreach (KeyValuePair<string, TypedConstant> namedArg in attributeData.NamedArguments) 1273ImmutableArray<KeyValuePair<string, TypedConstant>> namedArgs = attributeData.NamedArguments; 1293ImmutableArray<TypedConstant> ctorArgs = attributeData.ConstructorArguments; 1299ImmutableArray<TypedConstant> ctorArgs = attributeData.ConstructorArguments; 1305ImmutableArray<TypedConstant> ctorArgs = attributeData.ConstructorArguments; 1312ImmutableArray<TypedConstant> ctorArgs = attributeData.ConstructorArguments;
System.Text.RegularExpressions.Generator (1)
RegexGenerator.Parser.cs (1)
74ImmutableArray<TypedConstant> items = generatedRegexAttr.ConstructorArguments;