コード例 #1
0
    public static void Load(this ILocalPropertyExpressionModel @this, ICodeTextWriter writer, SourceBuilder builder, IPropertySymbol property, ScopeInfo scope, IEnumerable <IMemberInfo> references)
    {
        foreach (IMemberInfo reference in references)
        {
            SourceBuilder builder2 = builder.AppendNewBuilder(false);
            writer.WritePropertyCall(builder2, reference, property, scope, SemanticFacts.IsNullable(writer.Compilation, property.Type), reference.PreferCoalesce);
            @this.GetExpressions.Add(builder2.ToString());
        }

        foreach (IMemberInfo reference in references)
        {
            SourceBuilder builder2 = builder.AppendNewBuilder(false);
            writer.WritePropertyCall(builder2, reference, property, scope, false, false);
            @this.SetExpressions.Add(builder2.ToString());
        }
    }
コード例 #2
0
    public static void Load(this IPropertyModel @this, ICodeTextWriter writer, SourceBuilder builder, IPropertySymbol property, ScopeInfo scope, IEnumerable <IMemberInfo> references)
    {
        {
            SourceBuilder builder2 = builder.AppendNewBuilder(false);
            writer.WriteIdentifier(builder2, property);
            @this.Name = builder2.ToString();
        }

        {
            SourceBuilder builder2 = builder.AppendNewBuilder(false);
            writer.WriteTypeReference(builder2, property.Type, scope);
            @this.Type = builder2.ToString();
        }

        @this.HaveGetter = property.GetMethod != null;
        @this.HaveSetter = property.SetMethod != null;

        foreach (IMemberInfo reference in references)
        {
            SourceBuilder builder2 = builder.AppendNewBuilder(false);
            writer.WritePropertyCall(builder2, reference, property, scope, SemanticFacts.IsNullable(writer.Compilation, property.Type), false);
            @this.Expressions.Add(builder2.ToString());
        }

        if (@this is ILocalPropertyExpressionModel this2)
        {
            this2.Load(writer, builder, property, scope, references);
        }
    }