private TypeSymbol GetTypeSymbol(Azure.Bicep.Types.Concrete.TypeBase serializedType, bool isResourceBodyType) { if (!typeCache.TryGetValue(serializedType, out var typeSymbol)) { typeSymbol = ToTypeSymbol(serializedType, isResourceBodyType); typeCache[serializedType] = typeSymbol; } return(typeSymbol); }
private TypeSymbol ToTypeSymbol(Azure.Bicep.Types.Concrete.TypeBase typeBase, bool isResourceBodyType) { switch (typeBase) { case Azure.Bicep.Types.Concrete.BuiltInType builtInType: return(builtInType.Kind switch { Azure.Bicep.Types.Concrete.BuiltInTypeKind.Any => LanguageConstants.Any, Azure.Bicep.Types.Concrete.BuiltInTypeKind.Null => LanguageConstants.Null, Azure.Bicep.Types.Concrete.BuiltInTypeKind.Bool => LanguageConstants.Bool, Azure.Bicep.Types.Concrete.BuiltInTypeKind.Int => LanguageConstants.Int, Azure.Bicep.Types.Concrete.BuiltInTypeKind.String => LanguageConstants.String, Azure.Bicep.Types.Concrete.BuiltInTypeKind.Object => LanguageConstants.Object, Azure.Bicep.Types.Concrete.BuiltInTypeKind.Array => LanguageConstants.Array, Azure.Bicep.Types.Concrete.BuiltInTypeKind.ResourceRef => LanguageConstants.ResourceRef, _ => throw new ArgumentException(), });
private TypeSymbol GetTypeSymbol(Azure.Bicep.Types.Concrete.TypeBase serializedType, bool isResourceBodyType) => typeCache.GetOrAdd(serializedType, serializedType => ToTypeSymbol(serializedType, isResourceBodyType));